help-gnutls
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Possible bug in CRQ code, or possible user error?


From: Richard Moore
Subject: Possible bug in CRQ code, or possible user error?
Date: Tue, 4 Dec 2012 23:09:02 +0000

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;
}



reply via email to

[Prev in Thread] Current Thread [Next in Thread]