Changeset 10d9053 in mod_gnutls
- Timestamp:
- Jan 8, 2017, 9:00:28 AM (6 years ago)
- Branches:
- asyncio, debian/master, debian/stretch-backports, master, proxy-ticket, upstream
- Children:
- 0202d6b
- Parents:
- 0a12ff8
- git-author:
- Thomas Klute <thomas2.klute@…> (01/08/17 08:18:56)
- git-committer:
- Thomas Klute <thomas2.klute@…> (01/08/17 09:00:28)
- Location:
- test
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
test/gen_ocsp_index.c
r0a12ff8 r10d9053 19 19 * permissions and limitations under the License. 20 20 */ 21 #include <stdint.h> 21 22 #include <stdio.h> 22 23 #include <stdlib.h> … … 51 52 * any */ 52 53 char* revocation = ""; 53 /* serial number (hex) */54 char serial[128];54 /* serial number (hex), allocated when the length is known */ 55 char* serial = NULL; 55 56 /* certificate filename, or "unknown" */ 56 57 char* fname = "unknown"; … … 64 65 strftime(expires, sizeof(expires), "%y%m%d%H%M%SZ", &etmp); 65 66 66 unsigned long long sno = 0; 67 size_t serial_size = sizeof(sno); 68 gnutls_x509_crt_get_serial(cert, &sno, &serial_size); 69 snprintf(serial, sizeof(serial), "%llx", sno); 67 /* determine size of the serial number (in bytes) */ 68 size_t serial_size = 0; 69 gnutls_x509_crt_get_serial(cert, NULL, &serial_size); 70 /* allocate memory for serial number and its string representation */ 71 uint8_t* sno = calloc(serial_size, sizeof(uint8_t)); 72 serial = calloc(serial_size * 2 + 1, sizeof(char)); 73 /* actually get the serial */ 74 gnutls_x509_crt_get_serial(cert, sno, &serial_size); 75 /* print serial into the buffer byte for byte */ 76 for (int i = 0; i < serial_size; i++) 77 snprintf(serial + (2 * i), 3, "%.2X", sno[i]); 78 /* free binary serial */ 79 free(sno); 70 80 71 81 size_t dn_size = sizeof(dn); … … 74 84 fprintf(stdout, "%s\t%s\t%s\t%s\t%s\t%s\n", 75 85 flag, expires, revocation, serial, fname, dn); 86 87 /* free hex serial */ 88 free(serial); 76 89 77 90 cleanup: -
test/server.template.in
r0a12ff8 r10d9053 1 serial= 21 serial=587198681 2 2 cn=__HOSTNAME__ 3 3 tls_www_server -
test/test-27_OCSP_server.bash
r0a12ff8 r10d9053 7 7 # trigger OCSP server test in the runtests script 8 8 export CHECK_OCSP_SERVER="true" 9 echo "OCSP index for the test CA:" 10 cat authority/ocsp_index.txt 9 11 10 12 ${srcdir}/runtests t-27
Note: See TracChangeset
for help on using the changeset viewer.