Class PortCryptoEngine

java.lang.Object
com.codename1.security.CryptoEngine
com.codename1.security.PortCryptoEngine

public class PortCryptoEngine extends CryptoEngine
The client's default CryptoEngine: PBKDF2 goes to the port's native derivation (CodenameOneImplementation.pbkdf2(String, byte[], byte[], int, int)), everything else runs in Java, and the asynchronous CryptoBatch calls answer on the EDT. A port with more native kernels subclasses it.
  • Constructor Details

    • PortCryptoEngine

      public PortCryptoEngine(com.codename1.impl.CodenameOneImplementation impl)

      Creates the engine over a port.

      Parameters
      • impl: the port whose native derivation PBKDF2 uses
  • Method Details

    • randomBytes

      public boolean randomBytes(byte[] out)
      Description copied from class: CryptoEngine
      Fills out with bytes from the platform's CSPRNG, answering false when this engine has no source. Every installed engine has one: the client's draws on the port, the backend's on the server runtime.
      Overrides:
      randomBytes in class CryptoEngine
    • deliver

      public void deliver(Runnable result)
      Runs the callback of an asynchronous CryptoBatch call on the EDT.
      Overrides:
      deliver in class CryptoEngine
    • pbkdf2

      public byte[] pbkdf2(String hashAlgorithm, byte[] password, byte[] salt, int iterations, int length)
      Description copied from class: CryptoEngine
      PBKDF2 (RFC 8018) with HMAC over hashAlgorithm (Hash.SHA256 or Hash.SHA512), or null to use the Java derivation. The arguments are already validated.
      Overrides:
      pbkdf2 in class CryptoEngine