Plumenator
Plumenator

Reputation: 1682

In OpenSSL, given a certificate, how can I get a string representation of the signature algorithm?

X509_get_signature_type() returns an int. I need to convert this to a string.

Upvotes: 1

Views: 1030

Answers (2)

Parshin Dmitry
Parshin Dmitry

Reputation: 71

Signature algorithm string name I receive by this way:

X509 *certificate;
char alg[256];
...
OBJ_obj2txt(alg, sizeof(alg), certificate->sig_alg->algorithm, 0);

Upvotes: 3

Plumenator
Plumenator

Reputation: 1682

OBJ_nid2ln() perhaps? There's also OBJ_nid2sn() for a few signature types which have short names.

Upvotes: 1

Related Questions