WEBsina Software

com.websina.license
Class SignatureUtil

java.lang.Object
  extended bycom.websina.license.SignatureUtil

public class SignatureUtil
extends java.lang.Object

This is a utility class for sign and verify the signature.

Since:
1.0

Method Summary
static java.lang.String sign(java.lang.String data, byte[] encodedPrivateKey)
          This method creates the signature based on the license data and the private key.
static boolean verify(java.lang.String data, byte[] signature, byte[] encodedPublicKey)
          This method validate license data based on the signature and the public key.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

sign

public static java.lang.String sign(java.lang.String data,
                                    byte[] encodedPrivateKey)
                             throws java.security.GeneralSecurityException
This method creates the signature based on the license data and the private key. It is called by the LicenseTool to create the license.

Parameters:
data - the license data.
encodedPrivateKey - the private key.
Returns:
the encoded signature.
Throws:
java.security.GeneralSecurityException

verify

public static boolean verify(java.lang.String data,
                             byte[] signature,
                             byte[] encodedPublicKey)
                      throws java.security.GeneralSecurityException
This method validate license data based on the signature and the public key. It is called by the LicenseManager to validate the license.

Parameters:
data - the license data.
encodedPublicKey - the public key.
Returns:
a boolean whether or the license is valid.
Throws:
java.security.GeneralSecurityException

WEBsina Software