security
KeyPair, KeyStore and Certificate utilities
Static helpers for KeyStores and KeyPairs, and a half-decent builder for X509 Certificates.
Example
Given static imports:
import static io.earcam.utilitarian.security.Certificates.DN_LOCALHOST; import static io.earcam.utilitarian.security.Certificates.certificate; import static io.earcam.utilitarian.security.Certificates.CertificateBuilder.localDate; import static io.earcam.utilitarian.security.Keys.rsa; import static java.time.ZoneId.systemDefault; import static java.util.concurrent.TimeUnit.DAYS;
And a field (that’s time-expensive to create):
private static final KeyPair RSA = rsa();
Then generating a certificate is relatively simple:
X509Certificate x509 = certificate() .issuer("foo corp") .subject("bar cert") .key(RSA) .toX509();