java.lang.Object
org.shredzone.acme4j.util.KeyPairUtils
Utility class offering convenience methods for
KeyPair
.
Requires Bouncy Castle
. This class is part of the acme4j-utils
module.
-
Method Summary
Modifier and TypeMethodDescriptionstatic KeyPair
createECKeyPair
(String name) Creates a new elliptic curveKeyPair
.static KeyPair
Creates a new standardKeyPair
.static KeyPair
createKeyPair
(int keysize) Creates a new RSAKeyPair
.static KeyPair
Reads aKeyPair
from a PEM file.static void
writeKeyPair
(KeyPair keypair, Writer w) Writes aKeyPair
PEM file.
-
Method Details
-
createKeyPair
Creates a new standardKeyPair
.This method can be used if no specific key type is required. It returns a "secp384r1" ECDSA key pair.
- Returns:
- Generated
KeyPair
- Since:
- 2.8
-
createKeyPair
Creates a new RSAKeyPair
.- Parameters:
keysize
- Key size- Returns:
- Generated
KeyPair
-
createECKeyPair
Creates a new elliptic curveKeyPair
.- Parameters:
name
- ECDSA curve name (e.g. "secp256r1")- Returns:
- Generated
KeyPair
-
readKeyPair
Reads aKeyPair
from a PEM file.- Parameters:
r
-Reader
to read the PEM file from. TheReader
is closed after use.- Returns:
KeyPair
read- Throws:
IOException
-
writeKeyPair
Writes aKeyPair
PEM file.- Parameters:
keypair
-KeyPair
to writew
-Writer
to write the PEM file to. TheWriter
is closed after use.- Throws:
IOException
-