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
+5.9k AWS S3 : Prevent Hotlinking policy
+35.9k Golang : Integer is between a range
+17.2k Golang : When to use init() function?
+36.5k Golang : Validate IP address
+25.7k Golang : missing Mercurial command
+10.6k Android Studio : Simple input textbox and intercept key example
+10.8k Android Studio : Checkbox for user to select options example
+6.3k Golang : Detect face in uploaded photo like GPlus
+39.2k Golang : How to read CSV file
+13.6k Android Studio : Password input and reveal password example
+8.2k Android Studio : Rating bar example
+9.7k Golang : Format strings to SEO friendly URL example