On 03/12/2019 17:23, Angus Robertson - Magenta Systems Ltd wrote: >> What does EVP_PKEY_base_id() return for your pkey? How did you >> create it? > > base_id is 912, EVP_PKEY_RSA_PSS=NID_rsassaPss. Sorry. My mistake. I actually meant what does EVP_PKEY_id() return. That just does this: int EVP_PKEY_id(const EVP_PKEY *pkey) { return pkey->type; } So if you get EVP_PKEY_RSA_PSS returned from that I don't currently understand how this: RSA *EVP_PKEY_get0_RSA(const EVP_PKEY *pkey) { if (pkey->type != EVP_PKEY_RSA && pkey->type != EVP_PKEY_RSA_PSS) { EVPerr(EVP_F_EVP_PKEY_GET0_RSA, EVP_R_EXPECTING_AN_RSA_KEY); return NULL; } return pkey->pkey.rsa; } Can return the error you saw!! Something strange going on... Matt > > But my code is Pascal so not using your header files directly, seems > okay though. > > It was created with OpenSSL APIs and EVP_PKEY_print_private reports: > RSA-PSS Private-Key: (2048 bit, 2 primes) > > Angus > > >