java.lang.Object
org.shredzone.acme4j.util.KeyPairUtils
Utility class offering convenience methods for
KeyPair
.
Requires Bouncy Castle
.
-
Methodenübersicht
Modifizierer und TypMethodeBeschreibungstatic 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.static void
writePublicKey
(PublicKey key, Writer w) Writes aPublicKey
as PEM file.
-
Methodendetails
-
createKeyPair
Creates a new standardKeyPair
.This method can be used if no specific key type is required. It returns a "secp384r1" ECDSA key pair.
- Gibt zurück:
- Generated
KeyPair
- Seit:
- 2.8
-
createKeyPair
Creates a new RSAKeyPair
.- Parameter:
keysize
- Key size- Gibt zurück:
- Generated
KeyPair
-
createECKeyPair
Creates a new elliptic curveKeyPair
.- Parameter:
name
- ECDSA curve name (e.g. "secp256r1")- Gibt zurück:
- Generated
KeyPair
-
readKeyPair
Reads aKeyPair
from a PEM file.- Parameter:
r
-Reader
to read the PEM file from. TheReader
is closed after use.- Gibt zurück:
KeyPair
read- Löst aus:
IOException
-
writeKeyPair
Writes aKeyPair
PEM file.- Parameter:
keypair
-KeyPair
to writew
-Writer
to write the PEM file to. TheWriter
is closed after use.- Löst aus:
IOException
-
writePublicKey
Writes aPublicKey
as PEM file.- Parameter:
key
-PublicKey
w
-Writer
to write the PEM file to. TheWriter
is closed after use.- Löst aus:
IOException
- Seit:
- 3.0.0
-