| 1321 | |
| 1322 | |
| 1323 | int X509_NAME_get_index_by_NID(X509_NAME* name,int nid, int lastpos) |
| 1324 | { |
| 1325 | int idx = -1; // not found |
| 1326 | const char* start = &name->GetName()[lastpos + 1]; |
| 1327 | |
| 1328 | switch (nid) { |
| 1329 | case NID_commonName: |
| 1330 | const char* found = strstr(start, "/CN="); |
| 1331 | if (found) { |
| 1332 | found += 4; // advance to str |
| 1333 | idx = found - start + lastpos + 1; |
| 1334 | } |
| 1335 | break; |
| 1336 | } |
| 1337 | |
| 1338 | return idx; |
| 1339 | } |
| 1340 | |
| 1341 | |
| 1342 | ASN1_STRING* X509_NAME_ENTRY_get_data(X509_NAME_ENTRY* ne) |