diff options
author | Dr. Stephen Henson <steve@openssl.org> | 2015-09-27 00:33:59 +0100 |
---|---|---|
committer | Dr. Stephen Henson <steve@openssl.org> | 2016-02-08 18:43:48 +0000 |
commit | 1387a2ecb8f4eecb407952f56eafcce10ab68cb0 (patch) | |
tree | 5c8227929e3e4a1621b8aa1e814f7bdb8b6cfbeb /crypto | |
parent | 03922a635b363643cfaa28e282a090e593530d2a (diff) |
pkcs12 accessors
Reviewed-by: Rich Salz <rsalz@openssl.org>
Diffstat (limited to 'crypto')
-rw-r--r-- | crypto/pkcs12/p12_attr.c | 5 | ||||
-rw-r--r-- | crypto/pkcs12/p12_utl.c | 37 |
2 files changed, 42 insertions, 0 deletions
diff --git a/crypto/pkcs12/p12_attr.c b/crypto/pkcs12/p12_attr.c index 5746a7b502..454db9e46e 100644 --- a/crypto/pkcs12/p12_attr.c +++ b/crypto/pkcs12/p12_attr.c @@ -137,3 +137,8 @@ char *PKCS12_get_friendlyname(PKCS12_SAFEBAG *bag) return OPENSSL_uni2asc(atype->value.bmpstring->data, atype->value.bmpstring->length); } + +STACK_OF(X509_ATTRIBUTE) *PKCS12_SAFEBAG_get0_attrs(PKCS12_SAFEBAG *bag) +{ + return bag->attrib; +} diff --git a/crypto/pkcs12/p12_utl.c b/crypto/pkcs12/p12_utl.c index db4c139101..eabfb8e703 100644 --- a/crypto/pkcs12/p12_utl.c +++ b/crypto/pkcs12/p12_utl.c @@ -177,6 +177,31 @@ int PKCS12_mac_present(PKCS12 *p12) return p12->mac ? 1 : 0; } +void PKCS12_get0_mac(ASN1_OCTET_STRING **pmac, X509_ALGOR **pmacalg, + ASN1_OCTET_STRING **psalt, ASN1_INTEGER **piter, + PKCS12 *p12) +{ + if (p12->mac) { + if (pmac) + *pmac = p12->mac->dinfo->digest; + if (pmacalg) + *pmacalg = p12->mac->dinfo->algor; + if (psalt) + *psalt = p12->mac->salt; + if (piter) + *piter = p12->mac->iter; + } else { + if (pmac) + *pmac = NULL; + if (pmacalg) + *pmacalg = NULL; + if (psalt) + *psalt = NULL; + if (piter) + *piter = NULL; + } +} + int PKCS12_bag_type(PKCS12_SAFEBAG *bag) { return OBJ_obj2nid(bag->type); @@ -196,9 +221,21 @@ PKCS8_PRIV_KEY_INFO *PKCS12_SAFEBAG_get0_p8inf(PKCS12_SAFEBAG *bag) return bag->value.keybag; } +X509_SIG *PKCS12_SAFEBAG_get0_pkcs8(PKCS12_SAFEBAG *bag) +{ + if (OBJ_obj2nid(bag->type) != NID_pkcs8ShroudedKeyBag) + return NULL; + return bag->value.shkeybag; +} + STACK_OF(PKCS12_SAFEBAG) *PKCS12_SAFEBAG_get0_safes(PKCS12_SAFEBAG *bag) { if (OBJ_obj2nid(bag->type) != NID_safeContentsBag) return NULL; return bag->value.safes; } + +ASN1_OBJECT *PKCS12_SAFEBAG_get0_type(PKCS12_SAFEBAG *bag) +{ + return bag->type; +} |