From 943d9afd0fd03e8ab8ffab5a12b73cc899fc2380 Mon Sep 17 00:00:00 2001 From: Riyaz Faizullabhoy Date: Tue, 25 Jul 2017 14:28:11 -0700 Subject: [PATCH] pkcs8: add comment about padding during unmarshal Signed-off-by: Riyaz Faizullabhoy --- tuf/utils/pkcs8.go | 1 + 1 file changed, 1 insertion(+) diff --git a/tuf/utils/pkcs8.go b/tuf/utils/pkcs8.go index b0f11c427..cd18c6874 100644 --- a/tuf/utils/pkcs8.go +++ b/tuf/utils/pkcs8.go @@ -226,6 +226,7 @@ func ParsePKCS8ToTufKey(der []byte, password []byte) (data.PrivateKey, error) { mode := cipher.NewCBCDecrypter(block, iv) mode.CryptBlocks(encryptedKey, encryptedKey) + // no need to explicitly remove padding, as ASN.1 unmarshalling will automatically discard it key, err := parsePKCS8ToTufKey(encryptedKey) if err != nil { return nil, errors.New("pkcs8: incorrect password")