Interface Crypto

All Known Implementing Classes:
CryptoBridge

public interface Crypto

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 CryptoBuilder

  • Method Summary

    Modifier and Type Method Description
    byte[] decrypt​(byte[] encryptedBytes)
    Decrypt encrypted data using private key
    byte[] encrypt​(byte[] bytes)
    Encrypt data using public key
    byte[] makeHash​(byte[] sourceBytes)
    Generate hash
    java.security.SecureRandom rnd()
    Gives security random generator
    byte[] sign​(byte[] bytes)
    Sign data
    boolean verifySignature​(byte[] bytes, byte[] signature)
    Verifies signature
  • Method Details

    • encrypt

      byte[] encrypt​(byte[] bytes)
      Encrypt data using public key
      Parameters:
      bytes - data to encrypt
      Returns:
      encrypted data
    • decrypt

      byte[] decrypt​(byte[] encryptedBytes)
      Decrypt encrypted data using private key
      Parameters:
      encryptedBytes - encrypted data
      Returns:
      decrypted (original) data
    • sign

      byte[] sign​(byte[] bytes)
      Sign data
      Parameters:
      bytes - the data to sign
      Returns:
      signature
    • verifySignature

      boolean verifySignature​(byte[] bytes, byte[] signature)
      Verifies signature
      Parameters:
      bytes - checking data
      signature - verifying signature
      Returns:
      verification result: true - verification is OK, otherwise - verification wrong
    • rnd

      java.security.SecureRandom rnd()
      Gives security random generator
      Returns:
      security random generator
    • makeHash

      byte[] makeHash​(byte[] sourceBytes)
      Generate hash
      Parameters:
      sourceBytes - source data
      Returns:
      hash