本文整理汇总了C++中der_heim_oid_cmp函数的典型用法代码示例。如果您正苦于以下问题:C++ der_heim_oid_cmp函数的具体用法?C++ der_heim_oid_cmp怎么用?C++ der_heim_oid_cmp使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了der_heim_oid_cmp函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: heim_oid2ecnid
static int
heim_oid2ecnid(heim_oid *oid)
{
/*
* Now map to openssl OID fun
*/
if (der_heim_oid_cmp(oid, ASN1_OID_ID_EC_GROUP_SECP256R1) == 0)
return NID_X9_62_prime256v1;
#ifdef NID_secp521r1
else if (der_heim_oid_cmp(oid, ASN1_OID_ID_EC_GROUP_SECP521R1) == 0)
return NID_secp521r1;
#endif
#ifdef NID_secp384r1
else if (der_heim_oid_cmp(oid, ASN1_OID_ID_EC_GROUP_SECP384R1) == 0)
return NID_secp384r1;
#endif
#ifdef NID_secp160r1
else if (der_heim_oid_cmp(oid, ASN1_OID_ID_EC_GROUP_SECP160R1) == 0)
return NID_secp160r1;
#endif
#ifdef NID_secp160r2
else if (der_heim_oid_cmp(oid, ASN1_OID_ID_EC_GROUP_SECP160R2) == 0)
return NID_secp160r2;
#endif
return NID_undef;
}
开发者ID:heimdal,项目名称:heimdal,代码行数:28,代码来源:crypto-ec.c
示例2: encryptedData_parser
static int
encryptedData_parser(hx509_context context,
struct hx509_collector *c,
const void *data, size_t length,
const PKCS12_Attributes *attrs)
{
heim_octet_string content;
heim_oid contentType;
int ret;
memset(&contentType, 0, sizeof(contentType));
ret = hx509_cms_decrypt_encrypted(context,
_hx509_collector_get_lock(c),
data, length,
&contentType,
&content);
if (ret)
return ret;
if (der_heim_oid_cmp(&contentType, &asn1_oid_id_pkcs7_data) == 0)
ret = parse_safe_content(context, c, content.data, content.length);
der_free_octet_string(&content);
der_free_oid(&contentType);
return ret;
}
开发者ID:tombibsd,项目名称:netbsd-src,代码行数:27,代码来源:ks_p12.c
示例3: test_heim_oid_format_same
static int
test_heim_oid_format_same(const char *str, const heim_oid *oid)
{
int ret;
char *p;
heim_oid o2;
ret = der_print_heim_oid(oid, ' ', &p);
if (ret) {
printf("fail to print oid: %s\n", str);
return 1;
}
ret = strcmp(p, str);
if (ret) {
printf("oid %s != formated oid %s\n", str, p);
free(p);
return ret;
}
ret = der_parse_heim_oid(p, " ", &o2);
if (ret) {
printf("failed to parse %s\n", p);
free(p);
return ret;
}
free(p);
ret = der_heim_oid_cmp(&o2, oid);
der_free_oid(&o2);
return ret;
}
开发者ID:IIJ-NetBSD,项目名称:netbsd-src,代码行数:31,代码来源:check-der.c
示例4: hx509_ca_tbs_add_eku
int
hx509_ca_tbs_add_eku(hx509_context context,
hx509_ca_tbs tbs,
const heim_oid *oid)
{
void *ptr;
int ret;
unsigned i;
/* search for duplicates */
for (i = 0; i < tbs->eku.len; i++) {
if (der_heim_oid_cmp(oid, &tbs->eku.val[i]) == 0)
return 0;
}
ptr = realloc(tbs->eku.val, sizeof(tbs->eku.val[0]) * (tbs->eku.len + 1));
if (ptr == NULL) {
hx509_set_error_string(context, 0, ENOMEM, "out of memory");
return ENOMEM;
}
tbs->eku.val = ptr;
ret = der_copy_oid(oid, &tbs->eku.val[tbs->eku.len]);
if (ret) {
hx509_set_error_string(context, 0, ret, "out of memory");
return ret;
}
tbs->eku.len += 1;
return 0;
}
开发者ID:Alexandr-Galko,项目名称:samba,代码行数:29,代码来源:ca.c
示例5: _hx509_name_cmp
int
_hx509_name_cmp(const Name *n1, const Name *n2)
{
int i, j, c;
c = n1->u.rdnSequence.len - n2->u.rdnSequence.len;
if (c)
return c;
for (i = 0 ; i < n1->u.rdnSequence.len; i++) {
c = n1->u.rdnSequence.val[i].len - n2->u.rdnSequence.val[i].len;
if (c)
return c;
for (j = 0; j < n1->u.rdnSequence.val[i].len; j++) {
c = der_heim_oid_cmp(&n1->u.rdnSequence.val[i].val[j].type,
&n1->u.rdnSequence.val[i].val[j].type);
if (c)
return c;
c = _hx509_name_ds_cmp(&n1->u.rdnSequence.val[i].val[j].value,
&n2->u.rdnSequence.val[i].val[j].value);
if (c)
return c;
}
}
return 0;
}
开发者ID:2014-class,项目名称:freerouter,代码行数:28,代码来源:name.c
示例6: _hx509_name_cmp
int
_hx509_name_cmp(const Name *n1, const Name *n2, int *c)
{
int ret;
size_t i, j;
*c = n1->u.rdnSequence.len - n2->u.rdnSequence.len;
if (*c)
return 0;
for (i = 0 ; i < n1->u.rdnSequence.len; i++) {
*c = n1->u.rdnSequence.val[i].len - n2->u.rdnSequence.val[i].len;
if (*c)
return 0;
for (j = 0; j < n1->u.rdnSequence.val[i].len; j++) {
*c = der_heim_oid_cmp(&n1->u.rdnSequence.val[i].val[j].type,
&n1->u.rdnSequence.val[i].val[j].type);
if (*c)
return 0;
ret = _hx509_name_ds_cmp(&n1->u.rdnSequence.val[i].val[j].value,
&n2->u.rdnSequence.val[i].val[j].value,
c);
if (ret)
return ret;
if (*c)
return 0;
}
}
*c = 0;
return 0;
}
开发者ID:IIJ-NetBSD,项目名称:netbsd-src,代码行数:33,代码来源:name.c
示例7: certBag_parser
static int
certBag_parser(hx509_context context,
struct hx509_collector *c,
const void *data, size_t length,
const PKCS12_Attributes *attrs)
{
heim_octet_string os;
hx509_cert cert;
PKCS12_CertBag cb;
int ret;
ret = decode_PKCS12_CertBag(data, length, &cb, NULL);
if (ret)
return ret;
if (der_heim_oid_cmp(&asn1_oid_id_pkcs_9_at_certTypes_x509, &cb.certType)) {
free_PKCS12_CertBag(&cb);
return 0;
}
ret = decode_PKCS12_OctetString(cb.certValue.data,
cb.certValue.length,
&os,
NULL);
free_PKCS12_CertBag(&cb);
if (ret)
return ret;
ret = hx509_cert_init_data(context, os.data, os.length, &cert);
der_free_octet_string(&os);
if (ret)
return ret;
ret = _hx509_collector_certs_add(context, c, cert);
if (ret) {
hx509_cert_free(cert);
return ret;
}
{
const PKCS12_Attribute *attr;
const heim_oid *oids[] = {
&asn1_oid_id_pkcs_9_at_localKeyId, &asn1_oid_id_pkcs_9_at_friendlyName
};
size_t i;
for (i = 0; i < sizeof(oids)/sizeof(oids[0]); i++) {
const heim_oid *oid = oids[i];
attr = find_attribute(attrs, oid);
if (attr)
_hx509_set_cert_attribute(context, cert, oid,
&attr->attrValues);
}
}
hx509_cert_free(cert);
return 0;
}
开发者ID:tombibsd,项目名称:netbsd-src,代码行数:59,代码来源:ks_p12.c
示例8: find_attribute
static const Attribute *
find_attribute(const CMSAttributes *attr, const heim_oid *oid)
{
size_t i;
for (i = 0; i < attr->len; i++)
if (der_heim_oid_cmp(&attr->val[i].type, oid) == 0)
return &attr->val[i];
return NULL;
}
开发者ID:InvLim,项目名称:heimdal,代码行数:9,代码来源:cms.c
示例9: find_attribute
static const PKCS12_Attribute *
find_attribute(const PKCS12_Attributes *attrs, const heim_oid *oid)
{
size_t i;
if (attrs == NULL)
return NULL;
for (i = 0; i < attrs->len; i++)
if (der_heim_oid_cmp(oid, &attrs->val[i].attrId) == 0)
return &attrs->val[i];
return NULL;
}
开发者ID:tombibsd,项目名称:netbsd-src,代码行数:11,代码来源:ks_p12.c
示例10: parse_ocsp_basic
static int
parse_ocsp_basic(const void *data, size_t length, OCSPBasicOCSPResponse *basic)
{
OCSPResponse resp;
size_t size;
int ret;
memset(basic, 0, sizeof(*basic));
ret = decode_OCSPResponse(data, length, &resp, &size);
if (ret)
return ret;
if (length != size) {
free_OCSPResponse(&resp);
return ASN1_EXTRA_DATA;
}
switch (resp.responseStatus) {
case successful:
break;
default:
free_OCSPResponse(&resp);
return HX509_REVOKE_WRONG_DATA;
}
if (resp.responseBytes == NULL) {
free_OCSPResponse(&resp);
return EINVAL;
}
ret = der_heim_oid_cmp(&resp.responseBytes->responseType,
&asn1_oid_id_pkix_ocsp_basic);
if (ret != 0) {
free_OCSPResponse(&resp);
return HX509_REVOKE_WRONG_DATA;
}
ret = decode_OCSPBasicOCSPResponse(resp.responseBytes->response.data,
resp.responseBytes->response.length,
basic,
&size);
if (ret) {
free_OCSPResponse(&resp);
return ret;
}
if (size != resp.responseBytes->response.length) {
free_OCSPResponse(&resp);
free_OCSPBasicOCSPResponse(basic);
return ASN1_EXTRA_DATA;
}
free_OCSPResponse(&resp);
return 0;
}
开发者ID:Henauxg,项目名称:minix,代码行数:54,代码来源:revoke.c
示例11: hx509_name_get_component
int
hx509_name_get_component(hx509_name name, int rdn, const heim_oid *type, unsigned *count, char **str)
{
Name *n = &name->der_name;
size_t len, ulen;
uint32_t *ds;
unsigned i;
int ret;
if (str)
*str = NULL;
if (rdn >= n->u.rdnSequence.len)
return ERANGE;
for (i = *count; i < n->u.rdnSequence.val[rdn].len; i++) {
if (der_heim_oid_cmp(&n->u.rdnSequence.val[rdn].val[i].type, type) == 0) {
*count = i + 1;
if (str == NULL)
return HX509_NAME_MALFORMED;
ret = dsstringprep(&n->u.rdnSequence.val[rdn].val[i].value, &ds, &len);
if (ret)
return ret;
ret = wind_ucs4utf8_length(ds, len, &ulen);
if (ret) {
free(ds);
return ret;
}
ulen += 1;
*str = malloc(ulen);
if (str == NULL) {
free(ds);
return ENOMEM;
}
ret = wind_ucs4utf8(ds, len, *str, &ulen);
free(ds);
if (ret) {
free(*str);
*str = NULL;
return ret;
}
return 0;
}
}
if (str == NULL)
return 0;
return HX509_NAME_MALFORMED;
}
开发者ID:alfintatorkace,项目名称:osx-10.9-opensource,代码行数:54,代码来源:name.c
示例12: parse_pkcs12_type
static void
parse_pkcs12_type(hx509_context context,
struct hx509_collector *c,
const heim_oid *oid,
const void *data, size_t length,
const PKCS12_Attributes *attrs)
{
size_t i;
for (i = 0; i < sizeof(bagtypes)/sizeof(bagtypes[0]); i++)
if (der_heim_oid_cmp(bagtypes[i].oid, oid) == 0)
(*bagtypes[i].func)(context, c, data, length, attrs);
}
开发者ID:tombibsd,项目名称:netbsd-src,代码行数:13,代码来源:ks_p12.c
示例13: oidtostring
static char *
oidtostring(const heim_oid *type)
{
char *s;
size_t i;
for (i = 0; i < sizeof(no)/sizeof(no[0]); i++) {
if (der_heim_oid_cmp((*no[i].o)(), type) == 0)
return strdup(no[i].n);
}
if (der_print_heim_oid(type, '.', &s) != 0)
return NULL;
return s;
}
开发者ID:2014-class,项目名称:freerouter,代码行数:14,代码来源:name.c
示例14: ecdsa_available
static int
ecdsa_available(const hx509_private_key signer,
const AlgorithmIdentifier *sig_alg)
{
const struct signature_alg *sig;
const EC_GROUP *group;
BN_CTX *bnctx = NULL;
BIGNUM *order = NULL;
int ret = 0;
if (der_heim_oid_cmp(signer->ops->key_oid, &asn1_oid_id_ecPublicKey) != 0)
_hx509_abort("internal error passing private key to wrong ops");
sig = _hx509_find_sig_alg(&sig_alg->algorithm);
if (sig == NULL || sig->digest_size == 0)
return 0;
group = EC_KEY_get0_group(signer->private_key.ecdsa);
if (group == NULL)
return 0;
bnctx = BN_CTX_new();
order = BN_new();
if (order == NULL)
goto err;
if (EC_GROUP_get_order(group, order, bnctx) != 1)
goto err;
#if 0
/* If anything, require a digest at least as wide as the EC key size */
if (BN_num_bytes(order) > sig->digest_size)
#endif
ret = 1;
err:
if (bnctx)
BN_CTX_free(bnctx);
if (order)
BN_clear_free(order);
return ret;
}
开发者ID:heimdal,项目名称:heimdal,代码行数:43,代码来源:crypto-ec.c
示例15: get_ecdh_param
static krb5_error_code
get_ecdh_param(krb5_context context,
krb5_kdc_configuration *config,
SubjectPublicKeyInfo *dh_key_info,
EC_KEY **out)
{
ECParameters ecp;
EC_KEY *public = NULL;
krb5_error_code ret;
const unsigned char *p;
size_t len;
int nid;
if (dh_key_info->algorithm.parameters == NULL) {
krb5_set_error_message(context, KRB5_BADMSGTYPE,
"PKINIT missing algorithm parameter "
"in clientPublicValue");
return KRB5_BADMSGTYPE;
}
memset(&ecp, 0, sizeof(ecp));
ret = decode_ECParameters(dh_key_info->algorithm.parameters->data,
dh_key_info->algorithm.parameters->length, &ecp, &len);
if (ret)
goto out;
if (ecp.element != choice_ECParameters_namedCurve) {
ret = KRB5_BADMSGTYPE;
goto out;
}
if (der_heim_oid_cmp(&ecp.u.namedCurve, &asn1_oid_id_ec_group_secp256r1) == 0)
nid = NID_X9_62_prime256v1;
else {
ret = KRB5_BADMSGTYPE;
goto out;
}
/* XXX verify group is ok */
public = EC_KEY_new_by_curve_name(nid);
开发者ID:IIJ-NetBSD,项目名称:netbsd-src,代码行数:42,代码来源:pkinit-ec.c
示例16: gss_decapsulate_token
GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL
gss_decapsulate_token(gss_const_buffer_t input_token,
gss_const_OID oid,
gss_buffer_t output_token)
{
GSSAPIContextToken ct;
heim_oid o;
OM_uint32 status;
int ret;
size_t size;
_mg_buffer_zero(output_token);
ret = der_get_oid (oid->elements, oid->length, &o, &size);
if (ret)
return GSS_S_FAILURE;
ret = decode_GSSAPIContextToken(input_token->value, input_token->length,
&ct, NULL);
if (ret) {
der_free_oid(&o);
return GSS_S_FAILURE;
}
if (der_heim_oid_cmp(&ct.thisMech, &o) == 0) {
status = GSS_S_COMPLETE;
output_token->value = ct.innerContextToken.data;
output_token->length = ct.innerContextToken.length;
der_free_oid(&ct.thisMech);
} else {
free_GSSAPIContextToken(&ct);
status = GSS_S_FAILURE;
}
der_free_oid(&o);
return status;
}
开发者ID:2asoft,项目名称:freebsd,代码行数:37,代码来源:gss_decapsulate_token.c
示例17: envelopedData_parser
static int
envelopedData_parser(hx509_context context,
struct hx509_collector *c,
const void *data, size_t length,
const PKCS12_Attributes *attrs)
{
heim_octet_string content;
heim_oid contentType;
hx509_lock lock;
int ret;
memset(&contentType, 0, sizeof(contentType));
lock = _hx509_collector_get_lock(c);
ret = hx509_cms_unenvelope(context,
_hx509_lock_unlock_certs(lock),
0,
data, length,
NULL,
0,
&contentType,
&content);
if (ret) {
hx509_set_error_string(context, HX509_ERROR_APPEND, ret,
"PKCS12 failed to unenvelope");
return ret;
}
if (der_heim_oid_cmp(&contentType, &asn1_oid_id_pkcs7_data) == 0)
ret = parse_safe_content(context, c, content.data, content.length);
der_free_octet_string(&content);
der_free_oid(&contentType);
return ret;
}
开发者ID:tombibsd,项目名称:netbsd-src,代码行数:37,代码来源:ks_p12.c
示例18: oid_prefix_equal
static int
oid_prefix_equal(gss_OID oid_enc, gss_OID prefix_enc, unsigned *suffix)
{
int ret;
heim_oid oid;
heim_oid prefix;
*suffix = 0;
ret = der_get_oid(oid_enc->elements, oid_enc->length,
&oid, NULL);
if (ret) {
return 0;
}
ret = der_get_oid(prefix_enc->elements, prefix_enc->length,
&prefix, NULL);
if (ret) {
der_free_oid(&oid);
return 0;
}
ret = 0;
if (oid.length - 1 == prefix.length) {
*suffix = oid.components[oid.length - 1];
oid.length--;
ret = (der_heim_oid_cmp(&oid, &prefix) == 0);
oid.length++;
}
der_free_oid(&oid);
der_free_oid(&prefix);
return ret;
}
开发者ID:gojdic,项目名称:samba,代码行数:36,代码来源:inquire_sec_context_by_oid.c
示例19: RSA_verify
int
RSA_verify(int type, const unsigned char *from, unsigned int flen,
unsigned char *sigbuf, unsigned int siglen, RSA *rsa)
{
if (rsa->meth->rsa_verify)
return rsa->meth->rsa_verify(type, from, flen, sigbuf, siglen, rsa);
if (rsa->meth->rsa_pub_dec) {
const AlgorithmIdentifier *digest_alg;
void *data;
DigestInfo di;
size_t size;
int ret, ret2;
data = malloc(RSA_size(rsa));
if (data == NULL)
return -1;
memset(&di, 0, sizeof(di));
ret = rsa->meth->rsa_pub_dec(siglen, sigbuf, data, rsa, RSA_PKCS1_PADDING);
if (ret <= 0) {
free(data);
return -2;
}
ret2 = decode_DigestInfo(data, ret, &di, &size);
free(data);
if (ret2 != 0)
return -3;
if (ret != size) {
free_DigestInfo(&di);
return -4;
}
if (flen != di.digest.length || memcmp(di.digest.data, from, flen) != 0) {
free_DigestInfo(&di);
return -5;
}
if (type == NID_sha1) {
digest_alg = &_signature_sha1_data;
} else if (type == NID_md5) {
digest_alg = &_signature_md5_data;
} else if (type == NID_sha256) {
digest_alg = &_signature_sha256_data;
} else {
free_DigestInfo(&di);
return -1;
}
ret = der_heim_oid_cmp(&digest_alg->algorithm,
&di.digestAlgorithm.algorithm);
free_DigestInfo(&di);
if (ret != 0)
return 0;
return 1;
}
return 0;
}
开发者ID:alfintatorkace,项目名称:osx-10.9-opensource,代码行数:62,代码来源:rsa.c
示例20: hx509_validate_cert
int
hx509_validate_cert(hx509_context context,
hx509_validate_ctx ctx,
hx509_cert cert)
{
Certificate *c = _hx509_get_cert(cert);
TBSCertificate *t = &c->tbsCertificate;
hx509_name issuer, subject;
char *str;
struct cert_status status;
int ret;
memset(&status, 0, sizeof(status));
if (_hx509_cert_get_version(c) != 3)
validate_print(ctx, HX509_VALIDATE_F_VERBOSE,
"Not version 3 certificate\n");
if ((t->version == NULL || *t->version < 2) && t->extensions)
validate_print(ctx, HX509_VALIDATE_F_VALIDATE,
"Not version 3 certificate with extensions\n");
if (_hx509_cert_get_version(c) >= 3 && t->extensions == NULL)
validate_print(ctx, HX509_VALIDATE_F_VALIDATE,
"Version 3 certificate without extensions\n");
ret = hx509_cert_get_subject(cert, &subject);
if (ret) abort();
hx509_name_to_string(subject, &str);
validate_print(ctx, HX509_VALIDATE_F_VERBOSE,
"subject name: %s\n", str);
free(str);
ret = hx509_cert_get_issuer(cert, &issuer);
if (ret) abort();
hx509_name_to_string(issuer, &str);
validate_print(ctx, HX509_VALIDATE_F_VERBOSE,
"issuer name: %s\n", str);
free(str);
if (hx509_name_cmp(subject, issuer) == 0) {
status.selfsigned = 1;
validate_print(ctx, HX509_VALIDATE_F_VERBOSE,
"\tis a self-signed certificate\n");
}
validate_print(ctx, HX509_VALIDATE_F_VERBOSE,
"Validity:\n");
Time2string(&t->validity.notBefore, &str);
validate_print(ctx, HX509_VALIDATE_F_VERBOSE, "\tnotBefore %s\n", str);
free(str);
Time2string(&t->validity.notAfter, &str);
validate_print(ctx, HX509_VALIDATE_F_VERBOSE, "\tnotAfter %s\n", str);
free(str);
if (t->extensions) {
int i, j;
if (t->extensions->len == 0) {
validate_print(ctx,
HX509_VALIDATE_F_VALIDATE|HX509_VALIDATE_F_VERBOSE,
"The empty extensions list is not "
"allowed by PKIX\n");
}
for (i = 0; i < t->extensions->len; i++) {
for (j = 0; check_extension[j].name; j++)
if (der_heim_oid_cmp(check_extension[j].oid,
&t->extensions->val[i].extnID) == 0)
break;
if (check_extension[j].name == NULL) {
int flags = HX509_VALIDATE_F_VERBOSE;
if (t->extensions->val[i].critical)
flags |= HX509_VALIDATE_F_VALIDATE;
validate_print(ctx, flags, "don't know what ");
if (t->extensions->val[i].critical)
validate_print(ctx, flags, "and is CRITICAL ");
if (ctx->flags & flags)
hx509_oid_print(&t->extensions->val[i].extnID,
validate_vprint, ctx);
validate_print(ctx, flags, " is\n");
continue;
}
validate_print(ctx,
HX509_VALIDATE_F_VALIDATE|HX509_VALIDATE_F_VERBOSE,
"checking extention: %s\n",
check_extension[j].name);
(*check_extension[j].func)(ctx,
&status,
check_extension[j].cf,
&t->extensions->val[i]);
}
} else
validate_print(ctx, HX509_VALIDATE_F_VERBOSE, "no extentions\n");
if (status.isca) {
if (!status.haveSKI)
validate_print(ctx, HX509_VALIDATE_F_VALIDATE,
//.........这里部分代码省略.........
开发者ID:crherar,项目名称:Admin,代码行数:101,代码来源:print.c
注:本文中的der_heim_oid_cmp函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论