OLD | NEW |
1 /* t_crl.c */ | 1 /* t_crl.c */ |
2 /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
3 * project 1999. | 3 * project 1999. |
4 */ | 4 */ |
5 /* ==================================================================== | 5 /* ==================================================================== |
6 * Copyright (c) 1999 The OpenSSL Project. All rights reserved. | 6 * Copyright (c) 1999 The OpenSSL Project. All rights reserved. |
7 * | 7 * |
8 * Redistribution and use in source and binary forms, with or without | 8 * Redistribution and use in source and binary forms, with or without |
9 * modification, are permitted provided that the following conditions | 9 * modification, are permitted provided that the following conditions |
10 * are met: | 10 * are met: |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 BIO_free(b); | 80 BIO_free(b); |
81 return(ret); | 81 return(ret); |
82 } | 82 } |
83 #endif | 83 #endif |
84 | 84 |
85 int X509_CRL_print(BIO *out, X509_CRL *x) | 85 int X509_CRL_print(BIO *out, X509_CRL *x) |
86 { | 86 { |
87 STACK_OF(X509_REVOKED) *rev; | 87 STACK_OF(X509_REVOKED) *rev; |
88 X509_REVOKED *r; | 88 X509_REVOKED *r; |
89 long l; | 89 long l; |
90 » int i, n; | 90 » int i; |
91 char *p; | 91 char *p; |
92 | 92 |
93 BIO_printf(out, "Certificate Revocation List (CRL):\n"); | 93 BIO_printf(out, "Certificate Revocation List (CRL):\n"); |
94 l = X509_CRL_get_version(x); | 94 l = X509_CRL_get_version(x); |
95 BIO_printf(out, "%8sVersion %lu (0x%lx)\n", "", l+1, l); | 95 BIO_printf(out, "%8sVersion %lu (0x%lx)\n", "", l+1, l); |
96 i = OBJ_obj2nid(x->sig_alg->algorithm); | 96 i = OBJ_obj2nid(x->sig_alg->algorithm); |
97 BIO_printf(out, "%8sSignature Algorithm: %s\n", "", | 97 BIO_printf(out, "%8sSignature Algorithm: %s\n", "", |
98 (i == NID_undef) ? "NONE" : OBJ_nid2ln(i)); | 98 (i == NID_undef) ? "NONE" : OBJ_nid2ln(i)); |
99 p=X509_NAME_oneline(X509_CRL_get_issuer(x),NULL,0); | 99 p=X509_NAME_oneline(X509_CRL_get_issuer(x),NULL,0); |
100 BIO_printf(out,"%8sIssuer: %s\n","",p); | 100 BIO_printf(out,"%8sIssuer: %s\n","",p); |
101 OPENSSL_free(p); | 101 OPENSSL_free(p); |
102 BIO_printf(out,"%8sLast Update: ",""); | 102 BIO_printf(out,"%8sLast Update: ",""); |
103 ASN1_TIME_print(out,X509_CRL_get_lastUpdate(x)); | 103 ASN1_TIME_print(out,X509_CRL_get_lastUpdate(x)); |
104 BIO_printf(out,"\n%8sNext Update: ",""); | 104 BIO_printf(out,"\n%8sNext Update: ",""); |
105 if (X509_CRL_get_nextUpdate(x)) | 105 if (X509_CRL_get_nextUpdate(x)) |
106 ASN1_TIME_print(out,X509_CRL_get_nextUpdate(x)); | 106 ASN1_TIME_print(out,X509_CRL_get_nextUpdate(x)); |
107 else BIO_printf(out,"NONE"); | 107 else BIO_printf(out,"NONE"); |
108 BIO_printf(out,"\n"); | 108 BIO_printf(out,"\n"); |
109 | 109 |
110 n=X509_CRL_get_ext_count(x); | |
111 X509V3_extensions_print(out, "CRL extensions", | 110 X509V3_extensions_print(out, "CRL extensions", |
112 x->crl->extensions, 0, 8); | 111 x->crl->extensions, 0, 8); |
113 | 112 |
114 rev = X509_CRL_get_REVOKED(x); | 113 rev = X509_CRL_get_REVOKED(x); |
115 | 114 |
116 if(sk_X509_REVOKED_num(rev) > 0) | 115 if(sk_X509_REVOKED_num(rev) > 0) |
117 BIO_printf(out, "Revoked Certificates:\n"); | 116 BIO_printf(out, "Revoked Certificates:\n"); |
118 else BIO_printf(out, "No Revoked Certificates.\n"); | 117 else BIO_printf(out, "No Revoked Certificates.\n"); |
119 | 118 |
120 for(i = 0; i < sk_X509_REVOKED_num(rev); i++) { | 119 for(i = 0; i < sk_X509_REVOKED_num(rev); i++) { |
121 r = sk_X509_REVOKED_value(rev, i); | 120 r = sk_X509_REVOKED_value(rev, i); |
122 BIO_printf(out," Serial Number: "); | 121 BIO_printf(out," Serial Number: "); |
123 i2a_ASN1_INTEGER(out,r->serialNumber); | 122 i2a_ASN1_INTEGER(out,r->serialNumber); |
124 BIO_printf(out,"\n Revocation Date: "); | 123 BIO_printf(out,"\n Revocation Date: "); |
125 ASN1_TIME_print(out,r->revocationDate); | 124 ASN1_TIME_print(out,r->revocationDate); |
126 BIO_printf(out,"\n"); | 125 BIO_printf(out,"\n"); |
127 X509V3_extensions_print(out, "CRL entry extensions", | 126 X509V3_extensions_print(out, "CRL entry extensions", |
128 r->extensions, 0, 8); | 127 r->extensions, 0, 8); |
129 } | 128 } |
130 X509_signature_print(out, x->sig_alg, x->signature); | 129 X509_signature_print(out, x->sig_alg, x->signature); |
131 | 130 |
132 return 1; | 131 return 1; |
133 | 132 |
134 } | 133 } |
OLD | NEW |