Documentation ¶
Index ¶
- func NewPlatformSecret(backend keystore.KeyBackend, tpm tpm2.TrustedPlatformModule, ...) keystore.Password
- func NewSignerECDSA(keyStore keystore.KeyStorer, signerStore keystore.SignerStorer, ...) crypto.Signer
- func NewSignerRSA(keyStore keystore.KeyStorer, signerStore keystore.SignerStorer, ...) crypto.Signer
- type KeyStore
- func (ks *KeyStore) Backend() keystore.KeyBackend
- func (ks *KeyStore) Close() error
- func (ks *KeyStore) CreatePassword(keyAttrs *keystore.KeyAttributes, backend keystore.KeyBackend, overwrite bool) error
- func (ks *KeyStore) Decrypter(attrs *keystore.KeyAttributes) (crypto.Decrypter, error)
- func (ks *KeyStore) Delete(attrs *keystore.KeyAttributes) error
- func (ks *KeyStore) DeletePassword(keyAttrs *keystore.KeyAttributes, backend keystore.KeyBackend) error
- func (ks *KeyStore) Equal(opaque keystore.OpaqueKey, x crypto.PrivateKey) bool
- func (ks *KeyStore) GenerateECDSA(keyAttrs *keystore.KeyAttributes) (keystore.OpaqueKey, error)
- func (ks *KeyStore) GenerateEd25519(attrs *keystore.KeyAttributes) (keystore.OpaqueKey, error)
- func (ks *KeyStore) GenerateKey(attrs *keystore.KeyAttributes) (keystore.OpaqueKey, error)
- func (ks *KeyStore) GenerateRSA(keyAttrs *keystore.KeyAttributes) (keystore.OpaqueKey, error)
- func (ks *KeyStore) GenerateSecretKey(attrs *keystore.KeyAttributes) error
- func (ks *KeyStore) Initialize(soPIN, userPIN keystore.Password) error
- func (ks *KeyStore) Key(keyAttrs *keystore.KeyAttributes) (keystore.OpaqueKey, error)
- func (ks *KeyStore) KeyAttributes() *keystore.KeyAttributes
- func (ks *KeyStore) Password(attrs *keystore.KeyAttributes) (keystore.Password, error)
- func (ks *KeyStore) RotateKey(attrs *keystore.KeyAttributes) (keystore.OpaqueKey, error)
- func (ks *KeyStore) SRKAttributes() *keystore.KeyAttributes
- func (ks *KeyStore) Signer(attrs *keystore.KeyAttributes) (crypto.Signer, error)
- func (ks *KeyStore) TPM2() tptpm2.TrustedPlatformModule
- func (ks *KeyStore) Type() keystore.StoreType
- func (ks *KeyStore) Verifier(attrs *keystore.KeyAttributes, opts *keystore.VerifyOpts) keystore.Verifier
- type Params
- type PlatformKeyStorer
- type PlatformSecret
- type SignerECDSA
- type SignerRSA
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewPlatformSecret ¶
func NewPlatformSecret( backend keystore.KeyBackend, tpm tpm2.TrustedPlatformModule, keyAttrs *keystore.KeyAttributes) keystore.Password
TPM 2.0 AES symmetric encryption and wrapping operations
func NewSignerECDSA ¶
func NewSignerECDSA( keyStore keystore.KeyStorer, signerStore keystore.SignerStorer, keyAttributes *keystore.KeyAttributes, publicKey crypto.PublicKey, tpm tpm2.TrustedPlatformModule) crypto.Signer
Signer that uses the Elliptical Curve Cryptography Digital Signature Algorithm (ECDSA).
Signs the requested data using the Certificate Authority Private Key, or, optionally, the private key provided via SignerOpts during the call to Sign.
func NewSignerRSA ¶
func NewSignerRSA( keyStore keystore.KeyStorer, signerStore keystore.SignerStorer, keyAttributes *keystore.KeyAttributes, publicKey crypto.PublicKey, tpm tpm2.TrustedPlatformModule) crypto.Signer
Types ¶
type KeyStore ¶
type KeyStore struct { PlatformKeyStorer // contains filtered or unexported fields }
func (*KeyStore) Backend ¶
func (ks *KeyStore) Backend() keystore.KeyBackend
Returns the key store backend
func (*KeyStore) CreatePassword ¶
func (ks *KeyStore) CreatePassword( keyAttrs *keystore.KeyAttributes, backend keystore.KeyBackend, overwrite bool) error
Saves the password in the provided key attributes to the TPM password store, optionally using the provided backend. If nil, the default backend provider will be used.
func (*KeyStore) Delete ¶
func (ks *KeyStore) Delete(attrs *keystore.KeyAttributes) error
Deletes a key pair from the key store. First a session is created to authenticate the request to ensure the caller has ownership of the key, then deleted from the backend.
func (*KeyStore) DeletePassword ¶
func (ks *KeyStore) DeletePassword( keyAttrs *keystore.KeyAttributes, backend keystore.KeyBackend) error
Delete a password from the TPM password store, optionally using the provided backend. If nil, the default backend provider will be used.
func (*KeyStore) Equal ¶
Compares the provided opaque key with the provided private key and returns true if they have the same Modulus / Curve.
func (*KeyStore) GenerateECDSA ¶
Generates a new ECDSA key pair using the provided key attributes and returns an OpaqueKey implementing crypto.Signer using the underlying Trusted Platform Module.
func (*KeyStore) GenerateEd25519 ¶
Returns keystore.ErrInvalidKeyAlgorithm as this is an unsupported TPM 2.0 algorithm
func (*KeyStore) GenerateKey ¶
Generates a new RSA key pair using the provided key attributes and returns an OpaqueKey implementing crypto.Signer using the underlying Trusted Platform Module.
func (*KeyStore) GenerateRSA ¶
Generates a new RSA key pair using the provided key attributes and returns an OpaqueKey implementing crypto.Signer using the underlying Trusted Platform Module.
func (*KeyStore) GenerateSecretKey ¶
func (ks *KeyStore) GenerateSecretKey( attrs *keystore.KeyAttributes) error
Generates a new AES-256 secret key
func (*KeyStore) Initialize ¶
Initializes the key store by provisioning the underlying TPM and creating a new Storage Root Key. The secret parameter is used as the SRK primary key password authorization. A fatal error is produced if the TPM hasn't been provisioned with a persistent EK.
func (*KeyStore) Key ¶
Returns a TPM 2.0 OpaqueKey for the requested key. Implements keystore.KeyStorer
func (*KeyStore) KeyAttributes ¶
func (ks *KeyStore) KeyAttributes() *keystore.KeyAttributes
Returns the key attributes for the key store secret sealed to the SRK
func (*KeyStore) Password ¶
Returns a secret sealed to a TPM keyed hash object using a just-in-time retrieval strategy, If the key is configured with the platform PCR policy, a PlatformPassword is returned otherwise the password is returned in clear text.
func (*KeyStore) RotateKey ¶
TPM key rotation is a no-op at this time because all of the key types implemented thus far are deterministic based on the Endorsement Primary Seed (EPS). Therefore, generating a new key will result in the same key. This method is here for compatibility with the keystore.KeyStorer interface and will be implemented in the future.
func (*KeyStore) SRKAttributes ¶
func (ks *KeyStore) SRKAttributes() *keystore.KeyAttributes
Returns the key store dedicated SRK attributes using it's persistent handle.
func (*KeyStore) TPM2 ¶
func (ks *KeyStore) TPM2() tptpm2.TrustedPlatformModule
Returns the underlying TPM 2.0 connection
func (*KeyStore) Verifier ¶
func (ks *KeyStore) Verifier( attrs *keystore.KeyAttributes, opts *keystore.VerifyOpts) keystore.Verifier
Returns a software runtime verifier to perform signature verifications. The verifier supports RSA PKCS1v15, RSA-PSS, ECDSA, and Ed25519.
type Params ¶
type Params struct { Backend keystore.KeyBackend Logger *logging.Logger DebugSecrets bool Config *tptpm2.KeyStoreConfig PlatformKeyStore PlatformKeyStorer Random io.Reader SignerStore keystore.SignerStorer TPM tptpm2.TrustedPlatformModule }
type PlatformKeyStorer ¶
type PlatformKeyStorer interface { CreatePassword(keyAttrs *keystore.KeyAttributes, backend keystore.KeyBackend, overwrite bool) error KeyAttributes() *keystore.KeyAttributes Password(keyAttrs *keystore.KeyAttributes) (keystore.Password, error) SRKAttributes() *keystore.KeyAttributes TPM2() tpm2.TrustedPlatformModule keystore.KeyStorer }
func NewKeyStore ¶
func NewKeyStore(params *Params) (PlatformKeyStorer, error)
type PlatformSecret ¶
func (PlatformSecret) Bytes ¶
func (p PlatformSecret) Bytes() ([]byte, error)
Returns the secret as bytes
func (PlatformSecret) String ¶
func (p PlatformSecret) String() (string, error)
Returns the secret as a string
type SignerECDSA ¶
func (SignerECDSA) Public ¶
func (signer SignerECDSA) Public() crypto.PublicKey
Returns the public half of the signing key
func (SignerECDSA) Sign ¶
func (signer SignerECDSA) Sign( rand io.Reader, digest []byte, opts crypto.SignerOpts) (signature []byte, err error)
Signs the requested digest using the PKCS #8 private key