in pkcs8.go [119:131]
func parseEncryptionScheme(encryptionScheme pkix.AlgorithmIdentifier) (Cipher, []byte, error) {
oid := encryptionScheme.Algorithm.String()
newCipher, ok := ciphers[oid]
if !ok {
return nil, nil, fmt.Errorf("pkcs8: unsupported cipher (OID: %s)", oid)
}
cipher := newCipher()
var iv []byte
if _, err := asn1.Unmarshal(encryptionScheme.Parameters.FullBytes, &iv); err != nil {
return nil, nil, errors.New("pkcs8: invalid cipher parameters")
}
return cipher, iv, nil
}