Documentation ¶
Index ¶
- Variables
- func ConvertPrivateKeyToPKCS8(priv interface{}, v ...[]byte) ([]byte, error)
- func MarshalPrivateKey(priv interface{}, password []byte, opts *Opts) ([]byte, error)
- func ParsePKCS8PrivateKey(der []byte, v ...[]byte) (interface{}, error)
- func ParsePKCS8PrivateKeyECDSA(der []byte, v ...[]byte) (*ecdsa.PrivateKey, error)
- func ParsePKCS8PrivateKeyRSA(der []byte, v ...[]byte) (*rsa.PrivateKey, error)
- func ParsePKCS8PrivateKeySM2(der []byte, v ...[]byte) (*sm2.PrivateKey, error)
- func RegisterKDF(oid asn1.ObjectIdentifier, params func() KDFParameters)
- type Hash
- type KDFOpts
- type KDFParameters
- type Opts
- type PBKDF2Opts
- type ScryptOpts
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultOpts = &Opts{ Cipher: pkcs.AES256CBC, KDFOpts: PBKDF2Opts{ SaltSize: 8, IterationCount: 10000, HMACHash: SHA256, }, }
Functions ¶
func MarshalPrivateKey ¶
func ParsePKCS8PrivateKey ¶
func ParsePKCS8PrivateKeyECDSA ¶
func ParsePKCS8PrivateKeyECDSA(der []byte, v ...[]byte) (*ecdsa.PrivateKey, error)
func ParsePKCS8PrivateKeyRSA ¶
func ParsePKCS8PrivateKeyRSA(der []byte, v ...[]byte) (*rsa.PrivateKey, error)
func ParsePKCS8PrivateKeySM2 ¶
func ParsePKCS8PrivateKeySM2(der []byte, v ...[]byte) (*sm2.PrivateKey, error)
func RegisterKDF ¶
func RegisterKDF(oid asn1.ObjectIdentifier, params func() KDFParameters)
Types ¶
type KDFOpts ¶
type KDFOpts interface { DeriveKey(password, salt []byte, size int) (key []byte, params KDFParameters, err error) GetSaltSize() int OID() asn1.ObjectIdentifier }
type KDFParameters ¶
func ParsePrivateKey ¶
func ParsePrivateKey(der []byte, password []byte) (interface{}, KDFParameters, error)
type PBKDF2Opts ¶
func (PBKDF2Opts) DeriveKey ¶
func (p PBKDF2Opts) DeriveKey(password, salt []byte, size int) ( key []byte, params KDFParameters, err error)
func (PBKDF2Opts) GetSaltSize ¶
func (p PBKDF2Opts) GetSaltSize() int
func (PBKDF2Opts) OID ¶
func (p PBKDF2Opts) OID() asn1.ObjectIdentifier
type ScryptOpts ¶
type ScryptOpts struct { SaltSize int CostParameter int BlockSize int ParallelizationParameter int }
func (ScryptOpts) DeriveKey ¶
func (p ScryptOpts) DeriveKey(password, salt []byte, size int) ( key []byte, params KDFParameters, err error)
func (ScryptOpts) GetSaltSize ¶
func (p ScryptOpts) GetSaltSize() int
func (ScryptOpts) OID ¶
func (p ScryptOpts) OID() asn1.ObjectIdentifier
Click to show internal directories.
Click to hide internal directories.