Home > Back-end >  Using OpenSSL certificate serial number is not complete, turn to the great god deliver!!!!!!
Using OpenSSL certificate serial number is not complete, turn to the great god deliver!!!!!!

Time:09-26

Under the Window system open the certificate documents show the serial number of the following:


Call the OpenSSL code is as follows:
X509 * x;
The FILE * fp=NULL;
Unsigned char buf [5000], * p;
int len;
Serial ASN1_INTEGER *=NULL;
Fopen_s (& amp; Fp, "1. The cer", "rb");
if (! Fp) return;
Len=fread (buf, 1, 5000, fp);
fclose(fp);
P=(unsigned char *) base64_decode ((const char *) buf, len);
X=X509_new ();
D2i_X509 (& amp; X, (const unsigned char * *) & amp; P, len);
Serial=X509_get_serialNumber (x);

Printf (" serial number is: ");
For (int I=0; i Printf (" % 02 x, "Serial - & gt; Data [I]);
}
X509_free (x);
Call OpenSSL retrieve the certificate serial number is as follows:


Problems: through the OpenSSL get certificate serial number in front of 0 is filtered out, how can let the OpenSSL to obtain the complete certificate serial number?
Passing by the great god, give younger brother a little hint

CodePudding user response:

Will no one encountered such a problem, ask the great spirit,

CodePudding user response:

Dude, did you solve?
  • Related