mirror of https://github.com/openssl/openssl.git
feat: use ossl_serial_number_print in X509_print_ex
Reviewed-by: Neil Horman <nhorman@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/25428)
This commit is contained in:
parent
935f6e63c9
commit
c90451d89d
|
@ -88,37 +88,10 @@ int X509_print_ex(BIO *bp, X509 *x, unsigned long nmflags,
|
|||
|
||||
if (BIO_write(bp, " Serial Number:", 22) <= 0)
|
||||
goto err;
|
||||
|
||||
if (bs->length <= (int)sizeof(long)) {
|
||||
ERR_set_mark();
|
||||
l = ASN1_INTEGER_get(bs);
|
||||
ERR_pop_to_mark();
|
||||
} else {
|
||||
l = -1;
|
||||
}
|
||||
if (l != -1) {
|
||||
unsigned long ul;
|
||||
if (bs->type == V_ASN1_NEG_INTEGER) {
|
||||
ul = 0 - (unsigned long)l;
|
||||
neg = "-";
|
||||
} else {
|
||||
ul = l;
|
||||
neg = "";
|
||||
}
|
||||
if (BIO_printf(bp, " %s%lu (%s0x%lx)\n", neg, ul, neg, ul) <= 0)
|
||||
goto err;
|
||||
} else {
|
||||
neg = (bs->type == V_ASN1_NEG_INTEGER) ? " (Negative)" : "";
|
||||
if (BIO_printf(bp, "\n%12s%s", "", neg) <= 0)
|
||||
goto err;
|
||||
|
||||
for (i = 0; i < bs->length; i++) {
|
||||
if (BIO_printf(bp, "%02x%c", bs->data[i],
|
||||
((i + 1 == bs->length) ? '\n' : ':')) <= 0)
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
|
||||
if (ossl_serial_number_print(bp, bs, 12) != 0)
|
||||
goto err;
|
||||
if (BIO_puts(bp, "\n") <= 0)
|
||||
goto err;
|
||||
}
|
||||
|
||||
if (!(cflag & X509_FLAG_NO_SIGNAME)) {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
Certificate:
|
||||
Data:
|
||||
Version: 3 (0x2)
|
||||
Serial Number:
|
||||
Serial Number:
|
||||
0c:8c:40:93:bb:e6:93:bd:43:0b:f5:18:26:03:1d:05
|
||||
Signature Algorithm: GOST R 34.11-94 with GOST R 34.10-2001
|
||||
Issuer: OGRN=1027739334479, INN=007706228218, street=\U0414\U0435\U0440\U0431\U0435\U043D\U0435\U0432\U0441\U043A\U0430\U044F \U043D\U0430\U0431. \U0434. 7 \U0441\U0442\U0440. 15, emailAddress=pki-grfc@grfc.ru, C=RU, ST=77 \U0433. \U041C\U043E\U0441\U043A\U0432\U0430, L=\U041C\U043E\U0441\U043A\U0432\U0430, O=\U0424\U0413\U0423\U041F "\U0413\U0420\U0427\U0426", CN=\U0423\U0426 \U0424\U0413\U0423\U041F "\U0413\U0420\U0427\U0426"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
Certificate:
|
||||
Data:
|
||||
Version: 3 (0x2)
|
||||
Serial Number:
|
||||
Serial Number:
|
||||
0c:8c:40:93:bb:e6:93:bd:43:0b:f5:18:26:03:1d:05
|
||||
Signature Algorithm: GOST R 34.11-94 with GOST R 34.10-2001
|
||||
Issuer: OGRN=1027739334479, INN=007706228218, street=Дербеневская наб. д. 7 стр. 15, emailAddress=pki-grfc@grfc.ru, C=RU, ST=77 г. Москва, L=Москва, O=ФГУП "ГРЧЦ", CN=УЦ ФГУП "ГРЧЦ"
|
||||
|
|
Loading…
Reference in New Issue