Implemented cert payload constructor for custom encoding types

This commit is contained in:
Martin Willi 2010-11-02 12:13:03 +01:00
parent 3b3e5c0de5
commit dacf658036
2 changed files with 21 additions and 0 deletions

View File

@ -343,3 +343,15 @@ cert_payload_t *cert_payload_create_from_hash_and_url(chunk_t hash, char *url)
return &this->public;
}
/*
* Described in header
*/
cert_payload_t *cert_payload_create_custom(cert_encoding_t type, chunk_t data)
{
private_cert_payload_t *this = (private_cert_payload_t*)cert_payload_create();
this->encoding = type;
this->data = data;
this->payload_length = CERT_PAYLOAD_HEADER_LENGTH + this->data.len;
return &this->public;
}

View File

@ -134,4 +134,13 @@ cert_payload_t *cert_payload_create_from_cert(certificate_t *cert);
*/
cert_payload_t *cert_payload_create_from_hash_and_url(chunk_t hash, char *url);
/**
* Creates a custom certificate payload using type and associated data.
*
* @param type encoding type of certificate
* @param url associated data (gets owned)
* @return cert_payload_t object
*/
cert_payload_t *cert_payload_create_custom(cert_encoding_t type, chunk_t data);
#endif /** CERT_PAYLOAD_H_ @}*/