Possible bug in CRQ code, or possible user error?

Richard Moore rich at kde.org
Wed Dec 5 00:09:02 CET 2012


Hi,

I've been trying to access the name fields of certificate requests
using gnutls, and I'm not getting any joy, I've included the code
below. Is this something I'm doing wrong, or is there a bug here? I
always get -56 (The requested data were not available). I've looked
over the test cases for this case, and accessing these fields doesn't
seem to be covered. Any hints?

Cheers

Rich.

QStringList CertificateRequest::nameEntryInfo(Certificate::EntryType attribute)
{
    QStringList result;
#if 0
    int index = 0;
    QByteArray buffer(1024, 0);
    size_t size = buffer.size();
    do {
        d->errno = gnutls_x509_crq_get_attribute_data(d->crq, index,
buffer.data(), &size);
        result << QString::fromUtf8(buffer);
        qDebug() << d->errno << gnutls_strerror(d->errno) << buffer;
        index++;
    } while(GNUTLS_E_SUCCESS == d->errno);

#else
    QByteArray oid = entrytype_to_oid(attribute);
    if (oid.isNull())
        return result;

    int index = 0;
    QByteArray buffer(1024, 0);
    size_t size = buffer.size();
    do {
        qDebug() << oid;
        d->errno = gnutls_x509_crq_get_attribute_by_oid(d->crq,
oid.constData(), index, buffer.data(), &size);
        result << QString::fromUtf8(buffer);
        qDebug() << d->errno << gnutls_strerror(d->errno) << buffer;
        index++;
    } while(GNUTLS_E_SUCCESS == d->errno);
#endif
    return result;
}




More information about the Gnutls-help mailing list