Hi,
On Tue, Sep 21, 2010 at 01:24:01PM +0200, Jan Danielsson wrote:
> Hello,
>
> The PKCS#11 specification stipulates that certificate object should
> have a subject attribute which is DER encoded.
>
> Let's say I have an X509 structure in a C program. Is there an easy
> and direct way to get a DER encoded subject from it with OpenSSL?
X509 *cert;
CK_ATTRIBUTE attr = {
.type = CKA_SUBJECT;
.pValue = NULL;
.ulValueLen = 0;
};
attr.ulValueLen = i2d_X509_NAME(X509_get_subject_name(cert), &attr.pValue);
OPENSSL_free(attr.pValue);
Cheers
Christian
______________________________________________________________________
OpenSSL Project http://www.openssl.org
User Support Mailing List [email protected]
Automated List Manager [email protected]