darwin

package
v0.3.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 23, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Rendered for darwin/amd64

Overview

Package darwin contains a darwin-specific client for accessing the keychain APIs directly, bypassing the RPC mechanism of the universal client.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SecureKey

type SecureKey struct {
	// contains filtered or unexported fields
}

SecureKey is a public wrapper for the internal keychain implementation.

func NewSecureKey

func NewSecureKey(issuerCN string) (*SecureKey, error)

NewSecureKey returns a handle to the first available certificate and private key pair in the MacOS Keychain matching the issuer CN filter. This includes both the current login keychain for the user as well as the system keychain.

func (*SecureKey) CertificateChain

func (sk *SecureKey) CertificateChain() [][]byte

CertificateChain returns the SecureKey's raw X509 cert chain. This contains the public key.

func (*SecureKey) Close

func (sk *SecureKey) Close()

Close frees up resources associated with the underlying key.

func (*SecureKey) Decrypt added in v0.3.0

func (sk *SecureKey) Decrypt(_ io.Reader, msg []byte, opts crypto.DecrypterOpts) (plaintext []byte, err error)

Decrypt decrypts a ciphertext msg into plaintext, using the specified decrypter opts. Implements crypto.Decrypter interface.

func (*SecureKey) Encrypt added in v0.3.0

func (sk *SecureKey) Encrypt(_ io.Reader, msg []byte, opts any) (ciphertext []byte, err error)

Encrypt encrypts a plaintext msg into ciphertext, using the specified encrypt opts.

func (*SecureKey) Public

func (sk *SecureKey) Public() crypto.PublicKey

Public returns the public key for this SecureKey.

func (*SecureKey) Sign

func (sk *SecureKey) Sign(_ io.Reader, digest []byte, opts crypto.SignerOpts) (signed []byte, err error)

Sign signs a message digest, using the specified signer opts. Implements crypto.Signer interface.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL