Class Signature
java.lang.Object
com.codename1.security.Signature
Digital signature creation and verification. Backed by the platform's
native crypto provider -- works with PublicKey / PrivateKey objects
from this package.
Example: sign with RSA-SHA-256 and verify
KeyPair kp = KeyGenerator.rsa(2048);
byte[] sig = Signature.sign(Signature.SHA256_WITH_RSA, kp.getPrivateKey(), data);
boolean ok = Signature.verify(Signature.SHA256_WITH_RSA, kp.getPublicKey(), data, sig);
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringSHA256withECDSA-- ECDSA with SHA-256 (P-256 curve).static final StringSHA256withRSA-- RSA PKCS#1 v1.5 with SHA-256.static final StringSHA384withECDSA-- ECDSA with SHA-384 (P-384 curve).static final StringSHA384withRSA-- RSA PKCS#1 v1.5 with SHA-384.static final StringSHA512withECDSA-- ECDSA with SHA-512 (P-521 curve).static final StringSHA512withRSA-- RSA PKCS#1 v1.5 with SHA-512. -
Method Summary
Modifier and TypeMethodDescriptionstatic byte[]sign(String algorithm, PrivateKey key, byte[] data) Signsdatawith the given algorithm and private key.static booleanVerifiessignatureagainstdatausing the given algorithm and public key.
-
Field Details
-
SHA256_WITH_RSA
-
SHA384_WITH_RSA
-
SHA512_WITH_RSA
-
SHA256_WITH_ECDSA
SHA256withECDSA-- ECDSA with SHA-256 (P-256 curve).- See Also:
-
SHA384_WITH_ECDSA
SHA384withECDSA-- ECDSA with SHA-384 (P-384 curve).- See Also:
-
SHA512_WITH_ECDSA
SHA512withECDSA-- ECDSA with SHA-512 (P-521 curve).- See Also:
-
-
Method Details
-
sign
Signsdatawith the given algorithm and private key. -
verify
-