|
| 1 | +# easycert |
| 2 | +Simple zero-config local certificates generator in rust |
| 3 | + |
| 4 | +```shell |
| 5 | +$ easycert init -l 4096 |
| 6 | +new ca generated! |
| 7 | + |
| 8 | +$ easycert new example.com *.example.com 10.0.0.1 ::1 |
| 9 | +New cert created to example.com.key example.com.crt |
| 10 | + |
| 11 | +$ openssl x509 -in example.com.crt -text -noout |
| 12 | +Certificate: |
| 13 | + Data: |
| 14 | + Version: 3 (0x2) |
| 15 | + Serial Number: |
| 16 | + af:38:f9:54 |
| 17 | + Signature Algorithm: sha512WithRSAEncryption |
| 18 | + Issuer: CN = TYANBOOT |
| 19 | + Validity |
| 20 | + Not Before: Jul 22 10:06:51 2018 GMT |
| 21 | + Not After : Jul 19 10:06:51 2028 GMT |
| 22 | + Subject: CN = example.com |
| 23 | + Subject Public Key Info: |
| 24 | + Public Key Algorithm: rsaEncryption |
| 25 | + Public-Key: (4096 bit) |
| 26 | + Modulus: |
| 27 | + 00:dc:0e:35:c8:bb:ec:72:82:eb:f1:df:72:96:f5: |
| 28 | + ... |
| 29 | + cb:b8:cf |
| 30 | + Exponent: 65537 (0x10001) |
| 31 | + X509v3 extensions: |
| 32 | + X509v3 Basic Constraints: |
| 33 | + CA:FALSE |
| 34 | + X509v3 Key Usage: |
| 35 | + Digital Signature, Key Encipherment |
| 36 | + X509v3 Authority Key Identifier: |
| 37 | + keyid:75:94:3F:58:9C:33:11:45:4A:0F:7A:CD:FB:FF:6C:9F:2F:AB:28:5A |
| 38 | + |
| 39 | + X509v3 Subject Key Identifier: |
| 40 | + FD:27:A7:1A:25:57:81:8C:B8:36:6E:C0:96:CF:7F:F0:20:87:B4:B3 |
| 41 | + X509v3 Subject Alternative Name: |
| 42 | + DNS:example.com, DNS:*.example.com, IP Address:10.0.0.1, IP Address:0:0:0:0:0:0:0:1 |
| 43 | + Signature Algorithm: sha512WithRSAEncryption |
| 44 | + 3d:2a:7a:2e:80:b4:03:37:03:45:00:91:47:cf:42:c9:4a:71: |
| 45 | + .... |
| 46 | + 0b:f2:ca:00:7a:b6:86:a5 |
| 47 | +``` |
| 48 | +<p align="center"><img alt="img" src="https://i.loli.net/2018/07/22/5b54583ce5901.png"></p> |
| 49 | + |
| 50 | +# Installation |
| 51 | + |
| 52 | +## Download pre-built binary from Github release |
| 53 | + |
| 54 | +## Build from source |
| 55 | + |
| 56 | +### Pre-requirements |
| 57 | +* rust environment |
| 58 | +* openssl develop package (lib etc) |
| 59 | + |
| 60 | +### Linux |
| 61 | + |
| 62 | +__build__ |
| 63 | +```shell |
| 64 | +$ cargo build --release |
| 65 | +$ target/release/easycert |
| 66 | +``` |
| 67 | + |
| 68 | +### Windows |
| 69 | + |
| 70 | +#### MSVC (recommend) |
| 71 | +You need install msvc first, either full visual studio or msvc only. This is required by rust. For details please refer to rust installation. |
| 72 | + |
| 73 | + |
| 74 | +__Install openssl__ |
| 75 | + |
| 76 | +__Option 1__ |
| 77 | + |
| 78 | +[precompiled binaries](http://slproweb.com/products/Win32OpenSSL.html) |
| 79 | + |
| 80 | +__Option 2__ |
| 81 | + |
| 82 | +[vcpkg](https://github.com/Microsoft/vcpkg) |
| 83 | + |
| 84 | +``` |
| 85 | +vcpkg install openssl:x64-windows |
| 86 | +``` |
| 87 | +if you want to build statically linked easycert, please install `openssl:x64-windows-static` instead |
| 88 | + |
| 89 | +__Option 3 (Not Recommend)__ |
| 90 | + |
| 91 | +Build openssl from source can be complex and may waste several minutes in your life :) |
| 92 | + |
| 93 | +If you still want to do that, please refer to: |
| 94 | + |
| 95 | +* [INSTALL](https://github.com/openssl/openssl/blob/master/INSTALL) |
| 96 | +* [NOTE](https://github.com/openssl/openssl/blob/master/NOTES.WIN) |
| 97 | + |
| 98 | +__Build__ |
| 99 | +If you install openssl via vcpkg, just |
| 100 | +``` |
| 101 | +set VCPKG_ROOT=<c:\path\to\vcpkg\installation> |
| 102 | +cargo build |
| 103 | +``` |
| 104 | + |
| 105 | +else if you should set OPENSSL_DIR manually |
| 106 | +``` |
| 107 | +set OPENSSL_DIR=<c:\path\to\openssl> |
| 108 | +cargo build |
| 109 | +``` |
| 110 | + |
| 111 | +If you want to build statically linked executeable, set OPENSSL_STATIC=1 before build. |
| 112 | + |
| 113 | +VC runtime are already statically linked, see `.cargo/config` |
| 114 | + |
| 115 | +# FAQ |
| 116 | + |
| 117 | +## Why my certificates are not trusted by browser? |
| 118 | +> You need install ca.pem and ca.key into your system trusted root certificates first, |
| 119 | +the next version will try to install it automatically. |
| 120 | + |
| 121 | +## How to do that? |
| 122 | +> Different system has different ways to install, please search for Google and etc for details instruction. |
| 123 | +In Windows, it is required to export to pkcs12 format first. |
0 commit comments