public class PrivateKeyExtensions extends Object
PrivateKeyExtensions.| Constructor and Description |
|---|
PrivateKeyExtensions() |
| Modifier and Type | Method and Description |
|---|---|
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 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. |
public static int getKeyLength(PrivateKey privateKey)
PrivateKey.privateKey - the private keypublic static 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.Copyright © 2015–2017 Alpha Ro Group UG (haftungsbeschrÀngt). All rights reserved.