Skip to content

Commit ab33eee

Browse files
committed
pkcs12: document that we use the wrong PEM type
Fixes golang/go#28018 Change-Id: I2daf99789328ef476de834c3cc703e01b468b3ee Reviewed-on: https://go-review.googlesource.com/c/crypto/+/241337 Reviewed-by: Katie Hockman <[email protected]> Run-TryBot: Katie Hockman <[email protected]> TryBot-Result: Gobot Gobot <[email protected]>
1 parent 75b2880 commit ab33eee

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

pkcs12/pkcs12.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,10 @@ func unmarshal(in []byte, out interface{}) error {
104104
}
105105

106106
// ToPEM converts all "safe bags" contained in pfxData to PEM blocks.
107+
//
108+
// Note that although the returned PEM blocks for private keys have type
109+
// "PRIVATE KEY", the bytes are not encoded according to PKCS #8, but according
110+
// to PKCS #1 for RSA keys and SEC 1 for ECDSA keys.
107111
func ToPEM(pfxData []byte, password string) ([]*pem.Block, error) {
108112
encodedPassword, err := bmpString(password)
109113
if err != nil {

0 commit comments

Comments
 (0)