public class PublicKeyReader extends Object
PublicKeyReader is a utility class for reading public keys.| Modifier and Type | Field and Description |
|---|---|
static String |
BEGIN_PUBLIC_KEY_PREFIX
The Constant BEGIN_PUBLIC_KEY_PREFIX.
|
static String |
END_PUBLIC_KEY_SUFFIX
The Constant END_PUBLIC_KEY_SUFFIX.
|
| Constructor and Description |
|---|
PublicKeyReader() |
| Modifier and Type | Method and Description |
|---|---|
static String |
readPemFileAsBase64(File file)
Read the public key from a pem file as base64 encoded
String value. |
static PublicKey |
readPemPublicKey(File file)
reads a public key from a file.
|
static PublicKey |
readPublicKey(byte[] publicKeyBytes)
Read public key.
|
static PublicKey |
readPublicKey(byte[] publicKeyBytes,
String algorithm)
Read public key.
|
static PublicKey |
readPublicKey(File file)
Read public key.
|
public static final String END_PUBLIC_KEY_SUFFIX
public static final String BEGIN_PUBLIC_KEY_PREFIX
public static PublicKey readPublicKey(File file) throws IOException, NoSuchAlgorithmException, InvalidKeySpecException, NoSuchProviderException
file - the fileIOException - Signals that an I/O exception has occurred.NoSuchAlgorithmException - is thrown if instantiation of the cypher object fails.InvalidKeySpecException - is thrown if generation of the SecretKey object fails.NoSuchProviderException - is thrown if the specified provider is not registered in the security provider
list.public static PublicKey readPublicKey(byte[] publicKeyBytes) throws NoSuchAlgorithmException, InvalidKeySpecException, NoSuchProviderException
publicKeyBytes - the public key bytesNoSuchAlgorithmException - is thrown if instantiation of the cypher object fails.InvalidKeySpecException - is thrown if generation of the SecretKey object fails.NoSuchProviderException - is thrown if the specified provider is not registered in the security provider
list.public static PublicKey readPublicKey(byte[] publicKeyBytes, String algorithm) throws NoSuchAlgorithmException, InvalidKeySpecException, NoSuchProviderException
publicKeyBytes - the public key bytesalgorithm - the algorithm for the KeyFactoryNoSuchAlgorithmException - is thrown if instantiation of the cypher object fails.InvalidKeySpecException - is thrown if generation of the SecretKey object fails.NoSuchProviderException - is thrown if the specified provider is not registered in the security provider
list.public static PublicKey readPemPublicKey(File file) throws IOException, NoSuchAlgorithmException, InvalidKeySpecException, NoSuchProviderException
file - the fileIOException - Signals that an I/O exception has occurred.NoSuchAlgorithmException - is thrown if instantiation of the cypher object fails.InvalidKeySpecException - is thrown if generation of the SecretKey object fails.NoSuchProviderException - is thrown if the specified provider is not registered in the security provider
list.public static String readPemFileAsBase64(File file) throws IOException
String value.file - the file in pem format that contains the public key.String value.IOException - Signals that an I/O exception has occurred.Copyright © 2015–2019 Alpha Ro Group UG (haftungsbeschrÀngt). All rights reserved.