public class KeyStoreWrapper
extends java.lang.Object
KeyStore
.Constructor and Description |
---|
KeyStoreWrapper() |
Modifier and Type | Method and Description |
---|---|
void |
deleteKey(java.lang.String name)
Delete key if it exists
|
java.security.PrivateKey |
getECPrivateKey(java.lang.String name)
Generates an EC keypair of length 256, and returns the private key.
|
java.security.PublicKey |
getECPublicKey(java.lang.String name)
Generates an EC keypair of length 256, and returns the public key.
|
java.lang.String |
getECPublicString(java.lang.String name)
Generates an EC keypair of length 256, and returns the encoded public key string.
|
static KeyStoreWrapper |
getInstance()
Returns an instance of this class, after initializing the KeyStore if required.
|
java.security.PrivateKey |
getRSAPrivateKey(java.lang.String name)
Generates an RSA keypair and returns the private key of length 2048.
|
java.security.PrivateKey |
getRSAPrivateKey(java.lang.String name,
int length)
Generates an RSA keypair and returns the private key.
|
java.security.PublicKey |
getRSAPublicKey(java.lang.String name)
Generates an RSA keypair and returns the public key of length 2048.
|
java.security.PublicKey |
getRSAPublicKey(java.lang.String name,
int length)
Generates an RSA keypair and returns the public key.
|
java.lang.String |
getRSAPublicString(java.lang.String name)
Generates an RSA keypair and returns the encoded public key string of length 2048.
|
java.lang.String |
getRSAPublicString(java.lang.String name,
int length)
Generates an RSA keypair and returns the encoded public key string.
|
public static KeyStoreWrapper getInstance()
public void deleteKey(java.lang.String name)
name
- Name of the key to deletepublic java.security.PublicKey getRSAPublicKey(java.lang.String name)
name
- Alias of the entry in which the generated key will appear in Android KeyStore.public java.lang.String getRSAPublicString(java.lang.String name)
name
- Alias of the entry in which the generated key will appear in Android KeyStore.public java.security.PrivateKey getRSAPrivateKey(java.lang.String name)
name
- Alias of the entry in which the generated key will appear in Android KeyStore.public java.security.PublicKey getRSAPublicKey(java.lang.String name, int length)
name
- Alias of the entry in which the generated key will appear in Android KeyStore.length
- Key length.public java.lang.String getRSAPublicString(java.lang.String name, int length)
name
- Alias of the entry in which the generated key will appear in Android KeyStore.length
- Key length.public java.security.PrivateKey getRSAPrivateKey(java.lang.String name, int length)
name
- Alias of the entry in which the generated key will appear in Android KeyStore.length
- Key length.public java.security.PublicKey getECPublicKey(java.lang.String name)
name
- Alias of the entry in which the generated key will appear in Android KeyStore.public java.lang.String getECPublicString(java.lang.String name)
name
- Alias of the entry in which the generated key will appear in Android KeyStore.public java.security.PrivateKey getECPrivateKey(java.lang.String name)
name
- Alias of the entry in which the generated key will appear in Android KeyStore.