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
+14.1k Golang : Convert spaces to tabs and back to spaces example
+19.7k Golang : How to Set or Add Header http.ResponseWriter?
+14k Golang : Get user input until a command or receive a word to stop
+14.3k Golang : convert rune to unicode hexadecimal value and back to rune character
+7.3k Golang : How to solve "too many .rsrc sections" error?
+5.3k Linux : How to set root password in Linux Mint
+6.8k Golang : Map within a map example
+6.8k Golang : Calculate diameter, circumference, area, sphere surface and volume
+8.5k How to show different content from website server when AdBlock is detected?
+4.9k Javascript : Detect when console is activated and do something about it
+10.9k Golang : Create matrix with Gonum Matrix package example
+21.2k Golang : Underscore or snake_case to camel case example