All Downloads are FREE. Search and download functionalities are using the official Maven repository.

kz.greetgo.security.crypto.Crypto Maven / Gradle / Ivy

There is a newer version: 0.0.12
Show newest version
package kz.greetgo.security.crypto;

import java.security.SecureRandom;

/**
 * 

* Encrypt and decrypt data. Sign and verify signature of data. Random generation. *

*

* Key pair will generate automatically and saved into key storage on first using *

*

* To create implementation use {@link CryptoBuilder} *

*/ public interface Crypto { /** * Encrypt data using public key * * @param bytes data to encrypt * @return entrypted data */ byte[] encrypt(byte[] bytes); /** * Decrypt encrypted data using private key * * @param encryptedBytes encrypted data * @return decrypted (original) data */ byte[] decrypt(byte[] encryptedBytes); /** * Sign data * * @param bytes the data to sign * @return signature */ byte[] sign(byte[] bytes); /** * Verifies signature * * @param bytes checking data * @param signature verifying signature * @return verification result: true - verification is OK, otherwise - verification wrong */ boolean verifySignature(byte[] bytes, byte[] signature); /** * Gives security random generator * * @return security random generator */ SecureRandom rnd(); }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy