org.PingOO.DLAI.PPM.security
Class ToServerSignature
java.lang.Object
|
+--org.PingOO.DLAI.PPM.security.ToServerSignature
- public final class ToServerSignature
- extends java.lang.Object
This class can generate a signature for the messages that are sent to the server.
Generates ans contains teh client's public and private key.
- Since:
- PingOO 2.0
- Version:
- 2.0
- Author:
- Fabrice Bouyé (bouye@cur-archamps.fr)
|
Field Summary |
private static java.security.Signature |
dsa
The signature generator. |
private static java.security.PrivateKey |
privateKey
The private key needed to create the signature. |
private static java.security.PublicKey |
publicKey
The public key need to verify the signature of the datas. |
|
Constructor Summary |
private |
ToServerSignature()
Needed to hide the constructor from the outside. |
|
Method Summary |
static byte[] |
generateSignature(byte[] data)
Signs a message and returns the signature. |
static java.security.PublicKey |
getPublicKey()
Returns the public key needed to verify the signature.. |
private static void |
initialize()
Initialiazes the public, private keys and the signature.
|
| 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.
privateKey
private static java.security.PrivateKey privateKey
- The private key needed to create the signature.
dsa
private static java.security.Signature dsa
- The signature generator.
ToServerSignature
private ToServerSignature()
- Needed to hide the constructor from the outside.
initialize
private static final void initialize()
- Initialiazes the public, private keys and the signature.
Since there are some exceptions to catch, this can't be done automatically.
getPublicKey
public static final java.security.PublicKey getPublicKey()
- Returns the public key needed to verify the signature..
- Returns:
- The public key of the key pair.
generateSignature
public static final byte[] generateSignature(byte[] data)
throws java.lang.NullPointerException
- Signs a message and returns the signature.
- Parameters:
data - The byte array to be signed.- Returns:
- The signature generated from the message.
- Throws:
- java.lang.NullPointerException - If data is
null.