pkcs8: fix comments

This commit is contained in:
Sun Yimin 2023-02-01 17:34:42 +08:00 committed by GitHub
parent ff2b695500
commit 5b806c85fe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 4 deletions

View File

@ -27,7 +27,7 @@ func ExampleMarshalPrivateKey_withoutPassword() {
return return
} }
// ecode to pem // encode der bytes to pem
block := &pem.Block{Bytes: der, Type: "PRIVATE KEY"} block := &pem.Block{Bytes: der, Type: "PRIVATE KEY"}
pemContent := string(pem.EncodeToMemory(block)) pemContent := string(pem.EncodeToMemory(block))
fmt.Printf("%v\n", pemContent) fmt.Printf("%v\n", pemContent)
@ -131,7 +131,7 @@ func ExampleMarshalPrivateKey() {
return return
} }
// ecode to pem // encode der bytes to pem
block := &pem.Block{Bytes: der, Type: "ENCRYPTED PRIVATE KEY"} block := &pem.Block{Bytes: der, Type: "ENCRYPTED PRIVATE KEY"}
pemContent := string(pem.EncodeToMemory(block)) pemContent := string(pem.EncodeToMemory(block))
fmt.Printf("%v\n", pemContent) fmt.Printf("%v\n", pemContent)

View File

@ -400,8 +400,6 @@ func ParseSM9EncryptPrivateKey(der []byte, v ...[]byte) (*sm9.EncryptPrivateKey,
// ConvertPrivateKeyToPKCS8 converts the private key into PKCS#8 format. // ConvertPrivateKeyToPKCS8 converts the private key into PKCS#8 format.
// To encrypt the private key, the password of []byte type should be provided as the second parameter. // To encrypt the private key, the password of []byte type should be provided as the second parameter.
//
// The only supported key types are RSA and ECDSA (*rsa.PrivateKey or *ecdsa.PrivateKey for priv)
func ConvertPrivateKeyToPKCS8(priv interface{}, v ...[]byte) ([]byte, error) { func ConvertPrivateKeyToPKCS8(priv interface{}, v ...[]byte) ([]byte, error) {
var password []byte var password []byte
if len(v) > 0 { if len(v) > 0 {