Support different encoding types in certificate.get_encoding()

This commit is contained in:
Martin Willi
2010-07-13 13:53:20 +02:00
parent da9724e6d0
commit 0406eeaacb
27 changed files with 239 additions and 102 deletions
@@ -28,6 +28,7 @@ typedef enum cert_validation_t cert_validation_t;
#include <library.h>
#include <utils/identification.h>
#include <credentials/keys/public_key.h>
#include <credentials/cred_encoding.h>
/**
* Kind of a certificate_t
@@ -163,11 +164,14 @@ struct certificate_t {
time_t *not_before, time_t *not_after);
/**
* Get the certificate in an encoded form.
* Get the certificate in an encoded form as a chunk.
*
* @return allocated chunk of encoded cert
* @param type type of the encoding, one of CERT_*
* @param encoding encoding of the key, allocated
* @return TRUE if encoding supported
*/
chunk_t (*get_encoding)(certificate_t *this);
bool (*get_encoding)(certificate_t *this, cred_encoding_type_t type,
chunk_t *encoding);
/**
* Check if two certificates are equal.
@@ -86,6 +86,13 @@ enum cred_encoding_type_t {
PUBKEY_PGP,
PRIVKEY_PGP,
/** ASN.1 DER encoded certificate */
CERT_ASN1_DER,
/** PEM encoded certificate */
CERT_PEM,
/** PGP Packet encoded certificate */
CERT_PGP_PKT,
CRED_ENCODING_MAX,
};
@@ -117,6 +124,20 @@ enum cred_encoding_part_t {
CRED_PART_ECDSA_PUB_ASN1_DER,
/** a DER encoded ECDSA private key */
CRED_PART_ECDSA_PRIV_ASN1_DER,
/** a DER encoded X509 certificate */
CRED_PART_X509_ASN1_DER,
/** a DER encoded X509 CRL */
CRED_PART_X509_CRL_ASN1_DER,
/** a DER encoded X509 OCSP request */
CRED_PART_X509_OCSP_REQ_ASN1_DER,
/** a DER encoded X509 OCSP response */
CRED_PART_X509_OCSP_RES_ASN1_DER,
/** a DER encoded X509 attribute certificate */
CRED_PART_X509_AC_ASN1_DER,
/** a DER encoded PKCS10 certificate request */
CRED_PART_PKCS10_ASN1_DER,
/** a PGP encoded certificate */
CRED_PART_PGP_CERT,
CRED_PART_END,
};