iaik.pkcs.pkcs1
Class RSAOaepPSourceParameterSpec
java.lang.Object
|
+--iaik.pkcs.pkcs1.PKCS1AlgorithmParameterSpec
|
+--iaik.pkcs.pkcs1.RSAOaepPSourceParameterSpec
- All Implemented Interfaces:
- AlgorithmParameterSpec
- Direct Known Subclasses:
- RSAOaepParameterSpec
- public class RSAOaepPSourceParameterSpec
- extends PKCS1AlgorithmParameterSpec
Parameter specification to may be used for specifying the
PSourceAlgorithm parameter for the PKCS#1v2.1 RSAES-OAEP encryption algorithm.
According PKCS#1v2.1
RSASES-OAEP
parameters consist
of hash algorithm id, mask generation function id, and PSourceAlgorithm:
RSASES-OAEP-params :: = SEQUENCE {
hashAlgorithm [0] HashAlgorithm DEFAULT sha1,
maskGenerationAlgorithm [1] MaskGenAlgorithm DEFAULT mgf1SHA1,
pSourceAlgorithm [2] PSourceAlgorithm DEFAULT pSpecifiedEmpty,
}
HashAlgorithm ::= AlgorithmIdentifer { {OAEP-PSSDigestAlgorithms} }
MaskGenAlgorithm ::= AlgorithmIdentifier { {PKCS1MGFAlgorithms} }
PSourceAlgorithm ::= AlgorithmIdentifier { {PKCS1PSourceAlgorithms} }
By default OAEP uses SHA-1 as hash function, MGF1 (with SHA-1 as hash function
parameter) as mask generation algorithm, and id-pSpecified as PSourceAlgorithm
(with an empty OCTET STRING as parameter).
The Java Cryptography Extensions (JCE), however, only may allow
to set the PSourceAlgorithm as parameter. All other parameters are
specified by the padding name of the transformation string when instantiating
a RSA Cipher engine, e.g.:
Cipher cipher = Cipher.getInstance("RSA/ECB/OAEPWithSHA1AndMGF1Padding");
RSAOaepPSourceParameterSpec paramSpec = new RSAOaepPSourceParameterSpec((AlgorithmID)AlgorithmID.pSpecified.clone());
byte[] label = ...;
paramSpec.setLabel(label);
rsa.init(Cipher.ENCRYPT_MODE, publicKey, paramSpec);
byte[] encrypted = rsa.doFinal(data);
An OAEP padding scheme that implements the, for instance,
"OAEPWithSHA1AndMGF1Padding" (in general: OAEPWith<digest>And<mgf>Padding)
has to use SHA-1 as hash- and MGF1 as mask generation algorithm.
- Version:
- File Revision 9
DEFAULT_PSOURCE_ALGORITHM
public static final AlgorithmID DEFAULT_PSOURCE_ALGORITHM
- Default PSourceAlgorithm (id-pSpecified).
pSourceAlgorithm_
protected AlgorithmID pSourceAlgorithm_
- PSourceAlgorithm.
RSAOaepPSourceParameterSpec
public RSAOaepPSourceParameterSpec(AlgorithmID pSourceAlgorithm)
- Creates a RSAOaepPSourceParameterSpec for the given PSourceAlgorithm.
- Parameters:
pSourceAlgorithm
- the PSourceAlgorithm to be used.- Throws:
IllegalArgumentException
- pSourceAlgorithm is null
getDefault
public static RSAOaepPSourceParameterSpec getDefault()
- Creates a RSAOaepPSourceParameterSpec with the default PSourceAlgorithm
id-pSpecified with empty OCTET STRING parameter.
- Returns:
- the default RSAOaepPSourceParameterSpec
getPSourceAlgorithm
public AlgorithmID getPSourceAlgorithm()
- Gets the PSourceAlgorithm.
- Returns:
- the PSourceAlgorithm
getLabel
public byte[] getLabel()
- Returns the value of the label parameter, if set.
- Returns:
- the value (maybe an empty byte array) of the label parameter, if included;
otherwise
null
setLabel
public void setLabel(byte[] label)
- Sets the value of the label parameter.
- Parameters:
label
- the value of the label parameter- Throws:
NullPointerException
- if the PSourceAlgorithm is not set
toString
public String toString()
- Gets a String representation of this RSAOaepPSourceParameterSpec.
- Overrides:
toString
in class Object
- Returns:
- a string representation of this RSAOaepPSourceParameterSpec
|
This Javadoc may contain text parts from Internet Standard specifications (RFC 2459, 3280, 3039, 2560, 1521, 821, 822, 2253, 1319, 1321, ,2630, 2631, 2268, 3058, 2984, 2104, 2144, 2040, 2311, 2279, see copyright note) and RSA Data Security Public-Key Cryptography Standards (PKCS#1,3,5,7,8,9,10,12, see copyright note).
|
PREV CLASS
NEXT CLASS |
FRAMES
NO FRAMES |
SUMMARY: INNER | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD |
IAIK-JCE 3.1 with IAIK-JCE CC Core 3.1, (c) 1997-2004 IAIK