mirror of
https://github.com/emmansun/gmsm.git
synced 2025-04-28 05:06:18 +08:00
pkcs8: fix comments
This commit is contained in:
parent
ff2b695500
commit
5b806c85fe
@ -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)
|
||||||
|
@ -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 {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user