Re: Unable to load RSA public key for signature verification

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Apr 13, 2023 at 05:28:34PM +0000, Michael Wojcik via openssl-users wrote:

> > int main() {
> >  constexpr auto pubKey = "-----BEGIN PUBLIC KEY-----\n"
> 
> A quick look at the source shows PEM_read_RSAPublicKey wants
> PEM_STRING_RSA_PUBLIC, which is "RSA PUBLIC KEY". So that function
> only supports PEM objects with the start line
> "-----BEGIN RSA PUBLIC KEY-----".

Yes, that's the issue.

> OpenSSL supports multiple PEM formats for RSA keys. I'm trying to
> recall the details -- I think there's an old OpenSSL format and a
> later standard format, maybe?

There's an RSA algorithm-specific legacy format an an algorithm-neutral
preferred format (X.509 SPKI).

> Try PEM_read_RSA_PUBKEY instead.

No, just use PEM_read_PUBKEY(), and use algorithm-neutral APIs that
will work equally well with RSA, ECDSA, Ed25519, ...

-- 
    Viktor.



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux