Because of password len check here, encrypted key with empty password does not work.
- Should encrypted key with empty password be supported?
- If answer to point 1 is yes, would below check suffice?
func isEncryptedKey(der []byte) bool {
type EncryptedPrivateKeyInfo struct {
Algorithm asn1.RawValue // Encryption algorithm and parameters
EncryptedData []byte // The encrypted private key bytes
}
var encryptedKey EncryptedPrivateKeyInfo
_, err := asn1.Unmarshal(der, &encryptedKey)
return err == nil
}
Because of password len check here, encrypted key with empty password does not work.