Class CryptoKeys.RSAKeyPair

  • Enclosing class:
    CryptoKeys

    public static class CryptoKeys.RSAKeyPair
    extends Object
    • Constructor Detail

      • RSAKeyPair

        public RSAKeyPair()
        Create an RSA key pair with newly generated keys.
      • RSAKeyPair

        public RSAKeyPair​(URL privateKeyResourceName,
                          URL publicKeyResourceName)
                   throws IOException,
                          InvalidKeySpecException
        Initialize an RSA key pair from previously saved keys. The formats listed below have been tested, other formats may also be acceptable but are not guaranteed to work.
        Parameters:
        privateKeyResourceName - path to private key file, encoded as a PKCS#8 in a PEM file
        publicKeyResourceName - path to public key file, encoded as X509 in a DER file
        Throws:
        IOException - if an I/O error occurs reading either key file
        InvalidKeySpecException - if either key file is inappropriate for an RSA key
    • Method Detail

      • getPublicKeyStr

        public String getPublicKeyStr()
      • getPublicKey

        public PublicKey getPublicKey()
      • encrypt

        public byte[] encrypt​(ByteBuffer buffer)
      • signSha256

        public byte[] signSha256​(byte[] bytes)