public class RsaSha1PrivateKeyHelper
extends java.lang.Object
PrivateKey
object from various sources. The key should be a Base-64 encoded private key
string conforming to the PKCS #8 standard.Modifier and Type | Method and Description |
---|---|
static java.security.PrivateKey |
getPrivateKey(byte[] privateKeyBytes)
Retrieves a
PrivateKey from an array of bytes. |
static java.security.PrivateKey |
getPrivateKey(java.io.File file)
Retrieves a
PrivateKey from a file. |
static java.security.PrivateKey |
getPrivateKey(java.io.Reader privateKeyReader)
Retrieves a
PrivateKey from a reader. |
static java.security.PrivateKey |
getPrivateKey(java.lang.String privateKeyString)
Retrieves a
PrivateKey from a string. |
static java.security.PrivateKey |
getPrivateKeyFromFilename(java.lang.String filename)
Retrieves a
PrivateKey from a file. |
public static java.security.PrivateKey getPrivateKeyFromFilename(java.lang.String filename) throws Base64DecoderException, java.security.spec.InvalidKeySpecException, java.io.IOException, java.security.NoSuchAlgorithmException
PrivateKey
from a file.filename
- The filename from which to load the private key.PrivateKey
object.Base64DecoderException
java.security.spec.InvalidKeySpecException
java.io.IOException
java.security.NoSuchAlgorithmException
public static java.security.PrivateKey getPrivateKey(java.io.File file) throws Base64DecoderException, java.security.spec.InvalidKeySpecException, java.io.IOException, java.security.NoSuchAlgorithmException
PrivateKey
from a file.file
- The File
object from which to load the private
key.PrivateKey
object.Base64DecoderException
java.security.spec.InvalidKeySpecException
java.io.IOException
java.security.NoSuchAlgorithmException
public static java.security.PrivateKey getPrivateKey(java.io.Reader privateKeyReader) throws Base64DecoderException, java.security.spec.InvalidKeySpecException, java.io.IOException, java.security.NoSuchAlgorithmException
PrivateKey
from a reader.privateKeyReader
- The Reader
object from which to
load the private key.PrivateKey
object.Base64DecoderException
java.security.spec.InvalidKeySpecException
java.io.IOException
java.security.NoSuchAlgorithmException
public static java.security.PrivateKey getPrivateKey(java.lang.String privateKeyString) throws Base64DecoderException, java.security.spec.InvalidKeySpecException, java.security.NoSuchAlgorithmException
PrivateKey
from a string.privateKeyString
- The string from which to load the private key.PrivateKey
object.Base64DecoderException
java.security.spec.InvalidKeySpecException
java.security.NoSuchAlgorithmException
public static java.security.PrivateKey getPrivateKey(byte[] privateKeyBytes) throws java.security.spec.InvalidKeySpecException, java.security.NoSuchAlgorithmException
PrivateKey
from an array of bytes.privateKeyBytes
- The array of bytes from which to load the private
key.PrivateKey
object.java.security.spec.InvalidKeySpecException
java.security.NoSuchAlgorithmException