org.PingOO.DLAI.PPM.security
Class FromServerSignature
java.lang.Object
|
+--org.PingOO.DLAI.PPM.security.FromServerSignature
- public final class FromServerSignature
- extends java.lang.Object
This class can verify the signature of the incoming messages.
It contains the key sent by the server at the beginning od the connection.
- Since:
- PingOO 2.0
- Version:
- 2.0
- Author:
- Fabrice Bouyé (bouye@cur-archamps.fr)
|
Field Summary |
private static java.security.PublicKey |
publicKey
The public key need to verify the signature of the datas. |
|
Constructor Summary |
private |
FromServerSignature()
Needed to hide the constructor from the outside. |
|
Method Summary |
static java.security.PublicKey |
getPublicKey()
Returns the server's public key. |
static void |
setPublicKey(java.security.PublicKey key)
Sets the public key needed to verify the signature of the incoming messages from the server. |
static boolean |
verifySignature(byte[] data,
byte[] signature)
Verify the signature of a byte array. |
| Methods inherited from class java.lang.Object |
,
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
registerNatives,
toString,
wait,
wait,
wait |
publicKey
private static java.security.PublicKey publicKey
- The public key need to verify the signature of the datas.
FromServerSignature
private FromServerSignature()
- Needed to hide the constructor from the outside.
getPublicKey
public static java.security.PublicKey getPublicKey()
- Returns the server's public key.
- Returns:
- The server's public key.
setPublicKey
public static final void setPublicKey(java.security.PublicKey key)
- Sets the public key needed to verify the signature of the incoming messages from the server.
verifySignature
public static final boolean verifySignature(byte[] data,
byte[] signature)
throws java.lang.NullPointerException
- Verify the signature of a byte array.
- Parameters:
data - The byte array to verify.signature - The supposed corresponding signature.- Returns:
true if the message and the signature are correct, false otherwise.- Throws:
- java.lang.NullPointerException - If data or if signature is
null.