Java Code Examples for org.shredzone.acme4j.util.KeyPairUtils#createKeyPair()
The following examples show how to use
org.shredzone.acme4j.util.KeyPairUtils#createKeyPair() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CertGenerator.java From spring-boot-starter-acme with Apache License 2.0 | 5 votes |
/** * Loads a key pair from specified file. If the file does not exist, * a new key pair is generated and saved. * * @return {@link KeyPair}. */ private KeyPair loadOrCreateKeyPair(File file) throws IOException { if (file.exists()) { try (FileReader fr = new FileReader(file)) { return KeyPairUtils.readKeyPair(fr); } } else { KeyPair domainKeyPair = KeyPairUtils.createKeyPair(KEY_SIZE); try (FileWriter fw = new FileWriter(file)) { KeyPairUtils.writeKeyPair(domainKeyPair, fw); } return domainKeyPair; } }
Example 2
Source File: AcmeClient.java From r2cloud with Apache License 2.0 | 5 votes |
private KeyPair createKeyPair(File file) throws IOException { messages.add("creating keypair", LOG); KeyPair keyPair = KeyPairUtils.createKeyPair(2048); try (FileWriter fw = new FileWriter(file)) { KeyPairUtils.writeKeyPair(keyPair, fw); } return keyPair; }
Example 3
Source File: AcmeClient.java From blynk-server with GNU General Public License v3.0 | 5 votes |
/** * Loads a key pair from specified file. If the file does not exist, * a new key pair is generated and saved. * * @return {@link KeyPair}. */ private KeyPair loadOrCreateKeyPair(File file) throws IOException { if (file.exists()) { try (FileReader fr = new FileReader(file)) { return KeyPairUtils.readKeyPair(fr); } } else { KeyPair domainKeyPair = KeyPairUtils.createKeyPair(KEY_SIZE); try (FileWriter fw = new FileWriter(file)) { KeyPairUtils.writeKeyPair(domainKeyPair, fw); } return domainKeyPair; } }