Class PublicKey

java.lang.Object
com.codename1.security.Key
com.codename1.security.PublicKey

public final class PublicKey extends Key

A public key -- paired with a PrivateKey to form a key pair. Carries the algorithm name ("RSA" or "EC") and the encoded key bytes.

For interop with PEM files (-----BEGIN PUBLIC KEY-----) feed the X.509-SubjectPublicKeyInfo (SPKI) DER bytes to fromX509(String, byte[]); for raw RSA modulus/exponent use rsa(byte[]).

  • Field Details

  • Method Details

    • fromX509

      public static PublicKey fromX509(String algorithm, byte[] x509Der)
      Wraps an X.509 / SubjectPublicKeyInfo (SPKI) DER blob. This is the format produced by openssl rsa -pubout or openssl ec -pubout.
    • rsa

      public static PublicKey rsa(byte[] x509Der)
      Convenience: build an RSA PublicKey from a fromX509(String, byte[]) X.509 blob.