|
| 1 | +# Description |
| 2 | + |
| 3 | +Simple example of ACERT (Attribute Certificate) support with wolfSSL compat layer, |
| 4 | +and OpenSSL. |
| 5 | + |
| 6 | +Supports: |
| 7 | + |
| 8 | +- printing |
| 9 | +- signing (openssl only) |
| 10 | +- verifying |
| 11 | + |
| 12 | +Based on this example: |
| 13 | +- https://github.com/philljj/acert-test |
| 14 | + |
| 15 | +## Prerequisites |
| 16 | + |
| 17 | +Building wolfSSL: Build wolfSSL with |
| 18 | + |
| 19 | +```sh |
| 20 | +./configure --enable-acert --enable-opensslextra --enable-rsapss |
| 21 | +make |
| 22 | +make install |
| 23 | +``` |
| 24 | + |
| 25 | +Building OpenSSL: At the time of writing this README, attribute cert support |
| 26 | +requires openssl master. Clone and build openssl with: |
| 27 | + |
| 28 | +```sh |
| 29 | +git clone https://github.com/openssl/openssl.git --depth=1 || exit 1 |
| 30 | +cd openssl || exit 1 |
| 31 | +./Configure || exit 1 |
| 32 | +make || exit 1 |
| 33 | +sudo make install |
| 34 | +``` |
| 35 | + |
| 36 | +## Building the examples |
| 37 | + |
| 38 | +Build the wolfssl example with: |
| 39 | + |
| 40 | +```sh |
| 41 | +make wolfssl_acert |
| 42 | +``` |
| 43 | + |
| 44 | +Build the openssl example with: |
| 45 | + |
| 46 | +```sh |
| 47 | +make wolfssl_acert |
| 48 | +``` |
| 49 | + |
| 50 | +Note: you may need to use this script to set your environment |
| 51 | + |
| 52 | +```sh |
| 53 | +$ source set_env |
| 54 | +info: using env: /usr/local/lib64/:/usr/local/lib/ |
| 55 | +``` |
| 56 | +## Examples |
| 57 | + |
| 58 | +### ACERT verification with pubkey |
| 59 | + |
| 60 | +```sh |
| 61 | +$./wolfssl_acert -f acerts/acert.pem -k acerts/acert_pubkey.pem |
| 62 | +info: using acert file: acerts/acert.pem |
| 63 | +info: using pubkey file: acerts/acert_pubkey.pem |
| 64 | +info: PEM_read_bio_X509_ACERT: good |
| 65 | +info: acert version: 1 |
| 66 | +info: PEM_read_bio_PUBKEY: good |
| 67 | +info: X509_ACERT_verify: good |
| 68 | +info: acert_do_test: good |
| 69 | +success |
| 70 | +``` |
| 71 | +### Sign and generate ACERT with RSA-PSS with OpenSSL, verify with wolfSSL |
| 72 | + |
| 73 | +1. Use `certs/acert.pem` as input `-f`, and generate new keys and sign `-s`, |
| 74 | + use RSA-PSS `-r`, and write to file `-w`: |
| 75 | + |
| 76 | +```sh |
| 77 | +$./openssl_acert -f certs/acert.pem -srw |
| 78 | +info: using acert file: certs/acert.pem |
| 79 | +info: using rsa_pss |
| 80 | +info: using mdname: SHA2-256 |
| 81 | +info: using mask alg: mgf1 with SHA1 |
| 82 | +info: PEM_read_bio_X509_ACERT: good |
| 83 | +info: acert version: 1 |
| 84 | +info: X509_ACERT_sign: good |
| 85 | +info: wrote acert to file: acert_new.pem |
| 86 | +info: wrote pubkey to file: pkey_new.pem |
| 87 | +info: X509_ACERT_verify: good |
| 88 | +info: acert_do_test: good |
| 89 | +success |
| 90 | +``` |
| 91 | + |
| 92 | +2. Finally, test wolfssl verify using newly generated `acert_new.pem` and |
| 93 | + `pkey_new.pem`: |
| 94 | +```sh |
| 95 | +$./wolfssl_acert -f acert_new.pem -k pkey_new.pem |
| 96 | +info: using acert file: acert_new.pem |
| 97 | +info: using pubkey file: pkey_new.pem |
| 98 | +info: PEM_read_bio_X509_ACERT: good |
| 99 | +info: acert version: 1 |
| 100 | +info: PEM_read_bio_PUBKEY: good |
| 101 | +info: X509_ACERT_verify: good |
| 102 | +info: acert_do_test: good |
| 103 | +success |
| 104 | +``` |
0 commit comments