Note
RSA keys should be at least 512 bits long
Modifier and Type | Field and Description |
---|---|
private static final Map | |
private byte[] | |
private final int | |
private MGF1 | |
public static final int | |
public static final int | |
public static final int | |
public static final int | |
private final int | |
private SecureRandom | |
private final int |
Access | Constructor and Description |
---|---|
private |
Modifier and Type | Method and Description |
---|---|
private static byte[] | getInitialHash(MessageDigest md, byte[] digestInput)
Return the value of the digest using the specified message digest
|
public static RSAPadding | |
public static RSAPadding | getInstance(int type, int paddedSize, SecureRandom random)
Get a RSAPadding instance of the specified type. |
public static RSAPadding | getInstance(int type, int paddedSize, SecureRandom random, OAEPParameterSpec spec)
Get a RSAPadding instance of the specified type, which must be OAEP. |
public int | getMaxDataSize()
Return the maximum size of the plaintext data that can be processed using this object. |
public byte[] | |
public byte[] | |
private byte[] | |
private byte[] | |
public byte[] | |
private byte[] | |
private byte[] |
emptyHashes | back to summary |
---|---|
private static final Map<String, byte[]> emptyHashes |
lHash | back to summary |
---|---|
private byte[] lHash |
maxDataSize | back to summary |
---|---|
private final int maxDataSize |
mgf | back to summary |
---|---|
private MGF1 mgf |
PAD_BLOCKTYPE_1 | back to summary |
---|---|
public static final int PAD_BLOCKTYPE_1 |
PAD_BLOCKTYPE_2 | back to summary |
---|---|
public static final int PAD_BLOCKTYPE_2 |
PAD_NONE | back to summary |
---|---|
public static final int PAD_NONE |
PAD_OAEP_MGF1 | back to summary |
---|---|
public static final int PAD_OAEP_MGF1 |
paddedSize | back to summary |
---|---|
private final int paddedSize |
random | back to summary |
---|---|
private SecureRandom random |
type | back to summary |
---|---|
private final int type |
RSAPadding | back to summary |
---|---|
private RSAPadding(int type, int paddedSize, SecureRandom random, OAEPParameterSpec spec) throws InvalidKeyException, InvalidAlgorithmParameterException |
getInitialHash | back to summary |
---|---|
private static byte[] getInitialHash(MessageDigest md, byte[] digestInput) Return the value of the digest using the specified message digest
Note the md object must be in reset state |
getInstance | back to summary |
---|---|
public static RSAPadding getInstance(int type, int paddedSize) throws InvalidKeyException, InvalidAlgorithmParameterException Get a RSAPadding instance of the specified type. Keys used with this padding must be paddedSize bytes long. |
getInstance | back to summary |
---|---|
public static RSAPadding getInstance(int type, int paddedSize, SecureRandom random) throws InvalidKeyException, InvalidAlgorithmParameterException Get a RSAPadding instance of the specified type. Keys used with this padding must be paddedSize bytes long. |
getInstance | back to summary |
---|---|
public static RSAPadding getInstance(int type, int paddedSize, SecureRandom random, OAEPParameterSpec spec) throws InvalidKeyException, InvalidAlgorithmParameterException Get a RSAPadding instance of the specified type, which must be OAEP. Keys used with this padding must be paddedSize bytes long. |
getMaxDataSize | back to summary |
---|---|
public int getMaxDataSize() Return the maximum size of the plaintext data that can be processed using this object. |
pad | back to summary |
---|---|
public byte[] pad(byte[] data) Pad the data and return the result or null if error occurred. |
pad | back to summary |
---|---|
public byte[] pad(byte[] data, int ofs, int len) Pad the data and return the result or null if error occurred. |
padOAEP | back to summary |
---|---|
private byte[] padOAEP(byte[] M, int ofs, int len) PKCS#1 v2.0 OAEP padding (MGF1). Paragraph references refer to PKCS#1 v2.1 (June 14, 2002) Return the result or null if error occurred. |
padV15 | back to summary |
---|---|
private byte[] padV15(byte[] data, int ofs, int len) PKCS#1 v1.5 padding (blocktype 1 and 2). |
unpad | back to summary |
---|---|
public byte[] unpad(byte[] padded) Unpad the padded block and return the result or null if error occurred. |
unpadOAEP | back to summary |
---|---|
private byte[] unpadOAEP(byte[] padded) PKCS#1 v2.1 OAEP unpadding (MGF1). Return the result or null if error occurred. |
unpadV15 | back to summary |
---|---|
private byte[] unpadV15(byte[] padded) PKCS#1 v1.5 unpadding (blocktype 1 (signature) and 2 (encryption)). Return the result or null if error occurred. Note that we want to make it a constant-time operation |