Package org.xipki.security.util
Class PKCS1Util
- java.lang.Object
-
- org.xipki.security.util.PKCS1Util
-
public class PKCS1Util extends Object
PKCS#1 utility class.- Since:
- 5.3.14
- Author:
- Lijun Liao (xipki)
-
-
Constructor Summary
Constructors Constructor Description PKCS1Util()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static byte[]EMSA_PKCS1_v1_5_encoding(byte[] encodedDigestInfo, int modulusBigLength)static byte[]EMSA_PKCS1_v1_5_encoding(byte[] hashValue, int modulusBigLength, HashAlgo hashAlgo)static booleanEMSA_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 messageEMand compares it to the hash ofM.static byte[]EMSA_PSS_ENCODE(HashAlgo contentDigest, byte[] hashValue, HashAlgo mgfDigest, int saltLen, int modulusBitLength, SecureRandom random)static byte[]getDigestPkcsPrefix(HashAlgo hashAlgo)static byte[]RSAES_OAEP_DECODE(byte[] EM, int modulusBigLength, HashAlgo hashAlgo)static byte[]RSAES_OAEP_ENCODE(byte[] M, int modulusBigLength, HashAlgo hashAlgo, SecureRandom random)
-
-
-
Method Detail
-
EMSA_PKCS1_v1_5_encoding
public static byte[] EMSA_PKCS1_v1_5_encoding(byte[] hashValue, int modulusBigLength, HashAlgo hashAlgo) throws XiSecurityException- Throws:
XiSecurityException
-
EMSA_PKCS1_v1_5_encoding
public static byte[] EMSA_PKCS1_v1_5_encoding(byte[] encodedDigestInfo, int modulusBigLength) throws XiSecurityException- Throws:
XiSecurityException
-
EMSA_PSS_ENCODE
public static byte[] EMSA_PSS_ENCODE(HashAlgo contentDigest, byte[] hashValue, HashAlgo mgfDigest, int saltLen, int modulusBitLength, SecureRandom random) throws XiSecurityException
- Throws:
XiSecurityException
-
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
EMand compares it to the hash ofM.- 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)
-
-