Golang crypto/x509.ParsePKCS8PrivateKey() function example
package crypto/x509
ParsePKCS8PrivateKey parses an unencrypted, PKCS#8 private key. See http://www.rsa.com/rsalabs/node.asp?id=2130 and RFC5208.
Golang crypto/x509.ParsePKCS8PrivateKey() function usage example
parsedKey, err := x509.ParsePKCS8PrivateKey(block.Bytes)
if err != nil {
parsedKey, err = x509.ParsePKCS1PrivateKey(block.Bytes)
if err != nil {
return err
}
}
**NOTE : ParsePKCS8 is normally used to deal with unencrypted block first and if fail, then fall back to ParsePKCS1
Reference :
http://golang.org/pkg/crypto/x509/#ParsePKCS8PrivateKey
https://www.socketloop.com/references/golang-crypto-x509-parsepkcs1privatekey-function-example
Advertisement
Something interesting
Tutorials
+16.1k Golang : How to check if input from os.Args is integer?
+9k Golang : Get SPF and DMARC from email headers to fight spam
+13.2k CodeIgniter : "Fatal error: Cannot use object of type stdClass as array" message
+6.9k Golang : Normalize email to prevent multiple signups example
+7.9k Swift : Convert (cast) String to Float
+24k Golang : Find biggest/largest number in array
+16k Golang : How to reverse elements order in map ?
+9.2k Golang : How to find out similarity between two strings with Jaro-Winkler Distance?
+11.1k Golang : Web routing/multiplex example
+6.1k Golang : How to write backslash in string?
+10.4k Golang : Generate random integer or float number
+13.1k Golang : How to get a user home directory path?