Merge pull request #214 from kaleb-himes/IP_ADDR

Add a sample of IP address as opposed to DNS Name only
pull/216/head
David Garske 2020-06-25 15:04:01 -07:00 committed by GitHub
commit 8b14a534ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 4 deletions

View File

@ -144,10 +144,10 @@ int main(void) {
/* Add some alt names to our cert: */ /* Add some alt names to our cert: */
char myAltNames[] = { char myAltNames[] = {
/* SEQUENCE (1 element with 3 segements. Entire length is 35 /* SEQUENCE (1 element with 3 segements. Entire length is 41
* (0x23 in hex)) * (0x29 in hex))
*/ */
0x30, 0x23, 0x30, 0x29,
/* This is a String 0x8, it denotes a DNSName 0x2 -> 0x82 /* This is a String 0x8, it denotes a DNSName 0x2 -> 0x82
* This strings' length is 9 (0x09) * This strings' length is 9 (0x09)
*/ */
@ -165,7 +165,14 @@ int main(void) {
*/ */
0x82, 0x09, 0x82, 0x09,
/* This strings value is "127.0.0.1" (in hex) */ /* This strings value is "127.0.0.1" (in hex) */
0x31, 0x32, 0x37, 0x2e, 0x30, 0x2e, 0x30, 0x2e, 0x31 0x31, 0x32, 0x37, 0x2e, 0x30, 0x2e, 0x30, 0x2e, 0x31,
/* This is a string 0x08, it denotes an IP Address 0x07 -> 0x87 */
/* This strings length is 4 (0x04) */
0x87, 0x04,
/* The IP address is 127 (0x7F), 0 (0x00), 0, (0x00), 1 (0x01) ->
* 127.0.0.1
*/
0x7F, 0x00, 0x00, 0x01
}; };
XMEMCPY(newCert.altNames, myAltNames, sizeof(myAltNames)); XMEMCPY(newCert.altNames, myAltNames, sizeof(myAltNames));
newCert.altNamesSz = (int) sizeof(myAltNames); newCert.altNamesSz = (int) sizeof(myAltNames);