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
+11.3k Golang : How to use if, eq and print properly in html template
+16.8k Golang : Read integer from file into array
+8.7k Golang : Find duplicate files with filepath.Walk
+9.1k Golang : Handle sub domain with Gin
+9.7k Golang : Load ASN1 encoded DSA public key PEM file example
+32.4k Golang : Math pow(the power of x^y) example
+13.8k Golang : Convert spaces to tabs and back to spaces example
+18.6k Golang : Get download file size
+13.9k Golang : Get current time
+21.1k Golang : Convert(cast) string to rune and back to string example
+6.7k Golang : Experimental emojis or emoticons icons programming language
+10.5k Fix ERROR 1045 (28000): Access denied for user 'root'@'ip-address' (using password: YES)