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 KeyPaircreateECKeyPair(String name) Creates a new elliptic curveKeyPair.static KeyPairCreates a new standardKeyPair.static KeyPaircreateKeyPair(int keysize) Creates a new RSAKeyPair.static KeyPairReads aKeyPairfrom a PEM file.static voidwriteKeyPair(KeyPair keypair, Writer w) Writes aKeyPairPEM 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 aKeyPairfrom a PEM file.- Parameters:
r-Readerto read the PEM file from. TheReaderis closed after use.- Returns:
KeyPairread- Throws:
IOException
-
writeKeyPair
Writes aKeyPairPEM file.- Parameters:
keypair-KeyPairto writew-Writerto write the PEM file to. TheWriteris closed after use.- Throws:
IOException
-