RE: Unable to load RSA public key for signature verification

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

 



> From: openssl-users <openssl-users-bounces@xxxxxxxxxxx> On Behalf Of Juan Pablo Garibotti Arias
> Sent: Thursday, 13 April, 2023 10:42

> RsaPtr PublicKey(FILE* keyFile) {
>  char pass[] = "";
 >  return RsaPtr{PEM_read_RSAPublicKey(keyFile, nullptr, nullptr, pass)};
> }

> 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-----".

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?

Try PEM_read_RSA_PUBKEY instead.

-- 
Michael Wojcik





[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