diff options
author | Dr. Stephen Henson <steve@openssl.org> | 2015-09-22 23:40:43 +0100 |
---|---|---|
committer | Dr. Stephen Henson <steve@openssl.org> | 2015-11-14 00:13:08 +0000 |
commit | 748118a838bcb7b920c5e0bf389773544becc71b (patch) | |
tree | 2c7f58b281dd0239cbe127d90af33933a5cd66db | |
parent | bf24ac9b54170c9060079c3f7a040162361c8e5e (diff) | |
download | openssl-748118a838bcb7b920c5e0bf389773544becc71b.tar.gz |
Add new X509 accessors
Reviewed-by: Tim Hudson <tjh@openssl.org>
-rw-r--r-- | crypto/x509/x509_set.c | 18 | ||||
-rw-r--r-- | crypto/x509/x_x509a.c | 19 | ||||
-rw-r--r-- | include/openssl/x509.h | 7 |
3 files changed, 44 insertions, 0 deletions
diff --git a/crypto/x509/x509_set.c b/crypto/x509/x509_set.c index 38ec0dbc54..dbd9057f2a 100644 --- a/crypto/x509/x509_set.c +++ b/crypto/x509/x509_set.c @@ -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; +} diff --git a/crypto/x509/x_x509a.c b/crypto/x509/x_x509a.c index 76608b669f..f79e5e773e 100644 --- a/crypto/x509/x_x509a.c +++ b/crypto/x509/x_x509a.c @@ -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; +} diff --git a/include/openssl/x509.h b/include/openssl/x509.h index 32bec25d69..d9ad95f6d0 100644 --- a/include/openssl/x509.h +++ b/include/openssl/x509.h @@ -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); |