Commit 748118a8 authored by Dr. Stephen Henson's avatar Dr. Stephen Henson
Browse files

Add new X509 accessors



Reviewed-by: default avatarTim Hudson <tjh@openssl.org>
parent bf24ac9b
Loading
Loading
Loading
Loading
+18 −0
Original line number Diff line number Diff line
@@ -176,3 +176,21 @@ X509_PUBKEY *X509_get_X509_PUBKEY(const X509 *x)
{
    return x->cert_info.key;
}

STACK_OF(X509_EXTENSION) *X509_get0_extensions(const X509 *x)
{
    return x->cert_info.extensions;
}

void X509_get0_uids(ASN1_BIT_STRING **piuid, ASN1_BIT_STRING **psuid, X509 *x)
{
    if (piuid != NULL)
        *piuid = x->cert_info.issuerUID;
    if (psuid != NULL)
        *psuid = x->cert_info.subjectUID;
}

X509_ALGOR *X509_get0_tbs_sigalg(X509 *x)
{
    return &x->cert_info.signature;
}
+19 −0
Original line number Diff line number Diff line
@@ -83,6 +83,11 @@ ASN1_SEQUENCE(X509_CERT_AUX) = {

IMPLEMENT_ASN1_FUNCTIONS(X509_CERT_AUX)

int X509_trusted(const X509 *x)
{
    return x->aux ? 1 : 0;
}

static X509_CERT_AUX *aux_get(X509 *x)
{
    if (x == NULL)
@@ -198,3 +203,17 @@ void X509_reject_clear(X509 *x)
        x->aux->reject = NULL;
    }
}

STACK_OF(ASN1_OBJECT) *X509_get0_trust_objects(X509 *x)
{
    if (x->aux != NULL)
        return x->aux->trust;
    return NULL;
}

STACK_OF(ASN1_OBJECT) *X509_get0_reject_objects(X509 *x)
{
    if (x->aux != NULL)
        return x->aux->reject;
    return NULL;
}
+7 −0
Original line number Diff line number Diff line
@@ -627,6 +627,7 @@ int i2d_re_X509_tbs(X509 *x, unsigned char **pp);
void X509_get0_signature(ASN1_BIT_STRING **psig, X509_ALGOR **palg, X509 *x);
int X509_get_signature_nid(const X509 *x);

int X509_trusted(const X509 *x);
int X509_alias_set1(X509 *x, unsigned char *name, int len);
int X509_keyid_set1(X509 *x, unsigned char *id, int len);
unsigned char *X509_alias_get0(X509 *x, int *len);
@@ -639,6 +640,9 @@ int X509_add1_reject_object(X509 *x, ASN1_OBJECT *obj);
void X509_trust_clear(X509 *x);
void X509_reject_clear(X509 *x);

STACK_OF(ASN1_OBJECT) *X509_get0_trust_objects(X509 *x);
STACK_OF(ASN1_OBJECT) *X509_get0_reject_objects(X509 *x);

DECLARE_ASN1_FUNCTIONS(X509_REVOKED)
DECLARE_ASN1_FUNCTIONS(X509_CRL_INFO)
DECLARE_ASN1_FUNCTIONS(X509_CRL)
@@ -702,6 +706,9 @@ int X509_get_signature_type(const X509 *x);
 * i2d_X509_NAME(X509_get_X509_PUBKEY(x),&buf)
 */
X509_PUBKEY *X509_get_X509_PUBKEY(const X509 *x);
STACK_OF(X509_EXTENSION) *X509_get0_extensions(const X509 *x);
void X509_get0_uids(ASN1_BIT_STRING **piuid, ASN1_BIT_STRING **psuid, X509 *x);
X509_ALGOR *X509_get0_tbs_sigalg(X509 *x);

EVP_PKEY *X509_get_pubkey(X509 *x);
ASN1_BIT_STRING *X509_get0_pubkey_bitstr(const X509 *x);