public class ApplicationSessionKeys
extends java.lang.Object
implements java.io.Serializable
Modifier and Type | Method and Description |
---|---|
static ApplicationSessionKeys |
getDefaultApplicationSessionKeys(java.lang.Object key)
Returns the application session keys based on a valid key.
|
java.security.PrivateKey |
getPrivateKey()
Returns the private key.
|
java.security.PublicKey |
getPublicKey()
Returns the public key.
|
boolean |
isInitialized()
Returns whether the keys are initialized or not.
|
static boolean |
isValidSessionData(byte[] signedSessionData,
java.lang.String data)
Verifies the session data passed with the default session data
generated by this application.
|
void |
setInitialized(boolean b)
Sets whether the keys are initialized or not.
|
void |
setPrivateKey(java.security.PrivateKey key)
Sets private key
|
void |
setPublicKey(java.security.PublicKey key)
Sets public key
|
byte[] |
signData(java.lang.String data)
Signs the passed data using the private key and
returns the signed data.
|
boolean |
verifySignedData(byte[] signedData,
java.lang.String data)
Verifies the signed data using the public key.
|
public java.security.PrivateKey getPrivateKey()
public void setPrivateKey(java.security.PrivateKey key)
key
- private keypublic java.security.PublicKey getPublicKey()
public void setPublicKey(java.security.PublicKey key)
key
- public keypublic boolean isInitialized()
public void setInitialized(boolean b)
b
- true, to indicate that keys are initialized,
otherwise false.public static final ApplicationSessionKeys getDefaultApplicationSessionKeys(java.lang.Object key) throws java.lang.Exception
key
- a valid key.java.lang.Exception
- if fails to generate session keys or the key passed
is invalid.public static boolean isValidSessionData(byte[] signedSessionData, java.lang.String data)
signedSessionData
- signed session data to be verifieddata
- data to be verifiedpublic byte[] signData(java.lang.String data) throws java.lang.Exception
data
- data to be signedjava.lang.Exception
- if fails to sign the data.public boolean verifySignedData(byte[] signedData, java.lang.String data) throws java.lang.Exception
signedData
- signed data to be verifieddata
- data to be verified againstjava.lang.Exception
- if fails to verify.