File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11# Certificate Generation and Signing examples
22
33To test the certgen or csr_example example(s) configure wolfssl with
4- ` ./configure --enable-certgen --enable-certreq ` or add the defines:
4+ ` ./configure --enable-certgen --enable-certreq --enable-keygen `
5+ or add the defines:
56
67```
78#define WOLFSSL_CERT_REQ
89#define WOLFSSL_CERT_GEN
10+ #define WOLFSSL_KEY_GEN
911```
1012
1113To test the csr_w_ed25519_example configure wolfssl with:
@@ -156,6 +158,18 @@ Saved CSR PEM to "ed25519-csr.pem"
156158
157159This example shows how to use a CSR to sign it using a CA cert and key to produce an X.509 certificate.
158160
161+ To test the csr_sign example configure wolfssl with
162+ ` ./configure -enable-certreq --enable-certgen --enable-ecc --enable-certext CFLAGS=-DOPENSSL_EXTRA_X509_SMALL `
163+ or add the defines:
164+
165+ ```
166+ #define WOLFSSL_CERT_REQ
167+ #define WOLFSSL_CERT_GEN
168+ #define WOLFSSL_KEY_GEN
169+ #define WOLFSSL_CERT_EXT
170+ #define OPENSSL_EXTRA_X509_SMALL
171+ ```
172+
159173```
160174% ./csr_sign ecc-csr.pem ca-ecc-cert.der ca-ecc-key.der
161175Loading CA certificate
@@ -348,7 +362,7 @@ Tested with these wolfSSL build options:
348362
349363``` sh
350364./autogen.sh # If cloned from GitHub
351- ./configure --enable-asn=template --enable-certreq --enable-keygen --enable-certgen --enable-certext CFLAGS=" -DWOLFSSL_TEST_CERT -DHAVE_OID_DECODING -DHAVE_OID_ENCODING -DWOLFSSL_CUSTOM_OID -DWOLFSSL_CERT_EXT "
365+ ./configure --enable-certreq --enable-certext --enable-keygen --enable-certgen --enable-certext CFLAGS=" -DWOLFSSL_TEST_CERT -DHAVE_OID_DECODING -DHAVE_OID_ENCODING -DWOLFSSL_CUSTOM_OID"
352366make
353367make check
354368sudo make install
Original file line number Diff line number Diff line change 2828#include <wolfssl/wolfcrypt/error-crypt.h>
2929#include <wolfssl/wolfcrypt/wc_port.h>
3030
31+ #if defined(WOLFSSL_CERT_REQ ) && defined(WOLFSSL_CERT_GEN ) && \
32+ defined(WOLFSSL_KEY_GEN ) && defined(HAVE_ECC )
33+
3134#ifdef WOLFSSL_CAAM
3235 #include <wolfssl/wolfcrypt/port/caam/wolfcaam.h>
3336 static int devId = WOLFSSL_CAAM_DEVID ;
3437#else
3538 static int devId = INVALID_DEVID ;
3639#endif
3740
38- #if defined(WOLFSSL_CERT_REQ ) && defined(WOLFSSL_CERT_GEN ) && \
39- defined(WOLFSSL_KEY_GEN ) && defined(HAVE_ECC )
4041
4142#define HEAP_HINT NULL
4243#define LARGE_TEMP_SZ 4096
Original file line number Diff line number Diff line change 3434#endif
3535
3636#if defined(WOLFSSL_CERT_REQ ) && defined(WOLFSSL_CERT_GEN ) && \
37- defined(HAVE_ECC )
37+ defined(HAVE_ECC ) && defined( WOLFSSL_CERT_EXT )
3838
3939#define HEAP_HINT NULL
4040#define LARGE_TEMP_SZ 4096
@@ -358,9 +358,9 @@ static int do_csrsign(int argc, char** argv)
358358int main (int argc , char * * argv )
359359{
360360#if !defined(WOLFSSL_CERT_REQ ) || !defined(WOLFSSL_CERT_GEN ) || \
361- !defined(HAVE_ECC )
361+ !defined(HAVE_ECC ) || !defined( WOLFSSL_CERT_EXT )
362362 printf ("Please compile wolfSSL with --enable-certreq --enable-certgen "
363- "--enable-ecc CFLAGS=-DOPENSSL_EXTRA_X509_SMALL\n" );
363+ "--enable-ecc --enable-certext CFLAGS=-DOPENSSL_EXTRA_X509_SMALL\n" );
364364 return 0 ;
365365#else
366366 if (argc != 4 ) {
Original file line number Diff line number Diff line change @@ -250,9 +250,9 @@ int main(int argc, char** argv)
250250
251251int main (int argc , char * * argv )
252252{
253- printf ("Please compile wolfSSL with --enable-asn=template --enable-certgen "
254- "--enable-keygen CFLAGS=\"-DWOLFSSL_CUSTOM_OID -DHAVE_OID_ENCODING "
255- "-DWOLFSSL_CERT_EXT\" " );
253+ printf ("Please configure wolfSSL with --enable-certgen --enable-certext "
254+ "--enable-keygen CFLAGS=\"-DWOLFSSL_CUSTOM_OID "
255+ "-DHAVE_OID_ENCODING\"\n " );
256256 return 0 ;
257257}
258258
Original file line number Diff line number Diff line change @@ -143,7 +143,10 @@ static void check_ret(char* call, int ret)
143143
144144int main (void )
145145{
146- printf ("Not compiled in: Build wolfSSL using ./configure --enable-asn=template --enable-certreq --enable-certgen CFLAGS=\"-DWOLFSSL_TEST_CERT -DHAVE_OID_DECODING -DWOLFSSL_CUSTOM_OID -DWOLFSSL_CERT_EXT\"\n" );
146+ printf ("Not compiled in: Configure wolfSSL using ./configure"
147+ "--enable-certreq --enable-certgen --enable-certext "
148+ "CFLAGS=\"-DWOLFSSL_TEST_CERT -DHAVE_OID_DECODING "
149+ "-DWOLFSSL_CUSTOM_OID \"\n" );
147150 return 0 ;
148151}
149152
You can’t perform that action at this time.
0 commit comments