support of PKCS#10 certificate request parsing
This commit is contained in:
@@ -24,6 +24,7 @@ ENUM(certificate_type_names, CERT_ANY, CERT_PLUTO_CRL,
|
||||
"X509_OCSP_REQUEST",
|
||||
"X509_OCSP_RESPONSE",
|
||||
"X509_AC",
|
||||
"PKCS10_REQUEST",
|
||||
"TRUSTED_PUBKEY",
|
||||
"PGP",
|
||||
"PLUTO_CERT",
|
||||
|
||||
@@ -45,6 +45,8 @@ enum certificate_type_t {
|
||||
CERT_X509_OCSP_RESPONSE,
|
||||
/** X.509 attribute certificate */
|
||||
CERT_X509_AC,
|
||||
/** PKCS#10 certificate request */
|
||||
CERT_PKCS10_REQUEST,
|
||||
/** trusted, preinstalled public key */
|
||||
CERT_TRUSTED_PUBKEY,
|
||||
/** PGP certificate */
|
||||
@@ -96,7 +98,7 @@ struct certificate_t {
|
||||
/**
|
||||
* Get the type of the certificate.
|
||||
*
|
||||
* @return certifcate type
|
||||
* @return certificate type
|
||||
*/
|
||||
certificate_type_t (*get_type)(certificate_t *this);
|
||||
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* Copyright (C) 2009 Andreas Steffen
|
||||
* HSR Hochschule fuer Technik Rapperswil
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation; either version 2 of the License, or (at your
|
||||
* option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* for more details.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup req req
|
||||
* @{ @ingroup certificates
|
||||
*/
|
||||
|
||||
#ifndef PKCS10_H_
|
||||
#define PKCS10_H_
|
||||
|
||||
#include <utils/enumerator.h>
|
||||
#include <credentials/certificates/certificate.h>
|
||||
|
||||
typedef struct pkcs10_t pkcs10_t;
|
||||
|
||||
/**
|
||||
* PKCS#10 certificate request interface.
|
||||
*
|
||||
* This interface adds additional methods to the certificate_t type to
|
||||
* allow further operations on a certificate request.
|
||||
*/
|
||||
struct pkcs10_t {
|
||||
|
||||
/**
|
||||
* Implements certificate_t.
|
||||
*/
|
||||
certificate_t interface;
|
||||
|
||||
/**
|
||||
* Get the challenge password
|
||||
*
|
||||
* @return challenge password as a chunk_t
|
||||
*/
|
||||
chunk_t (*get_challengePassword)(pkcs10_t *this);
|
||||
|
||||
/**
|
||||
* Get.
|
||||
*
|
||||
* @return enumerator over subjectAltNames as identification_t*
|
||||
*/
|
||||
enumerator_t* (*create_subjectAltName_enumerator)(pkcs10_t *this);
|
||||
};
|
||||
|
||||
#endif /** PKCS10_H_ @}*/
|
||||
@@ -0,0 +1,105 @@
|
||||
/*
|
||||
* Copyright (C) 2007-2008 Martin Willi
|
||||
* Hochschule fuer Technik Rapperswil
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation; either version 2 of the License, or (at your
|
||||
* option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* for more details.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup x509 x509
|
||||
* @{ @ingroup certificates
|
||||
*/
|
||||
|
||||
#ifndef X509_H_
|
||||
#define X509_H_
|
||||
|
||||
#include <utils/enumerator.h>
|
||||
#include <credentials/certificates/certificate.h>
|
||||
|
||||
typedef struct x509_t x509_t;
|
||||
typedef enum x509_flag_t x509_flag_t;
|
||||
|
||||
/**
|
||||
* X.509 certificate flags.
|
||||
*/
|
||||
enum x509_flag_t {
|
||||
/** cert has CA constraint */
|
||||
X509_CA = (1<<0),
|
||||
/** cert has AA constraint */
|
||||
X509_AA = (1<<1),
|
||||
/** cert has OCSP signer constraint */
|
||||
X509_OCSP_SIGNER = (1<<2),
|
||||
/** cert is self-signed */
|
||||
X509_SELF_SIGNED = (1<<3),
|
||||
};
|
||||
|
||||
/**
|
||||
* enum names for x509 flags
|
||||
*/
|
||||
extern enum_name_t *x509_flag_names;
|
||||
|
||||
/**
|
||||
* X.509 certificate interface.
|
||||
*
|
||||
* This interface adds additional methods to the certificate_t type to
|
||||
* allow further operations on these certificates.
|
||||
*/
|
||||
struct x509_t {
|
||||
|
||||
/**
|
||||
* Implements certificate_t.
|
||||
*/
|
||||
certificate_t interface;
|
||||
|
||||
/**
|
||||
* Get the flags set for this certificate.
|
||||
*
|
||||
* @return set of flags
|
||||
*/
|
||||
x509_flag_t (*get_flags)(x509_t *this);
|
||||
|
||||
/**
|
||||
* Get the certificate serial number.
|
||||
*
|
||||
* @return chunk pointing to internal serial number
|
||||
*/
|
||||
chunk_t (*get_serial)(x509_t *this);
|
||||
|
||||
/**
|
||||
* Get the the authorityKeyIdentifier.
|
||||
*
|
||||
* @return authKeyIdentifier as chunk_t, internal data
|
||||
*/
|
||||
chunk_t (*get_authKeyIdentifier)(x509_t *this);
|
||||
|
||||
/**
|
||||
* Create an enumerator over all subjectAltNames.
|
||||
*
|
||||
* @return enumerator over subjectAltNames as identification_t*
|
||||
*/
|
||||
enumerator_t* (*create_subjectAltName_enumerator)(x509_t *this);
|
||||
|
||||
/**
|
||||
* Create an enumerator over all CRL URIs.
|
||||
*
|
||||
* @return enumerator over URIs as char*
|
||||
*/
|
||||
enumerator_t* (*create_crl_uri_enumerator)(x509_t *this);
|
||||
|
||||
/**
|
||||
* Create an enumerator over all OCSP URIs.
|
||||
*
|
||||
* @return enumerator over URIs as char*
|
||||
*/
|
||||
enumerator_t* (*create_ocsp_uri_enumerator)(x509_t *this);
|
||||
};
|
||||
|
||||
#endif /** X509_H_ @}*/
|
||||
Reference in New Issue
Block a user