private key - pkcs11-tool doesn't recognise RSA key -


pkcs11-tool fails import rsa private key, though it's parsed correctly openssl. fails with:

error: openssl error during rsa private key parsing aborting. 

the key in dsa format , i'm trying import using:

pkcs11-tool --module ... -y privkey --slot ... -w some/path.der -l --id ... 

the rsa private key may encoded in der in 2 ways. either has heading defining key is, or may list of fields (as defined pkcs#1 rsaprivatekey sequence). openssl command handles both forms transparently in cases, d2i_rsaprivatekey not. expects rsaprivatekey sequence directly available.

the required file can generated either der or pem format file. it's done using openssl rsa -in ... -outform der -out ...

the wrapped format looks in openssl asn1parse output:

 0:d=0  hl=4 l=2370 cons: sequence            4:d=1  hl=2 l=   1 prim: integer           :00  7:d=1  hl=2 l=  13 cons: sequence            9:d=2  hl=2 l=   9 prim: object            :rsaencryption 20:d=2  hl=2 l=   0 prim: null               22:d=1  hl=4 l=2348 prim: octet string      [hex dump]..... 

the unwrapped 1 looks this:

  0:d=0  hl=4 l=2344 cons: sequence             4:d=1  hl=2 l=   1 prim: integer           :00   7:d=1  hl=4 l= 513 prim: integer           :... 524:d=1  hl=2 l=   3 prim: integer           :010001 529:d=1  hl=4 l= 513 prim: integer           :... 

Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -