added function certreq_payload_create_from_x509()
This commit is contained in:
@@ -234,21 +234,21 @@ certreq_payload_t *certreq_payload_create()
|
|||||||
private_certreq_payload_t *this = malloc_thing(private_certreq_payload_t);
|
private_certreq_payload_t *this = malloc_thing(private_certreq_payload_t);
|
||||||
|
|
||||||
/* interface functions */
|
/* interface functions */
|
||||||
this->public.payload_interface.verify = (status_t (*) (payload_t *))verify;
|
this->public.payload_interface.verify = (status_t (*) (payload_t*))verify;
|
||||||
this->public.payload_interface.get_encoding_rules = (void (*) (payload_t *, encoding_rule_t **, size_t *) ) get_encoding_rules;
|
this->public.payload_interface.get_encoding_rules = (void (*) (payload_t*,encoding_rule_t**,size_t*))get_encoding_rules;
|
||||||
this->public.payload_interface.get_length = (size_t (*) (payload_t *)) get_length;
|
this->public.payload_interface.get_length = (size_t (*) (payload_t*))get_length;
|
||||||
this->public.payload_interface.get_next_type = (payload_type_t (*) (payload_t *)) get_next_type;
|
this->public.payload_interface.get_next_type = (payload_type_t (*) (payload_t*))get_next_type;
|
||||||
this->public.payload_interface.set_next_type = (void (*) (payload_t *,payload_type_t)) set_next_type;
|
this->public.payload_interface.set_next_type = (void (*) (payload_t*,payload_type_t))set_next_type;
|
||||||
this->public.payload_interface.get_type = (payload_type_t (*) (payload_t *)) get_payload_type;
|
this->public.payload_interface.get_type = (payload_type_t (*) (payload_t*))get_payload_type;
|
||||||
this->public.payload_interface.destroy = (void (*) (payload_t *))destroy;
|
this->public.payload_interface.destroy = (void (*) (payload_t*))destroy;
|
||||||
|
|
||||||
/* public functions */
|
/* public functions */
|
||||||
this->public.destroy = (void (*) (certreq_payload_t *)) destroy;
|
this->public.destroy = (void (*) (certreq_payload_t*)) destroy;
|
||||||
this->public.set_cert_encoding = (void (*) (certreq_payload_t *,cert_encoding_t)) set_cert_encoding;
|
this->public.set_cert_encoding = (void (*) (certreq_payload_t*,cert_encoding_t))set_cert_encoding;
|
||||||
this->public.get_cert_encoding = (cert_encoding_t (*) (certreq_payload_t *)) get_cert_encoding;
|
this->public.get_cert_encoding = (cert_encoding_t (*) (certreq_payload_t*))get_cert_encoding;
|
||||||
this->public.set_data = (void (*) (certreq_payload_t *,chunk_t)) set_data;
|
this->public.set_data = (void (*) (certreq_payload_t*,chunk_t))set_data;
|
||||||
this->public.get_data_clone = (chunk_t (*) (certreq_payload_t *)) get_data_clone;
|
this->public.get_data_clone = (chunk_t (*) (certreq_payload_t*))get_data_clone;
|
||||||
this->public.get_data = (chunk_t (*) (certreq_payload_t *)) get_data;
|
this->public.get_data = (chunk_t (*) (certreq_payload_t*))get_data;
|
||||||
|
|
||||||
/* private variables */
|
/* private variables */
|
||||||
this->critical = FALSE;
|
this->critical = FALSE;
|
||||||
@@ -258,3 +258,16 @@ certreq_payload_t *certreq_payload_create()
|
|||||||
|
|
||||||
return (&(this->public));
|
return (&(this->public));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Described in header
|
||||||
|
*/
|
||||||
|
certreq_payload_t *certreq_payload_create_from_x509(x509_t *cert)
|
||||||
|
{
|
||||||
|
certreq_payload_t *this = certreq_payload_create();
|
||||||
|
rsa_public_key_t *pubkey = cert->get_public_key(cert);
|
||||||
|
|
||||||
|
this->set_cert_encoding(this, CERT_X509_SIGNATURE);
|
||||||
|
this->set_data(this, pubkey->get_keyid(pubkey));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|||||||
@@ -122,5 +122,14 @@ struct certreq_payload_t {
|
|||||||
*/
|
*/
|
||||||
certreq_payload_t *certreq_payload_create(void);
|
certreq_payload_t *certreq_payload_create(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Creates a certreq_payload_t object from a X.509 CA certificate.
|
||||||
|
*
|
||||||
|
* @param cert X.509 CA certificate
|
||||||
|
* @return certreq_payload_t object
|
||||||
|
*
|
||||||
|
* @ingroup payloads
|
||||||
|
*/
|
||||||
|
certreq_payload_t *certreq_payload_create_from_x509(x509_t *cert);
|
||||||
|
|
||||||
#endif /* CERTREQ_PAYLOAD_H_ */
|
#endif /* CERTREQ_PAYLOAD_H_ */
|
||||||
|
|||||||
Reference in New Issue
Block a user