version 1.17, 2022/03/28 10:56:26 |
version 1.18, 2022/03/28 11:02:49 |
|
|
#define CLCERTS 0x8 |
#define CLCERTS 0x8 |
#define CACERTS 0x10 |
#define CACERTS 0x10 |
|
|
int get_cert_chain(X509 *cert, X509_STORE *store, STACK_OF(X509) **chain); |
static int get_cert_chain(X509 *cert, X509_STORE *store, |
int dump_certs_keys_p12(BIO *out, PKCS12 *p12, char *pass, int passlen, |
STACK_OF(X509) **chain); |
|
static int dump_certs_keys_p12(BIO *out, PKCS12 *p12, char *pass, int passlen, |
int options, char *pempass); |
int options, char *pempass); |
int dump_certs_pkeys_bags(BIO *out, STACK_OF(PKCS12_SAFEBAG) *bags, char *pass, |
static int dump_certs_pkeys_bags(BIO *out, STACK_OF(PKCS12_SAFEBAG) *bags, |
|
char *pass, int passlen, int options, char *pempass); |
|
static int dump_certs_pkeys_bag(BIO *out, PKCS12_SAFEBAG *bags, char *pass, |
int passlen, int options, char *pempass); |
int passlen, int options, char *pempass); |
int dump_certs_pkeys_bag(BIO *out, PKCS12_SAFEBAG *bags, char *pass, |
static int print_attribs(BIO *out, const STACK_OF(X509_ATTRIBUTE) *attrlst, |
int passlen, int options, char *pempass); |
|
int print_attribs(BIO *out, const STACK_OF(X509_ATTRIBUTE) *attrlst, |
|
const char *name); |
const char *name); |
void hex_prin(BIO *out, unsigned char *buf, int len); |
static void hex_prin(BIO *out, unsigned char *buf, int len); |
int alg_print(BIO *x, const X509_ALGOR *alg); |
static int alg_print(BIO *x, const X509_ALGOR *alg); |
static int set_pbe(BIO *err, int *ppbe, const char *str); |
static int set_pbe(BIO *err, int *ppbe, const char *str); |
|
|
static struct { |
static struct { |
|
|
return (ret); |
return (ret); |
} |
} |
|
|
int |
static int |
dump_certs_keys_p12(BIO *out, PKCS12 *p12, char *pass, |
dump_certs_keys_p12(BIO *out, PKCS12 *p12, char *pass, int passlen, int options, |
int passlen, int options, char *pempass) |
char *pempass) |
{ |
{ |
STACK_OF(PKCS7) *asafes = NULL; |
STACK_OF(PKCS7) *asafes = NULL; |
STACK_OF(PKCS12_SAFEBAG) *bags; |
STACK_OF(PKCS12_SAFEBAG) *bags; |
|
|
return ret; |
return ret; |
} |
} |
|
|
int |
static int |
dump_certs_pkeys_bags(BIO *out, STACK_OF(PKCS12_SAFEBAG) *bags, |
dump_certs_pkeys_bags(BIO *out, STACK_OF(PKCS12_SAFEBAG) *bags, char *pass, |
char *pass, int passlen, int options, char *pempass) |
int passlen, int options, char *pempass) |
{ |
{ |
int i; |
int i; |
|
|
for (i = 0; i < sk_PKCS12_SAFEBAG_num(bags); i++) { |
for (i = 0; i < sk_PKCS12_SAFEBAG_num(bags); i++) { |
if (!dump_certs_pkeys_bag(out, |
if (!dump_certs_pkeys_bag(out, |
sk_PKCS12_SAFEBAG_value(bags, i), |
sk_PKCS12_SAFEBAG_value(bags, i), |
|
|
return 1; |
return 1; |
} |
} |
|
|
int |
static int |
dump_certs_pkeys_bag(BIO *out, PKCS12_SAFEBAG *bag, char *pass, |
dump_certs_pkeys_bag(BIO *out, PKCS12_SAFEBAG *bag, char *pass, int passlen, |
int passlen, int options, char *pempass) |
int options, char *pempass) |
{ |
{ |
EVP_PKEY *pkey; |
EVP_PKEY *pkey; |
PKCS8_PRIV_KEY_INFO *p8; |
PKCS8_PRIV_KEY_INFO *p8; |
|
|
} |
} |
|
|
/* Given a single certificate return a verified chain or NULL if error */ |
/* Given a single certificate return a verified chain or NULL if error */ |
int |
static int |
get_cert_chain(X509 *cert, X509_STORE *store, STACK_OF(X509) **out_chain) |
get_cert_chain(X509 *cert, X509_STORE *store, STACK_OF(X509) **out_chain) |
{ |
{ |
X509_STORE_CTX *store_ctx = NULL; |
X509_STORE_CTX *store_ctx = NULL; |
|
|
return ret; |
return ret; |
} |
} |
|
|
int |
static int |
alg_print(BIO *x, const X509_ALGOR *alg) |
alg_print(BIO *x, const X509_ALGOR *alg) |
{ |
{ |
PBEPARAM *pbe; |
PBEPARAM *pbe; |
const unsigned char *p; |
const unsigned char *p; |
|
|
p = alg->parameter->value.sequence->data; |
p = alg->parameter->value.sequence->data; |
pbe = d2i_PBEPARAM(NULL, &p, alg->parameter->value.sequence->length); |
pbe = d2i_PBEPARAM(NULL, &p, alg->parameter->value.sequence->length); |
if (!pbe) |
if (!pbe) |
|
|
} |
} |
|
|
/* Generalised attribute print: handle PKCS#8 and bag attributes */ |
/* Generalised attribute print: handle PKCS#8 and bag attributes */ |
void |
static void |
print_attribute(BIO *out, const ASN1_TYPE *av) |
print_attribute(BIO *out, const ASN1_TYPE *av) |
{ |
{ |
char *value; |
char *value; |
|
|
} |
} |
} |
} |
|
|
int |
static int |
print_attribs(BIO *out, const STACK_OF(X509_ATTRIBUTE) *attrlst, const char *name) |
print_attribs(BIO *out, const STACK_OF(X509_ATTRIBUTE) *attrlst, |
|
const char *name) |
{ |
{ |
X509_ATTRIBUTE *attr; |
X509_ATTRIBUTE *attr; |
ASN1_TYPE *av; |
ASN1_TYPE *av; |
int i, j, attr_nid; |
int i, j, attr_nid; |
|
|
if (!attrlst) { |
if (!attrlst) { |
BIO_printf(out, "%s: <No Attributes>\n", name); |
BIO_printf(out, "%s: <No Attributes>\n", name); |
return 1; |
return 1; |
|
|
return 1; |
return 1; |
} |
} |
|
|
void |
static void |
hex_prin(BIO *out, unsigned char *buf, int len) |
hex_prin(BIO *out, unsigned char *buf, int len) |
{ |
{ |
int i; |
int i; |
|
|
for (i = 0; i < len; i++) |
for (i = 0; i < len; i++) |
BIO_printf(out, "%02X ", buf[i]); |
BIO_printf(out, "%02X ", buf[i]); |
} |
} |