Class McEliecePKCSCipherSpi

    • Constructor Detail

      • McEliecePKCSCipherSpi

        public McEliecePKCSCipherSpi​(McElieceCipher cipher)
    • Method Detail

      • initCipherEncrypt

        protected void initCipherEncrypt​(java.security.Key key,
                                         java.security.spec.AlgorithmParameterSpec params,
                                         java.security.SecureRandom sr)
                                  throws java.security.InvalidKeyException,
                                         java.security.InvalidAlgorithmParameterException
        Description copied from class: AsymmetricBlockCipher
        Initialize the AsymmetricBlockCipher with a certain key for data encryption.
        Specified by:
        initCipherEncrypt in class AsymmetricBlockCipher
        Parameters:
        key - the key which has to be used to encrypt data
        params - the algorithm parameters
        sr - the source of randomness
        Throws:
        java.security.InvalidKeyException - if the given key is inappropriate for initializing this cipher.
        java.security.InvalidAlgorithmParameterException - if the given parameters are inappropriate for initializing this cipher.
      • initCipherDecrypt

        protected void initCipherDecrypt​(java.security.Key key,
                                         java.security.spec.AlgorithmParameterSpec params)
                                  throws java.security.InvalidKeyException,
                                         java.security.InvalidAlgorithmParameterException
        Description copied from class: AsymmetricBlockCipher
        Initialize the AsymmetricBlockCipher with a certain key for data encryption.
        Specified by:
        initCipherDecrypt in class AsymmetricBlockCipher
        Parameters:
        key - the key which has to be used to decrypt data
        params - the algorithm parameters
        Throws:
        java.security.InvalidKeyException - if the given key is inappropriate for initializing this cipher
        java.security.InvalidAlgorithmParameterException - if the given parameters are inappropriate for initializing this cipher.
      • messageEncrypt

        protected byte[] messageEncrypt​(byte[] input)
                                 throws javax.crypto.IllegalBlockSizeException,
                                        javax.crypto.BadPaddingException
        Description copied from class: AsymmetricBlockCipher
        Encrypt the message stored in input. The method should also perform an additional length check.
        Specified by:
        messageEncrypt in class AsymmetricBlockCipher
        Parameters:
        input - the message to be encrypted (usually the message length is less than or equal to maxPlainTextSize)
        Returns:
        the encrypted message (it has length equal to maxCipherTextSize_)
        Throws:
        javax.crypto.IllegalBlockSizeException - if the input is inappropriate for this cipher.
        javax.crypto.BadPaddingException - if the input format is invalid.
      • messageDecrypt

        protected byte[] messageDecrypt​(byte[] input)
                                 throws javax.crypto.IllegalBlockSizeException,
                                        javax.crypto.BadPaddingException
        Description copied from class: AsymmetricBlockCipher
        Decrypt the ciphertext stored in input. The method should also perform an additional length check.
        Specified by:
        messageDecrypt in class AsymmetricBlockCipher
        Parameters:
        input - the ciphertext to be decrypted (the ciphertext length is less than or equal to maxCipherTextSize)
        Returns:
        the decrypted message
        Throws:
        javax.crypto.IllegalBlockSizeException - if the input is inappropriate for this cipher.
        javax.crypto.BadPaddingException - if the input format is invalid.
      • getName

        public java.lang.String getName()
        Specified by:
        getName in class CipherSpiExt
        Returns:
        the name of this cipher
      • getKeySize

        public int getKeySize​(java.security.Key key)
                       throws java.security.InvalidKeyException
        Description copied from class: CipherSpiExt
        Return the key size of the given key object in bits.
        Specified by:
        getKeySize in class CipherSpiExt
        Parameters:
        key - the key object
        Returns:
        the key size in bits of the given key object
        Throws:
        java.security.InvalidKeyException - if key is invalid.