UTF8 question - Openssl

This is a discussion on UTF8 question - Openssl ; Hi I can create certificates with UTF-8 Strings like this: X509_NAME_add_entry_by_txt ( pName, "CN", MBSTRING_UTF8, ( unsigned char* ) subject.commonName.toUtf8(), -1, -1, 0 ); But how can I read back entries in the same encoding? X509_NAME_get_text_by_NID does not return UTF-8 ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: UTF8 question

  1. UTF8 question

    Hi

    I can create certificates with UTF-8 Strings like this:
    X509_NAME_add_entry_by_txt ( pName, "CN", MBSTRING_UTF8, ( unsigned char* )
    subject.commonName.toUtf8(), -1, -1, 0 );

    But how can I read back entries in the same encoding?

    X509_NAME_get_text_by_NID does not return UTF-8 and I cannot find a function
    where I can specify MBSTRING_UTF8.


    regards,
    Gerhard.
    __________________________________________________ ____________________
    OpenSSL Project http://www.openssl.org
    User Support Mailing List openssl-users@openssl.org
    Automated List Manager majordomo@openssl.org


  2. Re: UTF8 question

    On Mon, Jun 16, 2008, Gerhard Gappmeier wrote:

    > Hi
    >
    > I can create certificates with UTF-8 Strings like this:
    > X509_NAME_add_entry_by_txt ( pName, "CN", MBSTRING_UTF8, ( unsigned char* )
    > subject.commonName.toUtf8(), -1, -1, 0 );
    >
    > But how can I read back entries in the same encoding?
    >
    > X509_NAME_get_text_by_NID does not return UTF-8 and I cannot find a function
    > where I can specify MBSTRING_UTF8.
    >


    You need to get the individual ASN1_STRING structures for each field and then
    call ASN1_STRING_to_UTF8().

    Steve.
    --
    Dr Stephen N. Henson. Email, S/MIME and PGP keys: see homepage
    OpenSSL project core developer and freelance consultant.
    Homepage: http://www.drh-consultancy.demon.co.uk
    __________________________________________________ ____________________
    OpenSSL Project http://www.openssl.org
    User Support Mailing List openssl-users@openssl.org
    Automated List Manager majordomo@openssl.org


+ Reply to Thread