# wolfSSL X509 Field Extraction Example

Example of parsing a DER encoded self-signed certificate and extracting
public key and subject name information.

## Compiling and Running the Example

To compile, first build wolfSSL with the OpenSSL compatibility layer enabled:

```
$ cd wolfssl-X.X.X
$ ./configure --enable-opensslextra
$ make
$ sudo make install
```

Then, compile the example app:

```
$ make
```

Next, run the example app with a cert of your choice:

EXAMPLE A:

```
$ ./app ../../certs/ca-cert.der RSA
PUBLIC KEY:
 
SIG TYPE = 655
CN = www.wolfssl.com (15)
COUNTRY = US (2)
LOCALITY = Bozeman (7)
STATE = Montana (7)
ORG = Sawtooth (8)
ORG UNIT = Consulting (10)
```


EXAMPLE B: (Assuming you've built and run the certgen_example example from
            wolfssl-examples/certgen/ directory with WOLFSSL_ALT_NAMES)

NOTE: Must configure with `--enable-opensslall` to see the IP address output!

```
$ ./app ../../certgen/newCert.der ECC
PUBLIC KEY:
3059301306072A8648CE3D020106082A8648CE3D03010703420004DC0E533A07160404DDA2D28685F8AB10880A1C17556443BE71C113BF5888268866187D976CB444CDE848C3AA6802251BF1FD2582FF1285BE869F5592ADD60C5D
SIG TYPE = 524
CN = www.yourDomain.com (18)
COUNTRY = US (2)
LOCALITY = Bozeman (7)
STATE = MT (2)
ORG = yourOrgNameHere (15)
ORG UNIT = yourUnitNameHere (16)
DNS:localhost
DNS:example.com
DNS:127.0.0.1
IP:127.0.0.1
```

For support, please contact support@wolfssl.com
