Private key always result to error: sequence truncated

I am using the document’s command to generate my private and public key

 openssl genrsa -aes256 -out private.pem 2048
 openssl rsa -in private.pem --outform PEM -pubout -out public.pem

because my OpenSSL version is:

OpenSSL 3.0.2 15 Mar 2022 (Library: OpenSSL 3.0.2 15 Mar 2022)

It will always generate pkcs8 format of private key:

-----BEGIN ENCRYPTED PRIVATE KEY-----
MII...
-----END ENCRYPTED PRIVATE KEY-----

So I have to convert it to pkcs1 using this command:

openssl pkey -in private.pem -traditional > private_pkcs1.pem
-----BEGIN RSA PRIVATE KEY-----
MII...
-----END RSA PRIVATE KEY-----

But using this key always result to this error when I execute:

duplicacy_linux_x64_3.1.0 -d check -key /path/to/my/private_pkcs1.pem -files

error:

asn1: syntax error: sequence truncated

What’s the right command for generate the key for OpenSSL 3.x? Thanks for any advice.

This worked for me:

openssl genrsa -aes256 -out private.pem -traditional 2048

Thank you very much, that did the trick.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.