|
CIC iSign Version 1.2 | ||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||
java.lang.Object | +--InkTools.CicHash
CIC's implementation of the Secure Hash Algorithm (SHA) to produce a message digest. The message digest or hashing is used for binding, creating 'digital signatures' and other cryptographic applications in general.
Binding a signature to a document can be done through generating a common message digest from the document and the signature (see CicDoodle.streamOut). Then the document, signature and message digest can be stored into one object or as several objects. If the document or signature gets manipulated, the resulting message digest would change. To verify if a document with the attached signature is unaltered, create a new message digest of both and then compare it to the saved original message digest. If they match, document and signature are unaltered. If the digest are different, it can be assumed that these are manipulated.
To secure that the original message digest gets not replaced with a message digest of the altered document/signature, the message digest should be encrypted and than stored. Use the 'getEncryptedHashValue' and 'decryptHashValue' for that purpose.
| Constructor Summary | |
CicHash()
Constructs a Cichash object. |
|
CicHash(byte[] buffer)
Constructor for a whole hash session. |
|
| Method Summary | |
void |
addHash(byte[] buf)
Adds a byte array to the current hashing session |
void |
addHash(java.lang.String str)
Adds a String to the current hashing session. |
boolean |
compareHash(byte[] hash1,
byte[] hash2)
compares 2 CIC's SHS 20 byte long hash arrays |
boolean |
compareHash(int[] hash1,
int[] hash2)
compares 2 CIC's SHS 5 integer long hash arrays |
java.lang.String |
createEncryptionKeyFromPhrase(java.lang.String phrase,
int keyLength)
Creates a 8 character or 24 character string from a phrase with any length. |
int[] |
decryptHashValue(int[] encHash,
java.lang.String key)
Decrypts an priviously encrypted hash value and returns the original hash value in an array of 5 integer. |
void |
finishHash()
Finishs the current hashing session. |
int[] |
getEncryptedHashValue(java.lang.String key)
Encrypts the hashing value and returns it in an array of 8 intergers. |
int[] |
getHashValue()
Returns the hashing value from the last hashing session in an array of 5 integers. |
byte[] |
getHashValueBytes()
Returns the hashing value from the last hashing session in an array od 20 bytes. |
void |
initHash()
Initializes a new hashing session. |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public CicHash()
public CicHash(byte[] buffer)
buffer - the byte array from which to calculate the hash value| Method Detail |
public void initHash()
public void addHash(java.lang.String str)
str - the string to be added to the current hashing sessionpublic void addHash(byte[] buf)
buf - Byte buffer to be added to the current hashing session.public void finishHash()
public int[] getHashValue()
public byte[] getHashValueBytes()
public int[] getEncryptedHashValue(java.lang.String key)
key - the encryption key used to encrypt the hash value, must
be 8 characters long
public int[] decryptHashValue(int[] encHash,
java.lang.String key)
encHash - an interger array with the encryped hash valuekey - the key to decrypt the hash value
public boolean compareHash(int[] hash1,
int[] hash2)
hash1 - 5 interger hash arrayhash2 - 5 interger hash array
public boolean compareHash(byte[] hash1,
byte[] hash2)
hash1 - 20 byte hash arrayhash2 - 20 byte hash array
public java.lang.String createEncryptionKeyFromPhrase(java.lang.String phrase,
int keyLength)
phrase - a string from which an encryption key should be build fromkeyLength - 8 for 8 byte key, 24 for 24 byte key
|
CIC iSign Version 1.2 | ||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||