X509_ALGOR_DUP(3)

NAME
X509_ALGOR_new, X509_ALGOR_free, X509_ALGOR_dup, X509_ALGOR_set0, X509_ALGOR_get0, X509_ALGOR_set_md, X509_ALGOR_cmp - create, change, and inspect algorithm identifiers

SYNOPSIS
#include <openssl/x509.h>
X509_ALGOR *
X509_ALGOR_new(void);
void
X509_ALGOR_free(X509_ALGOR *alg);
X509_ALGOR *
X509_ALGOR_dup(X509_ALGOR *alg);
int
X509_ALGOR_set0(X509_ALGOR *alg, ASN1_OBJECT *aobj, int ptype, void *pval);
void
X509_ALGOR_get0(ASN1_OBJECT **paobj, int *pptype, const void **ppval, const X509_ALGOR *alg);
void
X509_ALGOR_set_md(X509_ALGOR *alg, const EVP_MD *md);
int
X509_ALGOR_cmp(const X509_ALGOR *a, const X509_ALGOR *b);

DESCRIPTION
X509_ALGOR_new() allocates and initializes an empty X509_ALGOR object, representing an ASN.1 AlgorithmIdentifier structure defined in RFC 5280 section 4.1.1.2. Such objects can specify a cryptographic algorithm together with algorithm-specific parameters. They are used by many other objects, for example certificates, certificate revocation lists, and certificate requests.

X509_ALGOR_free() frees alg.

X509_ALGOR_dup() copies alg by calling i2d_X509_ALGOR(3) and d2i_X509_ALGOR(3).

X509_ALGOR_set0() sets the algorithm OID of alg to aobj and the associated parameter type to ptype with value pval. If ptype is V_ASN1_UNDEF the parameter is omitted, otherwise ptype and pval have the same meaning as the type and value parameters to ASN1_TYPE_set(3). All the supplied parameters are used internally so must NOT be freed after this call.

X509_ALGOR_get0() is the inverse of X509_ALGOR_set0(): it returns the algorithm OID in *paobj and the associated parameter in *pptype and *ppval from alg.

X509_ALGOR_set_md() sets alg to appropriate values for the message digest md.

X509_ALGOR_cmp() compares a and b.

RETURN VALUES
X509_ALGOR_new() and X509_ALGOR_dup() return a new X509_ALGOR object or NULL if an error occurs.

X509_ALGOR_set0() returns 1 for success or 0 for failure.

X509_ALGOR_cmp() returns 0 if a and b have identical encodings or non-zero otherwise.

SEE ALSO
ASN1_TYPE_set(3), d2i_X509_ALGOR(3), X509_get0_signature(3), X509_PUBKEY_get0_param(3)

STANDARDS
RFC 5280: Internet X.509 Public Key Infrastructure Certificate and Certificate Revocation List (CRL) Profile

HISTORY
X509_ALGOR_new() and X509_ALGOR_free() appeared before SSLeay 0.8 and have been available since OpenBSD 2.4.

X509_ALGOR_dup() first appeared in SSLeay 0.9.1 and has been avialable since OpenBSD 2.6.

X509_ALGOR_set0() and X509_ALGOR_get0() first appeared in OpenSSL 0.9.8h and have been available since OpenBSD 4.5.

X509_ALGOR_cmp() first appeared in OpenSSL 0.9.8zd and 1.0.0p and has been available since OpenBSD 4.9.

X509_ALGOR_set_md() first appeared in OpenSSL 1.0.1 and has been available since OpenBSD 5.3.