<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>OpenSSL has the higher-level <code>EVP_PKEY_*</code> functions which work abstracts the public key cryptography algorithms.  However, sometimes a <code>EVP_PKEY*</code> only has a public key.  How could I check if a given <code>EVP_PKEY*</code> contains a private key?  I could use <code>EVP_PKEY_decrypt_init</code> and see if it returns an error, but that seems to be quite heavy-handed for what seems to be a simple check.  The other option is to go through the EVP_PKEY_get0_* functions and investigate the underlying mechanism directly (e.g. <font style="" face="Courier New,sans-serif"><u>EVP_PKEY_get0_RSA</u></font> and checking the<font style="" face="Courier New,sans-serif"> RSA*</font>'s private exponent is <font style="" face="Courier New,sans-serif">NULL</font>), but that is also clumsy as I'll have to write code for every possible algorithm.<br><br>Thanks<br>Stephen<br>                                      </div></body>
</html>