I've generated a PKCS#1 RSA keypair using a program I wrote. I've output public key as DER encoding of the RSAPublicKey ASN.1 SEQUENCE data structure.
However, when I try to use it in the OpenSSL pkeyutl and rsautl commands, OpenSSL says
unable to load Public Key
I've tried both DER and PEM formats.
Is there additional encoding and/or data structure that I must apply for it to be usable in OpenSSL?
Here's my command line:
openssl pkeyutl -encrypt -pubin -in 128-bit.dat -inkey rsa-1440-pub.pem
openssl rsautl -in 128-bit.dat -encrypt -keyform PEM -pubin -inkey rsa-1440-pub.pem
The public key data structure in PEM format
-----BEGIN RSA PUBLIC KEY-----
MIG9AoG1AMuWjPN12DBObfQCxRVKLnP51BbFyEZeSJrmU3bPnwMv8S7hz0dGcSCA
Wa/EZWbNx8gLiWkHlcXeHC+8UO4rtOuaE9PhOXM819C8Y84Y8SddQ4RUMmj1y8ph
pBwExHDiSuKmbvFQLcB7uG10ZUFA9Q5bq/o6bNGsbTas/oB8TzSox5w66maDeyMc
cQFRko2/4AduuStYpnvi8eXa6kaAVDQ43NPCcdep0p78SKjYJNKu8WyZvwIDAQAB
-----END RSA PUBLIC KEY-----