Class KeyGenerator
java.lang.Object
com.codename1.security.KeyGenerator
Generates fresh cryptographic key material. AES keys are pulled directly
from SecureRandom; RSA key pairs are generated by the platform's native
crypto provider.
Example
SecretKey aes = KeyGenerator.aes(256); // AES-256
KeyPair rsa = KeyGenerator.rsa(2048); // RSA-2048
-
Method Summary
-
Method Details
-
aes
Generates a fresh AES key of the given bit length. Valid lengths are 128, 192 and 256 bits. -
hmac
Generates a fresh HMAC key of the given bit length. By convention, HMAC keys should be at least as long as the hash output. -
rsa
Generates a fresh RSA key pair of the given size in bits. 2048 is the modern minimum; 3072 / 4096 for higher security margins. Generating a 4096-bit RSA key can take several seconds -- call from a background thread.
-