Hi,
Please take a look at
<https://stackoverflow.com/questions/48958304/pkcs1-and-pkcs8-format-for-rsa-private-key>.
If this is your code to parse your private key:
f, err := os.Open(file)
> if err != nil {
> return nil, err
> }
> buf, err := ioutil.ReadAll(f)
> if err != nil {
> return nil, err
> }
> p, _ := pem.Decode(buf)
> if p == nil {
> return nil, errors.New("no pem block found")
> }
> return x509.ParsePKCS1PrivateKey(p.
> Bytes)
>
I tried your commands. key.pem seems like a pkcs8 encoded key, and
rsakey.pem seems like a pkcs1 key. That
may be the reason why you got an error when you try to parse a pkcs8
private key with ParsePKCS1PrivateKey.
James
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/golang-nuts/c5a670a4-db03-4241-898d-5e3a679ac10f%40googlegroups.com.