public class RSAOAEPParameterSpec
extends java.lang.Object
implements java.security.spec.AlgorithmParameterSpec
This class is designed for use specifically with Entrust's RSA-OAEP implementation; it may not work with other vendors RSA-OAEP algorithm implementations.
This class represents
RSAES-OAEP-params ::= SEQUENCE {
hashAlgorithm [0] HashAlgorithm DEFAULT sha1,
maskGenAlgorithm [1] MaskGenAlgorithm DEFAULT mgf1SHA1,
pSourceAlgorithm [2] PSourceAlgorithm DEFAULT pSpecifiedEmpty
}
HashAlgorithm ::= AlgorithmIdentifier {
{OAEP-PSSDigestAlgorithms}
}
OAEP-PSSDigestAlgorithms ALGORITHM-IDENTIFIER ::= {
{ OID id-sha1 PARAMETERS NULL }|
{ OID id-sha224 PARAMETERS NULL }|
{ OID id-sha256 PARAMETERS NULL }|
{ OID id-sha384 PARAMETERS NULL }|
{ OID id-sha512 PARAMETERS NULL }|
... -- Allows for future expansion --
}
MaskGenAlgorithm ::= AlgorithmIdentifier { {PKCS1MGFAlgorithms} }
PKCS1MGFAlgorithms ALGORITHM-IDENTIFIER ::= {
{ OID id-mgf1 PARAMETERS HashAlgorithm },
... -- Allows for future expansion --
}
PSourceAlgorithm ::= AlgorithmIdentifier {
{PKCS1PSourceAlgorithms}
}
PKCS1PSourceAlgorithms ALGORITHM-IDENTIFIER ::= {
{ OID id-pSpecified PARAMETERS EncodingParameters },
... -- Allows for future expansion --
}
id-pSpecified OBJECT IDENTIFIER ::= { pkcs-1 9 }
EncodingParameters ::= OCTET STRING(SIZE(0..MAX))
| Constructor and Description |
|---|
RSAOAEPParameterSpec()
Creates an un-initialized
RSAOAEPParameterSpec. |
RSAOAEPParameterSpec(ASN1Object spec)
Creates an
RSAOAEPParameterSpec object from an
ASN1Object. |
RSAOAEPParameterSpec(RSAOAEPParameterSpec param)
The copy constructor; creates a deep copy of the provided RSA-OAEP
parameters.
|
| Modifier and Type | Method and Description |
|---|---|
ASN1Object |
getEncoded()
Encodes this
RSAOAEPParameterSpec object as an
ASN1Object. |
AlgorithmID |
getHashAlgorithm()
Returns the hash algorithm identifier.
|
AlgorithmID |
getMaskGenAlgorithm()
Returns the mask generation function algorithm identifier.
|
byte[] |
getPParameter()
Returns the P parameter octet.
|
AlgorithmID |
getPSource()
Returns the pSourceAlgorithm identifier.
|
void |
setHashAlgorithm(AlgorithmID algId)
This is used to set the hashAlgorithm.
|
void |
setMaskGenAlgorithm(AlgorithmID alg)
This is used to set the maskGenAlgorithm and should already have an
encapsulated hashAlgorithm if other then SHA1
|
void |
setPParameter(byte[] param)
This is used to set the P parameter that is encapsulated in the
pSourceAlgorithm.
|
void |
setPSource(AlgorithmID pSource)
This is used to set pSourceAlgorithm and should already have the P
parameter encapsulated.
|
ASN1Object |
toASN1Object()
Encodes this
RSAOAEPParameterSpec object as an
ASN1Object. |
public RSAOAEPParameterSpec()
RSAOAEPParameterSpec.public RSAOAEPParameterSpec(ASN1Object spec) throws CodingException
RSAOAEPParameterSpec object from an
ASN1Object.
The ASN1Object must be a RSAES-OAEP-params structure.
spec - an ASN.1 representation of an RSAES-OAEP-params structureCodingException - thrown if an errors occurs while decoding the
ANS1Objectpublic RSAOAEPParameterSpec(RSAOAEPParameterSpec param)
param - the parameters being copiedpublic ASN1Object getEncoded() throws CodingException
RSAOAEPParameterSpec object as an
ASN1Object. This method will produce a an ASN1Object from
the parms hashAlgorithm, maskGenAlgorthm, and pSourceAlgorithm. If any of
these parms are not explicitly set, defaults will be used.CodingExceptionpublic ASN1Object toASN1Object()
RSAOAEPParameterSpec object as an
ASN1Object. This method will produce an ASN1Object from the
parms hashAlgorithm, maskGenAlgorthm, and pSourceAlgorithm. If any of the
parms are not set, they will be omitted.public void setHashAlgorithm(AlgorithmID algId)
public AlgorithmID getHashAlgorithm()
public void setMaskGenAlgorithm(AlgorithmID alg)
AlgorithmID maskGenerationAlgorithm = new AlgorithmID.mgf1; maskGenerationAlgorithm.setParameter(AlgorithmID.sha256.toASN1Object());
public AlgorithmID getMaskGenAlgorithm()
public void setPSource(AlgorithmID pSource)
byte[] pValue = new byte[0,2,0];
AlgorithmID pSourceAlgorithm = new AlgorithmID(new ObjectID("1.2.840.113549.1.1.9", "pSourceAlg", "pSourceAlg"));
pSourceAlgorithm.setParameter(new OCTET_STRING(pValue);
public AlgorithmID getPSource()
public void setPParameter(byte[] param)
public byte[] getPParameter()