Class PKCS1Util


  • public class PKCS1Util
    extends Object
    PKCS#1 utility class.
    Since:
    5.3.14
    Author:
    Lijun Liao (xipki)
    • Constructor Detail

      • PKCS1Util

        public PKCS1Util()
    • Method Detail

      • EMSA_PSS_DECODE

        public static boolean EMSA_PSS_DECODE​(HashAlgo mgfDigest,
                                              byte[] mHash,
                                              byte[] EM,
                                              int sLen,
                                              int modulusBitLength)

        The decoding operation EMSA-PSS-Decode recovers the message hash from an encoded message EM and compares it to the hash of M.

        Parameters:
        mgfDigest - The MGF digest.
        mHash - the byte sequence resulting from applying the message digest algorithm Hash to the message M.
        EM - the encoded message, an octet string of length emLen = CEILING(emBits/8).
        sLen - the length, in octets, of the expected salt.
        modulusBitLength - bit length of the RSA modulus.
        Returns:
        true if the result of the verification was consistent with the expected result; and false if the result was inconsistent.
        Throws:
        IllegalArgumentException - if an exception occurs.
      • getDigestPkcsPrefix

        public static byte[] getDigestPkcsPrefix​(HashAlgo hashAlgo)
      • RSAES_OAEP_ENCODE

        public static byte[] RSAES_OAEP_ENCODE​(byte[] M,
                                               int modulusBigLength,
                                               HashAlgo hashAlgo,
                                               SecureRandom random)
      • RSAES_OAEP_DECODE

        public static byte[] RSAES_OAEP_DECODE​(byte[] EM,
                                               int modulusBigLength,
                                               HashAlgo hashAlgo)