|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.smardec.license4j.LicenseUtil
Provides utility methods for generating key pair and for signing arbitrary user content.
Method Summary | |
static java.lang.String[] |
createKeyPair()
Creates key pair and and returns it as an array of strings. |
static void |
createKeyPair(java.lang.String filename)
Creates key pair and saves it to the specified file. |
static void |
createKeyPair(java.io.Writer writer)
Creates key pair and saves it to the specified Writer . |
static java.lang.String |
sign(byte[] message,
java.lang.String privateKey)
The method allows to sign arbitrary content using private key. |
static java.lang.String |
sign(java.lang.String message,
java.lang.String privateKey)
The method allows to sign arbitrary content using private key. |
static boolean |
verify(byte[] message,
java.lang.String signature,
java.lang.String publicKey)
The method allows to verify the signature of the specified data using public key. |
static boolean |
verify(java.lang.String message,
java.lang.String signature,
java.lang.String publicKey)
The method allows to verify the signature of the specified data using public key. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
public static void createKeyPair(java.lang.String filename)
filename
- name of the filepublic static void createKeyPair(java.io.Writer writer)
Writer
.
Note that Writer.close()
method is not invoked after writing the keys.
writer
- Writer
that will contain public and private keyspublic static java.lang.String[] createKeyPair()
public static java.lang.String sign(java.lang.String message, java.lang.String privateKey) throws java.security.GeneralSecurityException
verify(String, String, String)
.
message
- data to signprivateKey
- private key
java.security.GeneralSecurityException
- if errors occured during signingpublic static java.lang.String sign(byte[] message, java.lang.String privateKey) throws java.security.GeneralSecurityException
verify(String, String, String)
.
message
- data to signprivateKey
- private key
java.security.GeneralSecurityException
- if errors occured during signingpublic static boolean verify(java.lang.String message, java.lang.String signature, java.lang.String publicKey) throws java.security.GeneralSecurityException
sign(String, String)
.
message
- signed datasignature
- data's signaturepublicKey
- public key
true
if the signature was verified, false
otherwise.
java.security.GeneralSecurityException
- if errors occured during verification processpublic static boolean verify(byte[] message, java.lang.String signature, java.lang.String publicKey) throws java.security.GeneralSecurityException
sign(String, String)
.
message
- signed datasignature
- data's signaturepublicKey
- public key
true
if the signature was verified, false
otherwise.
java.security.GeneralSecurityException
- if errors occured during verification process
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |