Client API. The Codename One framework your app is built on: this runs on the device, not in a backend.
public class PortCryptoEngine
- Object
- CryptoEngine
- PortCryptoEngine
The client’s default
CryptoEngine: PBKDF2 goes to the port’s native
derivation (CodenameOneImplementation.pbkdf2), everything else runs
in Java, and the asynchronous CryptoBatch calls answer on the EDT. A port with more native kernels subclasses it.Constructors
public PortCryptoEngine(CodenameOneImplementation impl) | Creates the engine over a port. |
Methods
public boolean randomBytes(byte[] out) | Fills out with bytes from the platform’s CSPRNG, answering false when this engine has no source. |
public void deliver(Runnable result) | Runs the callback of an asynchronous CryptoBatch call on the EDT. |
public byte[] pbkdf2(String hashAlgorithm, byte[] password, byte[] salt, int iterations, int length) | PBKDF2 (RFC 8018) with HMAC over hashAlgorithm (Hash.SHA256 or Hash.SHA512), or null to use the Java derivation. |
Inherited fields
Inherited methods
From CryptoEngine
get, install, random, ed25519PublicKey, ed25519Sign, ed25519Verify, secpPublicKey, secpSign, secpVerify, secpRecover, secpPrivateKeyTweakAdd, secpPublicKeyTweakAdd, schnorrPublicKey, schnorrSign, schnorrVerify, keccak256, verifyBatch, runInBackground, gpuRecordWords, gpuRecord, verifyPacked, hashPacked, hashBatch, sha256, sha512, ripemd160, hmac
Constructor details
PortCryptoEngine
public PortCryptoEngine(CodenameOneImplementation impl)Creates the engine over a port.
Parameters
implCodenameOneImplementation- the port whose native derivation PBKDF2 uses
Method details
randomBytes
public boolean randomBytes(byte[] out)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.deliver
public void deliver(Runnable result)Runs the callback of an asynchronous
CryptoBatch call on the EDT.Parameters
resultRunnable- the call to the application’s callback
pbkdf2
public byte[] pbkdf2(String hashAlgorithm, byte[] password, byte[] salt, int iterations, int length)PBKDF2 (RFC 8018) with HMAC over
hashAlgorithm (Hash.SHA256 or
Hash.SHA512), or null to use the Java derivation. The arguments
are already validated.