hello.

> since I am tired of wandering through the sources without directions:
> Can someone tell me how I cat get just the CN of the subject of a certificate
> in a verify-callback. (And no I don't want to use the X509_NAME_online and
> the fiddle in that string unless it is the only option, which I don't believe).

snippet of code (start of a function of mine (ignore SCR_ctx thats my
stuff)) I think will get you on track again :-)


int
SCR_cert_to_id(X509 *client_cert, SCR_ctx *scr_ctx) {
  char hostname[MAX_HOSTNAME_LEN];
  char orgunitname[MAX_HOSTNAME_LEN];
  X509_NAME *sname = X509_get_subject_name(client_cert);
  int id;
  FILE *certfile;
  char fullpath[MAX_PATH_SIZE];

  if (X509_NAME_get_text_by_NID(sname, NID_commonName,
                                hostname, MAX_HOSTNAME_LEN) == -1) {
    LOG_LOG(("SCR_cert_to_id: Failed to get Common Name.\n"));
    return -1;
  }
  if (X509_NAME_get_text_by_NID(sname, NID_organizationalUnitName,
                                orgunitname, MAX_HOSTNAME_LEN) == -1) {
    LOG_LOG(("SCR_cert_to_id: Failed to get Organizational Unit
Name.\n"));
    return -1;
  }

/douglas

> 
> Konstantin
> --
> Konstantin Agouros - NetAge Solutions, Dingolfinger Str. 6, 81673 Muenchen
> Tel.: 089 666584-0, Fax: 089 666584-11, Email: [EMAIL PROTECTED]
> --------------------------------------------------------------------------
> Black holes are, where god devided by zero.
> ______________________________________________________________________
> OpenSSL Project                                 http://www.openssl.org
> User Support Mailing List                    [EMAIL PROTECTED]
> Automated List Manager                           [EMAIL PROTECTED]

-- 

------------------------------------------------------
 Douglas Wikström <[EMAIL PROTECTED]>
------------------------------------------------------
 Yes, God created Man before Woman,
 but one always makes a draft before the masterpiece.
------------------------------------------------------
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to