Class RsaEncrypter

  • All Implemented Interfaces:
    Encrypter

    public class RsaEncrypter
    extends java.lang.Object
    implements Encrypter
    RSA blocks encrypter implementation.
    • Constructor Summary

      Constructors 
      Constructor Description
      RsaEncrypter​(java.lang.String algorithm, int blockSize, java.security.PublicKey encryptionKey)
      Creates an rsa encrypter for the specified key, using specific encryption algorithms.
      RsaEncrypter​(java.security.PublicKey encryptionKey)
      Creates an rsa encrypter for the specified public key, using default encryption algorithms.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String encrypt​(java.lang.String text)
      Encripts the specified payload.
      java.lang.String getAlgorithm()
      Returns the algorithm name of the encrypter.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • RsaEncrypter

        public RsaEncrypter​(java.security.PublicKey encryptionKey)
        Creates an rsa encrypter for the specified public key, using default encryption algorithms.
        Parameters:
        encryptionKey - the public key to be used for encryption
      • RsaEncrypter

        public RsaEncrypter​(java.lang.String algorithm,
                            int blockSize,
                            java.security.PublicKey encryptionKey)
        Creates an rsa encrypter for the specified key, using specific encryption algorithms.
        Parameters:
        algorithm - the rsa encryption algorithm
        blockSize - the block size
        encryptionKey - the public key to be used for encryption
    • Method Detail

      • getAlgorithm

        public java.lang.String getAlgorithm()
        Description copied from interface: Encrypter
        Returns the algorithm name of the encrypter.
        Specified by:
        getAlgorithm in interface Encrypter
        Returns:
        the name of the algorithm
      • encrypt

        public java.lang.String encrypt​(java.lang.String text)
        Description copied from interface: Encrypter
        Encripts the specified payload.
        Specified by:
        encrypt in interface Encrypter
        Parameters:
        text - the payload to be encrypted
        Returns:
        ciphertext