Class OAEPEncoding

    • Field Detail

      • defHash

        private byte[] defHash
      • random

        private java.security.SecureRandom random
      • forEncryption

        private boolean forEncryption
    • Method Detail

      • init

        public void init​(boolean forEncryption,
                         CipherParameters param)
        Description copied from interface: AsymmetricBlockCipher
        initialise the cipher.
        Specified by:
        init in interface AsymmetricBlockCipher
        Parameters:
        forEncryption - if true the cipher is initialised for encryption, if false for decryption.
        param - the key and other data required by the cipher.
      • getOutputBlockSize

        public int getOutputBlockSize()
        Description copied from interface: AsymmetricBlockCipher
        returns the maximum size of the block produced by this cipher.
        Specified by:
        getOutputBlockSize in interface AsymmetricBlockCipher
        Returns:
        maximum size of the output block produced by the cipher.
      • processBlock

        public byte[] processBlock​(byte[] in,
                                   int inOff,
                                   int inLen)
                            throws InvalidCipherTextException
        Description copied from interface: AsymmetricBlockCipher
        process the block of len bytes stored in in from offset inOff.
        Specified by:
        processBlock in interface AsymmetricBlockCipher
        Parameters:
        in - the input data
        inOff - offset into the in array where the data starts
        inLen - the length of the block to be processed.
        Returns:
        the resulting byte array of the encryption/decryption process.
        Throws:
        InvalidCipherTextException - data decrypts improperly.
      • ItoOSP

        private void ItoOSP​(int i,
                            byte[] sp)
        int to octet string.
      • maskGeneratorFunction1

        private byte[] maskGeneratorFunction1​(byte[] Z,
                                              int zOff,
                                              int zLen,
                                              int length)
        mask generator function, as described in PKCS1v2.