static void fill_RSA_public_key(struct RSA_public_key *rsa, SECKEYPublicKey *pubkey) { passert(SECKEY_GetPublicKeyType(pubkey) == rsaKey); rsa->e = clone_secitem_as_chunk(pubkey->u.rsa.publicExponent, "e"); rsa->n = clone_secitem_as_chunk(pubkey->u.rsa.modulus, "n"); form_keyid(rsa->e, rsa->n, rsa->keyid, &rsa->k); }
/* x509.c SEAM */ static void list_x509cert_chain(const char *caption, x509cert_t* cert, u_char auth_flags , bool utc) { bool first = TRUE; time_t tnow; /* determine the current time */ time(&tnow); while (cert != NULL) { if (auth_flags == AUTH_NONE || (auth_flags & cert->authority_flags)) { unsigned keysize; char keyid[KEYID_BUF]; char buf[ASN1_BUF_LEN]; char tbuf[TIMETOA_BUF]; cert_t c; c.type = CERT_X509_SIGNATURE; c.u.x509 = cert; if (first) { DBG_log( " "); DBG_log( "List of X.509 %s Certificates:", caption); DBG_log( " "); first = FALSE; } DBG_log( "NOW, count: %d", cert->count); dntoa(buf, ASN1_BUF_LEN, cert->subject); DBG_log( " subject: '%s'", buf); dntoa(buf, ASN1_BUF_LEN, cert->issuer); DBG_log( " issuer: '%s'", buf); datatot(cert->serialNumber.ptr, cert->serialNumber.len, ':' , buf, ASN1_BUF_LEN); DBG_log( " serial: %s", buf); form_keyid(cert->publicExponent, cert->modulus, keyid, &keysize); DBG_log( " pubkey: %4d RSA Key %s" , 8*keysize, keyid); DBG_log( " validity: not before %s %s", timetoa(&cert->notBefore, utc, tbuf, sizeof(tbuf)), (cert->notBefore < tnow)?"ok":"fatal (not valid yet)"); DBG_log( " not after %s %s", timetoa(&cert->notAfter, utc, tbuf, sizeof(tbuf)), check_expiry(cert->notAfter, CA_CERT_WARNING_INTERVAL, TRUE)); if (cert->subjectKeyID.ptr != NULL) { datatot(cert->subjectKeyID.ptr, cert->subjectKeyID.len, ':' , buf, ASN1_BUF_LEN); DBG_log( " subjkey: %s", buf); } if (cert->authKeyID.ptr != NULL) { datatot(cert->authKeyID.ptr, cert->authKeyID.len, ':' , buf, ASN1_BUF_LEN); DBG_log( " authkey: %s", buf); } if (cert->authKeySerialNumber.ptr != NULL) { datatot(cert->authKeySerialNumber.ptr, cert->authKeySerialNumber.len , ':', buf, ASN1_BUF_LEN); DBG_log( " aserial: %s", buf); } } cert = cert->next; } }