I've written a [small library](https://github.com/tersesystems/securitybuilder#usage) for creating X.509 certificates, public and private keys, and KeyPair objects in one go. This is useful for testing and set up of PKI material generally, and also saves you the hassle of looking up the algorithm names and casting between types.<p>It's available at https://github.com/tersesystems/securitybuilder.