public class PrivateKeyExtensions extends Object
PrivateKeyExtensions.| Constructor and Description |
|---|
PrivateKeyExtensions() |
| Modifier and Type | Method and Description |
|---|---|
static String |
fromPKCS1ToPemFormat(byte[] privateKeyPKCS1Formatted)
Transform the given byte array(of private key in PKCS#1 format) to a PEM formatted
String. |
static PublicKey |
generatePublicKey(PrivateKey privateKey)
Generate the corresponding
PublicKey object from the given PrivateKey object. |
static int |
getKeyLength(PrivateKey privateKey)
Gets the key length of the given
PrivateKey. |
static de.alpharogroup.crypto.key.KeySize |
getKeySize(PrivateKey privateKey)
Gets the
KeySize of the given PrivateKey or null if not found. |
static String |
toBase64(PrivateKey privateKey)
Transform the given
PrivateKey to a base64 encoded String value. |
static String |
toBase64Binary(PrivateKey privateKey)
Transform the given
PrivateKey to a base64 encoded String value. |
static String |
toHexString(PrivateKey privateKey)
Transform the given
PrivateKey to a hexadecimal String value. |
static String |
toHexString(PrivateKey privateKey,
boolean lowerCase)
Transform the given
PrivateKey to a hexadecimal String value. |
static String |
toPemFormat(PrivateKey privateKey)
Transform the given private key that is in PKCS1 format and returns a
String object
in pem format. |
static byte[] |
toPKCS1Format(PrivateKey privateKey)
Transform the given private key to PKCS#1 format and returns it as an byte array
|
public static int getKeyLength(PrivateKey privateKey)
PrivateKey.privateKey - the private keypublic static de.alpharogroup.crypto.key.KeySize getKeySize(PrivateKey privateKey)
KeySize of the given PrivateKey or null if not found.privateKey - the private keyKeySize of the given PrivateKey or null if not found.public static String toHexString(PrivateKey privateKey)
PrivateKey to a hexadecimal String value.privateKey - the private keyString value.public static String toHexString(PrivateKey privateKey, boolean lowerCase)
PrivateKey to a hexadecimal String value.privateKey - the private keylowerCase - the flag if the result shell be transform in lower case. If true the result isString value.public static String toBase64(PrivateKey privateKey)
PrivateKey to a base64 encoded String value.privateKey - the private keyString value.public static String toBase64Binary(PrivateKey privateKey)
PrivateKey to a base64 encoded String value.privateKey - the private keyString value.public static PublicKey generatePublicKey(PrivateKey privateKey) throws NoSuchAlgorithmException, InvalidKeySpecException
PublicKey object from the given PrivateKey object.privateKey - the private keyPublicKey object or null if generation failed.NoSuchAlgorithmException - the no such algorithm exceptionInvalidKeySpecException - the invalid key spec exceptionpublic static String toPemFormat(PrivateKey privateKey) throws IOException
String object
in pem format.privateKey - the private keyString object in pem format generated from the given private key.IOException - Signals that an I/O exception has occurred.public static byte[] toPKCS1Format(PrivateKey privateKey) throws IOException
privateKey - the private keyIOException - Signals that an I/O exception has occurredpublic static String fromPKCS1ToPemFormat(byte[] privateKeyPKCS1Formatted) throws IOException
String.privateKeyPKCS1Formatted - the byte array(of private key in PKCS#1 format)IOException - Signals that an I/O exception has occurredCopyright © 2015–2019 Alpha Ro Group UG (haftungsbeschrÀngt). All rights reserved.