diff options
author | Damian Hobson-Garcia <dhobsong@igel.co.jp> | 2023-06-30 17:12:38 -0400 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2024-04-24 14:05:35 +0100 |
commit | 62960b8710a39d58fe386a51dccbd35bd973220f (patch) | |
tree | bc6dfdf65b953011a67b10dd096d6cdd45fc3691 /crypto | |
parent | 6b167313f422b8744c1f4edc8688f7e6923a3a73 (diff) | |
download | openssl-62960b8710a39d58fe386a51dccbd35bd973220f.tar.gz |
x509_acert: Add, remove and get attribute certificate attributes
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/15857)
Diffstat (limited to 'crypto')
-rw-r--r-- | crypto/x509/x509_acert.c | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/crypto/x509/x509_acert.c b/crypto/x509/x509_acert.c index d6b78bfc7c..7e0d5f139b 100644 --- a/crypto/x509/x509_acert.c +++ b/crypto/x509/x509_acert.c @@ -183,3 +183,62 @@ const ASN1_GENERALIZEDTIME *X509_ACERT_get0_notAfter(const X509_ACERT *x) { return x->acinfo->validityPeriod.notAfter; } + +/* Attribute management functions */ + +int X509_ACERT_get_attr_count(const X509_ACERT *x) +{ + return X509at_get_attr_count(x->acinfo->attributes); +} + +int X509_ACERT_get_attr_by_NID(const X509_ACERT *x, int nid, int lastpos) +{ + return X509at_get_attr_by_NID(x->acinfo->attributes, nid, lastpos); +} + +int X509_ACERT_get_attr_by_OBJ(const X509_ACERT *x, const ASN1_OBJECT *obj, + int lastpos) +{ + return X509at_get_attr_by_OBJ(x->acinfo->attributes, obj, lastpos); +} + +X509_ATTRIBUTE *X509_ACERT_get_attr(const X509_ACERT *x, int loc) +{ + return X509at_get_attr(x->acinfo->attributes, loc); +} + +X509_ATTRIBUTE *X509_ACERT_delete_attr(X509_ACERT *x, int loc) +{ + return X509at_delete_attr(x->acinfo->attributes, loc); +} + +int X509_ACERT_add1_attr(X509_ACERT *x, X509_ATTRIBUTE *attr) +{ + STACK_OF(X509_ATTRIBUTE) **attrs = &x->acinfo->attributes; + + return X509at_add1_attr(attrs, attr) != NULL; +} + +int X509_ACERT_add1_attr_by_OBJ(X509_ACERT *x, const ASN1_OBJECT *obj, + int type, const void *bytes, int len) +{ + STACK_OF(X509_ATTRIBUTE) **attrs = &x->acinfo->attributes; + + return X509at_add1_attr_by_OBJ(attrs, obj, type, bytes, len) != NULL; +} + +int X509_ACERT_add1_attr_by_NID(X509_ACERT *x, int nid, int type, + const void *bytes, int len) +{ + STACK_OF(X509_ATTRIBUTE) **attrs = &x->acinfo->attributes; + + return X509at_add1_attr_by_NID(attrs, nid, type, bytes, len) != NULL; +} + +int X509_ACERT_add1_attr_by_txt(X509_ACERT *x, const char *attrname, int type, + const unsigned char *bytes, int len) +{ + STACK_OF(X509_ATTRIBUTE) **attrs = &x->acinfo->attributes; + + return X509at_add1_attr_by_txt(attrs, attrname, type, bytes, len) != NULL; +} |