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
+12.7k Golang : Send data to /dev/null a.k.a blackhole with ioutil.Discard
+9.4k Golang : Qt Yes No and Quit message box example
+13.6k Android Studio : Password input and reveal password example
+11.6k Golang : Convert(cast) float to int
+46.4k Golang : Encode image to base64 example
+13k Golang : Get terminal width and height example
+9.3k Golang : How to get garbage collection data?
+11.9k Golang : Setup API server or gateway with Caddy and http.ListenAndServe() function example
+14.4k Android Studio : Use image as AlertDialog title with custom layout example
+7.7k Golang : Test if an input is an Armstrong number example
+19.1k Golang : When to use public and private identifier(variable) and how to make the identifier public or private?
+3.6k Java : Get FX sentiment from website example