Package kz.greetgo.security.crypto
Class CryptoBridge
- java.lang.Object
-
- kz.greetgo.security.crypto.CryptoBridge
-
-
Field Summary
Fields Modifier and Type Field Description static CryptoTracetrace
-
Constructor Summary
Constructors Constructor Description CryptoBridge(CryptoSource cryptoSource)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]decrypt(byte[] encryptedBytes)Decrypt encrypted data using private keybyte[]decryptBlock(byte[] encryptedBytes)Decrypt encrypted data using private keybyte[]encrypt(byte[] bytes)Encrypt data using public keybyte[]encryptBlock(byte[] bytes)Encrypt data using public keybyte[]makeHash(byte[] sourceBytes)Generate hashjava.security.SecureRandomrnd()Gives security random generatorbyte[]sign(byte[] bytes)Sign databooleanverifySignature(byte[] bytes, byte[] signature)Verifies signature
-
-
-
Field Detail
-
trace
public static CryptoTrace trace
-
-
Constructor Detail
-
CryptoBridge
public CryptoBridge(CryptoSource cryptoSource)
-
-
Method Detail
-
encryptBlock
public byte[] encryptBlock(byte[] bytes)
Description copied from interface:CryptoEncrypt data using public keyMax number of bytes is limited by
CryptoSource.getBlockSize()- Specified by:
encryptBlockin interfaceCrypto- Parameters:
bytes- data to encrypt- Returns:
- encrypted data
-
decryptBlock
public byte[] decryptBlock(byte[] encryptedBytes)
Description copied from interface:CryptoDecrypt encrypted data using private keyEncryption must be made by method
Crypto.encryptBlock(byte[])- Specified by:
decryptBlockin interfaceCrypto- Parameters:
encryptedBytes- encrypted data- Returns:
- decrypted (original) data
-
encrypt
public byte[] encrypt(byte[] bytes)
Description copied from interface:CryptoEncrypt data using public key
-
decrypt
public byte[] decrypt(byte[] encryptedBytes)
Description copied from interface:CryptoDecrypt encrypted data using private keyEncryption must be made by method
Crypto.encrypt(byte[])
-
sign
public byte[] sign(byte[] bytes)
Description copied from interface:CryptoSign data
-
verifySignature
public boolean verifySignature(byte[] bytes, byte[] signature)Description copied from interface:CryptoVerifies signature- Specified by:
verifySignaturein interfaceCrypto- Parameters:
bytes- checking datasignature- verifying signature- Returns:
- verification result:
true- verification is OK, otherwise - verification wrong
-
makeHash
public byte[] makeHash(byte[] sourceBytes)
Description copied from interface:CryptoGenerate hash
-
-