diff options
author | Dr. Stephen Henson <steve@openssl.org> | 2008-03-26 13:10:21 +0000 |
---|---|---|
committer | Dr. Stephen Henson <steve@openssl.org> | 2008-03-26 13:10:21 +0000 |
commit | f4cc56f494b3f42642ea3b322e57737da80f889a (patch) | |
tree | 8996c88177586ba01f0e7c6b3a979e88110c81f3 /crypto/x509v3/v3_genn.c | |
parent | be86c7fc8784f785b20bad50f71327a57068a565 (diff) | |
download | openssl-f4cc56f494b3f42642ea3b322e57737da80f889a.zip openssl-f4cc56f494b3f42642ea3b322e57737da80f889a.tar.gz openssl-f4cc56f494b3f42642ea3b322e57737da80f889a.tar.bz2 |
Signed Receipt Request utility functions and option on CMS utility to
print out receipt requests.
Diffstat (limited to 'crypto/x509v3/v3_genn.c')
-rw-r--r-- | crypto/x509v3/v3_genn.c | 92 |
1 files changed, 92 insertions, 0 deletions
diff --git a/crypto/x509v3/v3_genn.c b/crypto/x509v3/v3_genn.c index 363f2d3..2a80586 100644 --- a/crypto/x509v3/v3_genn.c +++ b/crypto/x509v3/v3_genn.c @@ -158,3 +158,95 @@ int OTHERNAME_cmp(OTHERNAME *a, OTHERNAME *b) result = ASN1_TYPE_cmp(a->value, b->value); return result; } + +void GENERAL_NAME_set0_value(GENERAL_NAME *a, int type, void *value) + { + switch(type) + { + case GEN_X400: + case GEN_EDIPARTY: + a->d.other = value; + break; + + case GEN_OTHERNAME: + a->d.otherName = value; + break; + + case GEN_EMAIL: + case GEN_DNS: + case GEN_URI: + a->d.ia5 = value; + break; + + case GEN_DIRNAME: + a->d.dirn = value; + break; + + case GEN_IPADD: + a->d.ip = value; + break; + + case GEN_RID: + a->d.rid = value; + break; + } + a->type = type; + } + +void *GENERAL_NAME_get0_value(GENERAL_NAME *a, int *ptype) + { + if (ptype) + *ptype = a->type; + switch(a->type) + { + case GEN_X400: + case GEN_EDIPARTY: + return a->d.other; + + case GEN_OTHERNAME: + return a->d.otherName; + + case GEN_EMAIL: + case GEN_DNS: + case GEN_URI: + return a->d.ia5; + + case GEN_DIRNAME: + return a->d.dirn; + + case GEN_IPADD: + return a->d.ip; + + case GEN_RID: + return a->d.rid; + + default: + return NULL; + } + } + +int GENERAL_NAME_set0_othername(GENERAL_NAME *gen, + ASN1_OBJECT *oid, ASN1_TYPE *value) + { + OTHERNAME *oth; + oth = OTHERNAME_new(); + if (!oth) + return 0; + oth->type_id = oid; + oth->value = value; + GENERAL_NAME_set0_value(gen, GEN_OTHERNAME, oth); + return 1; + } + +int GENERAL_NAME_get0_otherName(GENERAL_NAME *gen, + ASN1_OBJECT **poid, ASN1_TYPE **pvalue) + { + if (gen->type != GEN_OTHERNAME) + return 0; + if (poid) + *poid = gen->d.otherName->type_id; + if (pvalue) + *pvalue = gen->d.otherName->value; + return 1; + } + |