/**
* Subject Key Identifier
*/
- chunk_t subjectKeyID;
+ chunk_t subjectKeyIdentifier;
/**
* Authority Key Identifier
{
goto end;
}
- this->subjectKeyID = object;
+ this->subjectKeyIdentifier = object;
break;
case OID_SUBJECT_ALT_NAME:
x509_parse_generalNames(object, level, FALSE,
}
/**
- * Implementation of certificate_t.has_subject.
+ * Implementation of certificate_t.has_issuer.
*/
static id_match_t has_issuer(private_x509_cert_t *this, identification_t *issuer)
{
}
/**
- * Implementation of certificate_t.issued_by
+ * Implementation of certificate_t.issued_by.
*/
static bool issued_by(private_x509_cert_t *this, certificate_t *issuer)
{
static bool get_validity(private_x509_cert_t *this, time_t *when,
time_t *not_before, time_t *not_after)
{
- time_t t;
+ time_t t = when ? *when : time(NULL);
- if (when)
- {
- t = *when;
- }
- else
- {
- t = time(NULL);
- }
if (not_before)
{
*not_before = this->notBefore;
return this->serialNumber;
}
+/**
+ * Implementation of x509_t.get_subjectKeyIdentifier.
+ */
+static chunk_t get_subjectKeyIdentifier(private_x509_cert_t *this)
+{
+ if (this->subjectKeyIdentifier.ptr)
+ {
+ return this->subjectKeyIdentifier;
+ }
+ else
+ {
+ chunk_t fingerprint;
+
+ if (this->public_key->get_fingerprint(this->public_key,
+ KEY_ID_PUBKEY_SHA1, &fingerprint))
+ {
+ return fingerprint;
+ }
+ else
+ {
+ return chunk_empty;
+ }
+ }
+}
+
/**
* Implementation of x509_t.get_authKeyIdentifier.
*/
this->public.interface.interface.destroy = (void (*)(certificate_t*))destroy;
this->public.interface.get_flags = (x509_flag_t (*)(x509_t*))get_flags;
this->public.interface.get_serial = (chunk_t (*)(x509_t*))get_serial;
+ this->public.interface.get_subjectKeyIdentifier = (chunk_t (*)(x509_t*))get_subjectKeyIdentifier;
this->public.interface.get_authKeyIdentifier = (chunk_t (*)(x509_t*))get_authKeyIdentifier;
this->public.interface.create_subjectAltName_enumerator = (enumerator_t* (*)(x509_t*))create_subjectAltName_enumerator;
this->public.interface.create_crl_uri_enumerator = (enumerator_t* (*)(x509_t*))create_crl_uri_enumerator;
this->subjectAltNames = linked_list_create();
this->crl_uris = linked_list_create();
this->ocsp_uris = linked_list_create();
- this->subjectKeyID = chunk_empty;
+ this->subjectKeyIdentifier = chunk_empty;
this->authKeyIdentifier = chunk_empty;
this->authKeySerialNumber = chunk_empty;
this->algorithm = 0;