Current list:
+ Add ability to read PKCS-12 structures (certificate and private key)
-* Add functions to parse DER encoded private keys
+* Add more functions to parse DER encoded private keys
* Add support for the certificate authenticated SRP cipher suites
* Add option to read the SRP parameters using a callback (server side)
* Add functions to generate SRP parameters and SRP verifiers
session->internals.extensions_sent_size = 0;
/* by default no selected certificate */
- session->internals.selected_cert_index = -1;
session->internals.proposed_record_size = DEFAULT_MAX_RECORD_SIZE;
session->internals.adv_version_major = 0;
session->internals.adv_version_minor = 0;
/*
- * Copyright (C) 2001 Nikos Mavroyanopoulos
+ * Copyright (C) 2001,2002 Nikos Mavroyanopoulos
*
* This file is part of GNUTLS.
*
* gnutls_certificate_get_ours - This function returns the raw certificate sent in the last handshake
* @session: is a gnutls session
*
- * This function will return the raw certificate list as sent to the peer,
+ * This function will return the certificate as sent to the peer,
* in the last handshake. These certificates are in raw format.
* In X.509 this is a certificate list. In OpenPGP this is a single
* certificate.
}
index = session->internals.selected_cert_index;
- if (index < 0) return NULL; /* no certificate */
+ if (index < 0) {
+ gnutls_assert();
+ return NULL; /* no certificate */
+ }
- return &cred->cert_list[index]->raw;
+ return &cred->cert_list[index][0].raw;
+}
+
+/**
+ * gnutls_certificate_get_our_issuer - This function returns the raw certificate sent in the last handshake
+ * @session: is a gnutls session
+ *
+ * This function will return the raw certificate of our issuer as sent to the peer,
+ * in the last handshake. This certificate is in raw format.
+ * This has no meaning for OpenPGP keys.
+ * Returns NULL in case of an error, or if no certificate was found.
+ *
+ **/
+const gnutls_datum *gnutls_certificate_get_our_issuer(gnutls_session session)
+{
+ const gnutls_certificate_credentials cred;
+ int index;
+
+ CHECK_AUTH(GNUTLS_CRD_CERTIFICATE, NULL);
+
+ cred = _gnutls_get_cred(session->gnutls_key, GNUTLS_CRD_CERTIFICATE, NULL);
+ if (cred == NULL) {
+ gnutls_assert();
+ return NULL;
+ }
+
+ index = session->internals.selected_cert_index;
+ if (index < 0) {
+ gnutls_assert();
+ return NULL; /* no certificate */
+ }
+
+ if (cred->cert_list_length[index]-1 > 0)
+ return &cred->cert_list[index][cred->cert_list_length[index]-1].raw;
+ else return NULL;
}
/**
/* get data from the session */
const gnutls_datum* gnutls_certificate_get_peers( gnutls_session, int* list_size);
const gnutls_datum *gnutls_certificate_get_ours( gnutls_session session);
+const gnutls_datum *gnutls_certificate_get_our_issuer(gnutls_session session);
time_t gnutls_certificate_activation_time_peers(gnutls_session session);
time_t gnutls_certificate_expiration_time_peers(gnutls_session session);