Skip to content

Bug, OpenSSL: EVP_PKEY_get_id #178

@RoLex

Description

@RoLex

There is a known OpenSSL bug that affects included libraries, see more for information: openssl/openssl#20497

EVP_PKEY_get_id(LPubKey) might return -1, which OBJ_nid2sn() can not handle:

We need to replace following code in Net.OpenSSL.pas > TSSLTools.GetCertInfo:

    ACertInfo.PubKeyID := EVP_PKEY_get_id(LPubKey);
    ACertInfo.PubKeyType := UTF8ToString(OBJ_nid2sn(ACertInfo.PubKeyID));

With this code:

    ACertInfo.PubKeyID := EVP_PKEY_get_id(LPubKey);
    ACertInfo.PubKeyType := UTF8ToString(EVP_PKEY_get0_type_name(LPubKey));

Also same needs to be done in Net.OpenSSL.pas > TSSLTools.GetSslInfo.

EVP_PKEY_get0_type_name declaration is following:

EVP_PKEY_get0_type_name: function(key: PEVP_PKEY): PAnsiChar; cdecl;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions