42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
const char *hex = "0123456789abcdef";
if (resultObj == NULL) {
return NULL;
}
for (int i = 0; i < ilen; i++) {
*dptr++ = hex[(*iptr>>4)&0xF];
*dptr++ = hex[(*iptr++)&0xF];
}
return resultObj;
}
/*
*-----------------------------------------------------------------------------
*
|
|
|
|
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
const char *hex = "0123456789abcdef";
if (resultObj == NULL) {
return NULL;
}
for (int i = 0; i < ilen; i++) {
*dptr++ = hex[(*iptr>>4)&0xF];
*dptr++ = hex[(*iptr++)&0xF];
}
return resultObj;
}
/*
*-----------------------------------------------------------------------------
*
|
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
|
LAPPEND_BOOL(interp, resultObj, "extInvalid", xflags & EXFLAG_INVALID);
LAPPEND_BOOL(interp, resultObj, "isCACert", X509_check_ca(cert));
/* The Unique Ids are used to handle the possibility of reuse of subject
and/or issuer names over time. RFC 5280 section 4.1.2.8 */
{
const ASN1_BIT_STRING *iuid, *suid;
X509_get0_uids(cert, &iuid, &suid);
Tcl_ListObjAppendElement(interp, resultObj, Tcl_NewStringObj("issuerUniqueId", -1));
if (iuid != NULL) {
Tcl_ListObjAppendElement(interp, resultObj, Tcl_NewByteArrayObj((const unsigned char *)iuid->data, (Tcl_Size) iuid->length));
} else {
Tcl_ListObjAppendElement(interp, resultObj, Tcl_NewStringObj("", -1));
}
|
|
|
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
|
LAPPEND_BOOL(interp, resultObj, "extInvalid", xflags & EXFLAG_INVALID);
LAPPEND_BOOL(interp, resultObj, "isCACert", X509_check_ca(cert));
/* The Unique Ids are used to handle the possibility of reuse of subject
and/or issuer names over time. RFC 5280 section 4.1.2.8 */
{
const ASN1_BIT_STRING *iuid, *suid;
X509_get0_uids(cert, &iuid, &suid);
Tcl_ListObjAppendElement(interp, resultObj, Tcl_NewStringObj("issuerUniqueId", -1));
if (iuid != NULL) {
Tcl_ListObjAppendElement(interp, resultObj, Tcl_NewByteArrayObj((const unsigned char *)iuid->data, (Tcl_Size) iuid->length));
} else {
Tcl_ListObjAppendElement(interp, resultObj, Tcl_NewStringObj("", -1));
}
|
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
|
/* Subject Information Access - RFC 5280 section 4.2.2.2, NID_sinfo_access */
/* Certificate Alias. If uses a PKCS#12 structure, alias will reflect the
friendlyName attribute (RFC 2985). */
{
int ilen = 0;
unsigned char *string = X509_alias_get0(cert, &ilen);
LAPPEND_STR(interp, resultObj, "alias", (char *) string, (Tcl_Size) ilen);
string = X509_keyid_get0(cert, &ilen);
LAPPEND_STR(interp, resultObj, "keyId", (char *) string, (Tcl_Size) ilen);
}
/* Certificate and dump all data */
if (all) {
Tcl_Obj *allObj = Tcl_NewByteArrayObj(NULL, 0);
Tcl_Obj *certObj = Tcl_NewByteArrayObj(NULL, 0);
|
|
|
|
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
|
/* Subject Information Access - RFC 5280 section 4.2.2.2, NID_sinfo_access */
/* Certificate Alias. If uses a PKCS#12 structure, alias will reflect the
friendlyName attribute (RFC 2985). */
{
int ilen = 0;
unsigned char *string = X509_alias_get0(cert, &ilen);
LAPPEND_STR(interp, resultObj, "alias", (char *) string, (Tcl_Size) ilen);
string = X509_keyid_get0(cert, &ilen);
LAPPEND_STR(interp, resultObj, "keyId", (char *) string, (Tcl_Size) ilen);
}
/* Certificate and dump all data */
if (all) {
Tcl_Obj *allObj = Tcl_NewByteArrayObj(NULL, 0);
Tcl_Obj *certObj = Tcl_NewByteArrayObj(NULL, 0);
|