|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.opcfoundation.ua.transport.security.PrivKey
public class PrivKey
Valid and encodeable private key.
Wrapper to PrivateKey
| Field Summary | |
|---|---|
RSAPrivateKey |
privateKey
|
| Constructor Summary | |
|---|---|
PrivKey(byte[] encodedPrivateKey)
Constructor for PrivKey. |
|
PrivKey(RSAPrivateKey privateKey)
Constructor for PrivKey. |
|
| Method Summary | |
|---|---|
byte[] |
getEncodedPrivateKey()
getEncodedPrivateKey. |
RSAPrivateKey |
getPrivateKey()
Getter for the field privateKey. |
static PrivKey |
load(byte[] keyBytes,
String password)
Load private key from key data |
static PrivKey |
load(File file)
Deprecated. Use load(File, String) or loadFromKeyStore(File, String) instead |
static PrivKey |
load(File file,
String password)
Load private key from a PEM encoded file |
static PrivKey |
load(InputStream is,
String password)
load. |
static PrivKey |
loadFromKeyStore(File file,
String password)
Load private key from a key store (PKCS12) file |
static PrivKey |
loadFromKeyStore(URL keystoreUrl,
String password)
Load private key from a PKCS12 key store |
void |
save(File file)
Save the key in a binary file. |
void |
save(File file,
String privateKeyPassword)
Save the private key to a PEM file |
void |
saveToKeyStore(Cert cert,
File file,
String privateKeyPassword,
String keyStorePassword,
String keyStoreType)
Save the identity to a password protected keystore. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public final RSAPrivateKey privateKey
| Constructor Detail |
|---|
public PrivKey(byte[] encodedPrivateKey)
throws IOException,
InvalidKeySpecException,
NoSuchAlgorithmException
Constructor for PrivKey.
encodedPrivateKey - an array of byte.
IOException - if any.
InvalidKeySpecException - if any.
NoSuchAlgorithmException - if any.public PrivKey(RSAPrivateKey privateKey)
Constructor for PrivKey.
privateKey - a RSAPrivateKey object.| Method Detail |
|---|
public static PrivKey loadFromKeyStore(URL keystoreUrl,
String password)
throws IOException,
UnrecoverableKeyException,
NoSuchAlgorithmException,
CertificateException,
KeyStoreException
keystoreUrl - url to key storepassword - password to key store
IOException - if any.
KeyStoreException - if any.
CertificateException - if any.
NoSuchAlgorithmException - if any.
UnrecoverableKeyException - if any.
public static PrivKey load(File file,
String password)
throws IOException,
NoSuchAlgorithmException,
InvalidKeySpecException,
NoSuchPaddingException,
InvalidKeyException,
InvalidAlgorithmParameterException,
IllegalBlockSizeException,
BadPaddingException,
InvalidParameterSpecException
file - a File object.password - a String object.
PrivKey object.
IOException - if any.
NoSuchAlgorithmException - if any.
InvalidKeySpecException - if any.
NoSuchPaddingException - if any.
InvalidAlgorithmParameterException - if any.
InvalidKeyException - if any.
BadPaddingException - if any.
IllegalBlockSizeException - if any.
InvalidParameterSpecException - if any.
public static PrivKey load(InputStream is,
String password)
throws IOException,
NoSuchAlgorithmException,
InvalidKeySpecException,
NoSuchPaddingException,
InvalidKeyException,
InvalidAlgorithmParameterException,
IllegalBlockSizeException,
BadPaddingException,
InvalidParameterSpecException
load.
is - a InputStream object.password - a String object.
PrivKey object.
IOException - if any.
NoSuchAlgorithmException - if any.
InvalidKeySpecException - if any.
NoSuchPaddingException - if any.
InvalidKeyException - if any.
InvalidAlgorithmParameterException - if any.
IllegalBlockSizeException - if any.
BadPaddingException - if any.
InvalidParameterSpecException - if any.
public static PrivKey load(byte[] keyBytes,
String password)
throws IOException,
NoSuchAlgorithmException,
InvalidKeySpecException,
NoSuchPaddingException,
InvalidKeyException,
InvalidAlgorithmParameterException,
IllegalBlockSizeException,
BadPaddingException,
InvalidParameterSpecException
password - a String object.keyBytes - an array of byte.
PrivKey object.
IOException - if any.
NoSuchAlgorithmException - if any.
InvalidKeySpecException - if any.
NoSuchPaddingException - if any.
InvalidAlgorithmParameterException - if any.
InvalidKeyException - if any.
BadPaddingException - if any.
IllegalBlockSizeException - if any.
InvalidParameterSpecException - if any.
@Deprecated
public static PrivKey load(File file)
throws IOException,
InvalidKeySpecException,
NoSuchAlgorithmException
load(File, String) or loadFromKeyStore(File, String) instead
file - a File object.
PrivKey object.
IOException - if any.
InvalidKeySpecException - if any.
NoSuchAlgorithmException - if any.
public static PrivKey loadFromKeyStore(File file,
String password)
throws IOException,
UnrecoverableKeyException,
NoSuchAlgorithmException,
CertificateException,
KeyStoreException
file - key store filepassword - password to key store
IOException - if any.
KeyStoreException - if any.
CertificateException - if any.
NoSuchAlgorithmException - if any.
UnrecoverableKeyException - if any.
public void save(File file)
throws IOException
file - a File object.
IOException - if any.
public void save(File file,
String privateKeyPassword)
throws IOException
file - the fileprivateKeyPassword - the password used to store the key
IOException - if any.public byte[] getEncodedPrivateKey()
getEncodedPrivateKey.
public RSAPrivateKey getPrivateKey()
Getter for the field privateKey.
RSAPrivateKey object.
public void saveToKeyStore(Cert cert,
File file,
String privateKeyPassword,
String keyStorePassword,
String keyStoreType)
throws IOException,
KeyStoreException,
NoSuchProviderException,
NoSuchAlgorithmException,
CertificateException
cert - the certificate used to chain the keyfile - the file used to store the keyprivateKeyPassword - the password to secure the private key, must not be null for
JKSkeyStorePassword - the password to the key store, must not be nullkeyStoreType - key store type, either "PKCS12" or "JKS"
IOException - if the file cannot be written to
NoSuchProviderException - Bouncy Castle Provider not found
KeyStoreException - keystore failed
CertificateException - certificate problem
NoSuchAlgorithmException - cryptographic algorithm not found
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||