Documentation ¶
Index ¶
- Constants
- func DecryptPEMBlock(block *pem.Block, password []byte) ([]byte, error)
- func EncryptPEMBlock(rand io.Reader, data, password []byte) (block *pem.Block, err error)
- func MarshalPKCS5PrivateKeyWithPassword(key crypto.PrivateKey, password []byte) (data []byte, err error)
- func ParsePKCS5PrivateKeyWithPassword(data []byte, password []byte) (key crypto.PrivateKey, err error)
- type EncryptedPrivateKeyInfo
- type EncryptionAlgorithmIdentifier
- type EncryptionScheme
- type KeyDerivationFunc
- type PBES2Params
- type PBKDF2Params
Constants ¶
const DefaultIterations = 10000
Variables ¶
This section is empty.
Functions ¶
func DecryptPEMBlock ¶
DecryptPEMBlock is a drop-in replacement for x509.DecryptPEMBlock, which only supports state-of-the art algorithms such as PBES2.
func EncryptPEMBlock ¶
EncryptPEMBlock encrypts a private key contained in data into a PEM block according to PKCS#8.
func MarshalPKCS5PrivateKeyWithPassword ¶
func MarshalPKCS5PrivateKeyWithPassword(key crypto.PrivateKey, password []byte) (data []byte, err error)
MarshalPKCS5PrivateKeyWithPassword marshals an private key protected with a password according to PKCS#5 into a byte array
func ParsePKCS5PrivateKeyWithPassword ¶
func ParsePKCS5PrivateKeyWithPassword(data []byte, password []byte) (key crypto.PrivateKey, err error)
ParsePKCS5PrivateKeyWithPassword reads a private key protected with a password according to PKCS#5 from a byte array.
Types ¶
type EncryptedPrivateKeyInfo ¶
type EncryptedPrivateKeyInfo struct { EncryptionAlgorithm EncryptionAlgorithmIdentifier EncryptedData []byte }
EncryptedPrivateKeyInfo contains meta-info about the encrypted private key. See https://datatracker.ietf.org/doc/html/rfc5958#section-3.
type EncryptionAlgorithmIdentifier ¶
type EncryptionAlgorithmIdentifier struct { Algorithm asn1.ObjectIdentifier Params PBES2Params }
EncryptionAlgorithmIdentifier is the identifier for the encryption algorithm. See https://datatracker.ietf.org/doc/html/rfc5958#section-3.
type EncryptionScheme ¶
type EncryptionScheme struct { EncryptionAlgorithm asn1.ObjectIdentifier IV []byte }
EncryptionScheme is part of PBES2 and specifies the encryption algorithm. See https://datatracker.ietf.org/doc/html/rfc8018#appendix-A.4.
type KeyDerivationFunc ¶
type KeyDerivationFunc struct { Algorithm asn1.ObjectIdentifier PBKDF2Params PBKDF2Params }
KeyDerivationFunc is part of PBES2 and specify the key derivation function. See https://datatracker.ietf.org/doc/html/rfc8018#appendix-A.4.
type PBES2Params ¶
type PBES2Params struct { KeyDerivationFunc KeyDerivationFunc EncryptionScheme EncryptionScheme }
PBES2Params are parameters for PBES2. See https://datatracker.ietf.org/doc/html/rfc8018#appendix-A.4.
type PBKDF2Params ¶
type PBKDF2Params struct { Salt []byte IterationCount int PRF pkix.AlgorithmIdentifier `asn1:"optional"` }
PBKDF2Params are parameters for PBKDF2. See https://datatracker.ietf.org/doc/html/rfc8018#appendix-A.2.