Merge pull request #66 from kaleb-himes/updateCertGenEx
Add missing header and add subject info for newCertpull/69/head
commit
3e21a3a4d6
|
@ -14,31 +14,46 @@ You should see the following output when the cert is converted to human
|
||||||
readable format.
|
readable format.
|
||||||
|
|
||||||
```
|
```
|
||||||
Certificate:
|
ertificate:
|
||||||
Data:
|
Data:
|
||||||
Version: 3 (0x2)
|
Version: 3 (0x2)
|
||||||
Serial Number:
|
Serial Number: 81179639550048334 (0x1206873ba5ff84e)
|
||||||
01:68:de:48:eb:aa:76:e6
|
Signature Algorithm: ecdsa-with-SHA256
|
||||||
Signature Algorithm: ecdsa-with-SHA256
|
|
||||||
Issuer: C=US, ST=Montana, L=Bozeman, O=Sawtooth, OU=Consulting, CN=www.wolfssl.com/emailAddress=info@wolfssl.com
|
Issuer: C=US, ST=Montana, L=Bozeman, O=Sawtooth, OU=Consulting, CN=www.wolfssl.com/emailAddress=info@wolfssl.com
|
||||||
Validity
|
Validity
|
||||||
Not Before: Nov 2 00:07:29 2016 GMT
|
Not Before: Jul 17 15:53:18 2017 GMT
|
||||||
Not After : Mar 18 00:07:29 2018 GMT
|
Not After : Nov 30 14:53:18 2018 GMT
|
||||||
Subject:
|
Subject: C=US, ST=MT, L=Bozeman, O=yourOrgNameHere, OU=yourUnitNameHere, CN=www.yourDomain.com/emailAddress=yourEmail@yourDomain.com
|
||||||
Subject Public Key Info:
|
Subject Public Key Info:
|
||||||
Public Key Algorithm: id-ecPublicKey
|
Public Key Algorithm: id-ecPublicKey
|
||||||
EC Public Key:
|
Public-Key: (256 bit)
|
||||||
pub:
|
pub:
|
||||||
04:f9:4b:dd:9e:b9:bc:5b:e4:ac:a3:a5:6f:60:96:
|
04:15:62:0f:87:13:01:97:65:5c:62:a7:1c:92:bc:
|
||||||
3e:9d:d2:06:50:f8:34:5d:5b:c6:ce:52:7e:1d:ab:
|
61:df:24:52:ed:49:89:a1:ed:42:86:ad:dd:bf:1c:
|
||||||
6b:51:06:6f:e5:c2:da:b6:09:9f:20:9f:82:01:90:
|
a8:35:d3:9d:2c:29:12:cb:ce:05:bd:40:0b:24:f3:
|
||||||
ca:33:13:22:38:23:9e:84:b3:b6:23:16:7a:8b:d2:
|
d7:e0:61:f2:69:51:2a:20:b3:34:13:33:e7:69:b8:
|
||||||
13:97:9d:7a:de
|
d9:81:19:5f:b8
|
||||||
ASN1 OID: prime256v1
|
ASN1 OID: prime256v1
|
||||||
|
NIST CURVE: P-256
|
||||||
Signature Algorithm: ecdsa-with-SHA256
|
Signature Algorithm: ecdsa-with-SHA256
|
||||||
30:45:02:21:00:dd:8c:97:1f:e8:56:dc:f1:2a:fd:f6:86:bf:
|
30:45:02:20:75:11:0c:e7:b3:73:20:88:d2:67:69:f2:1a:46:
|
||||||
a7:c6:11:fc:9b:3f:09:8c:c2:ad:0e:0a:f9:2c:97:40:c6:ff:
|
fb:d2:67:31:c7:c7:58:b4:9d:e2:48:95:db:bb:1f:1d:24:ab:
|
||||||
dc:02:20:61:0b:1b:d7:be:69:3a:dd:fe:77:ca:0d:74:b0:ba:
|
02:21:00:d6:30:b9:c0:32:0d:42:74:56:b0:9e:8f:dc:83:1d:
|
||||||
a2:0c:1a:7a:bf:2e:c5:e7:46:11:8b:04:9e:27:ba:7c:27
|
e6:a3:af:99:ea:03:97:4c:dc:d0:11:b8:10:a1:5a:29:a5
|
||||||
|
-----BEGIN CERTIFICATE-----
|
||||||
|
MIICNTCCAdugAwIBAgIIASBoc7pf+E4wCgYIKoZIzj0EAwIwgZQxCzAJBgNVBAYT
|
||||||
|
AlVTMRAwDgYDVQQIDAdNb250YW5hMRAwDgYDVQQHDAdCb3plbWFuMREwDwYDVQQK
|
||||||
|
DAhTYXd0b290aDETMBEGA1UECwwKQ29uc3VsdGluZzEYMBYGA1UEAwwPd3d3Lndv
|
||||||
|
bGZzc2wuY29tMR8wHQYJKoZIhvcNAQkBFhBpbmZvQHdvbGZzc2wuY29tMCIYDzIw
|
||||||
|
MTcwNzE3MTU1MzE4WhgPMjAxODExMzAxNDUzMThaMIGnMQswCQYDVQQGEwJVUzEL
|
||||||
|
MAkGA1UECAwCTVQxEDAOBgNVBAcMB0JvemVtYW4xGDAWBgNVBAoMD3lvdXJPcmdO
|
||||||
|
YW1lSGVyZTEZMBcGA1UECwwQeW91clVuaXROYW1lSGVyZTEbMBkGA1UEAwwSd3d3
|
||||||
|
LnlvdXJEb21haW4uY29tMScwJQYJKoZIhvcNAQkBFhh5b3VyRW1haWxAeW91ckRv
|
||||||
|
bWFpbi5jb20wWTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAAQVYg+HEwGXZVxipxyS
|
||||||
|
vGHfJFLtSYmh7UKGrd2/HKg1050sKRLLzgW9QAsk89fgYfJpUSogszQTM+dpuNmB
|
||||||
|
GV+4MAoGCCqGSM49BAMCA0gAMEUCIHURDOezcyCI0mdp8hpG+9JnMcfHWLSd4kiV
|
||||||
|
27sfHSSrAiEA1jC5wDINQnRWsJ6P3IMd5qOvmeoDl0zc0BG4EKFaKaU=
|
||||||
|
-----END CERTIFICATE-----
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <wolfssl/options.h>
|
#include <wolfssl/options.h>
|
||||||
|
#include <wolfssl/wolfcrypt/ecc.h>
|
||||||
#include <wolfssl/wolfcrypt/settings.h>
|
#include <wolfssl/wolfcrypt/settings.h>
|
||||||
#include <wolfssl/wolfcrypt/asn_public.h>
|
#include <wolfssl/wolfcrypt/asn_public.h>
|
||||||
#include <wolfssl/wolfcrypt/asn.h>
|
#include <wolfssl/wolfcrypt/asn.h>
|
||||||
|
@ -120,6 +121,14 @@ int main(void) {
|
||||||
|
|
||||||
wc_InitCert(&newCert);
|
wc_InitCert(&newCert);
|
||||||
|
|
||||||
|
strncpy(newCert.subject.country, "US", CTC_NAME_SIZE);
|
||||||
|
strncpy(newCert.subject.state, "MT", CTC_NAME_SIZE);
|
||||||
|
strncpy(newCert.subject.locality, "Bozeman", CTC_NAME_SIZE);
|
||||||
|
strncpy(newCert.subject.org, "yourOrgNameHere", CTC_NAME_SIZE);
|
||||||
|
strncpy(newCert.subject.unit, "yourUnitNameHere", CTC_NAME_SIZE);
|
||||||
|
strncpy(newCert.subject.commonName, "www.yourDomain.com", CTC_NAME_SIZE);
|
||||||
|
strncpy(newCert.subject.email, "yourEmail@yourDomain.com", CTC_NAME_SIZE);
|
||||||
|
newCert.isCA = 0;
|
||||||
newCert.sigType = CTC_SHA256wECDSA;
|
newCert.sigType = CTC_SHA256wECDSA;
|
||||||
|
|
||||||
ret = wc_SetIssuerBuffer(&newCert, derBuf, derBufSz);
|
ret = wc_SetIssuerBuffer(&newCert, derBuf, derBufSz);
|
||||||
|
|
Loading…
Reference in New Issue