FileDocCategorySizeDatePackage
RSAESOAEPparams.javaAPI DocAndroid 1.5 API5129Wed May 06 22:41:06 BST 2009org.bouncycastle.asn1.pkcs

RSAESOAEPparams

public class RSAESOAEPparams extends org.bouncycastle.asn1.ASN1Encodable

Fields Summary
private org.bouncycastle.asn1.x509.AlgorithmIdentifier
hashAlgorithm
private org.bouncycastle.asn1.x509.AlgorithmIdentifier
maskGenAlgorithm
private org.bouncycastle.asn1.x509.AlgorithmIdentifier
pSourceAlgorithm
public static final org.bouncycastle.asn1.x509.AlgorithmIdentifier
DEFAULT_HASH_ALGORITHM
public static final org.bouncycastle.asn1.x509.AlgorithmIdentifier
DEFAULT_MASK_GEN_FUNCTION
public static final org.bouncycastle.asn1.x509.AlgorithmIdentifier
DEFAULT_P_SOURCE_ALGORITHM
Constructors Summary
public RSAESOAEPparams()
The default version

        hashAlgorithm = DEFAULT_HASH_ALGORITHM;
        maskGenAlgorithm = DEFAULT_MASK_GEN_FUNCTION;
        pSourceAlgorithm = DEFAULT_P_SOURCE_ALGORITHM;
    
public RSAESOAEPparams(org.bouncycastle.asn1.x509.AlgorithmIdentifier hashAlgorithm, org.bouncycastle.asn1.x509.AlgorithmIdentifier maskGenAlgorithm, org.bouncycastle.asn1.x509.AlgorithmIdentifier pSourceAlgorithm)

        this.hashAlgorithm = hashAlgorithm;
        this.maskGenAlgorithm = maskGenAlgorithm;
        this.pSourceAlgorithm = pSourceAlgorithm;
    
public RSAESOAEPparams(org.bouncycastle.asn1.ASN1Sequence seq)

        hashAlgorithm = DEFAULT_HASH_ALGORITHM;
        maskGenAlgorithm = DEFAULT_MASK_GEN_FUNCTION;
        pSourceAlgorithm = DEFAULT_P_SOURCE_ALGORITHM;
        
        for (int i = 0; i != seq.size(); i++)
        {
            ASN1TaggedObject    o = (ASN1TaggedObject)seq.getObjectAt(i);
            
            switch (o.getTagNo())
            {
            case 0:
                hashAlgorithm = AlgorithmIdentifier.getInstance(o, true);
                break;
            case 1:
                maskGenAlgorithm = AlgorithmIdentifier.getInstance(o, true);
                break;
            case 2:
                pSourceAlgorithm = AlgorithmIdentifier.getInstance(o, true);
                break;
            default:
                throw new IllegalArgumentException("unknown tag");
            }
        }
    
Methods Summary
public org.bouncycastle.asn1.x509.AlgorithmIdentifiergetHashAlgorithm()

        return hashAlgorithm;
    
public static org.bouncycastle.asn1.pkcs.RSAESOAEPparamsgetInstance(java.lang.Object obj)

    
       
          
    
        if (obj instanceof RSAESOAEPparams)
        {
            return (RSAESOAEPparams)obj;
        }
        else if (obj instanceof ASN1Sequence)
        {
            return new RSAESOAEPparams((ASN1Sequence)obj);
        }

        throw new IllegalArgumentException("unknown object in factory");
    
public org.bouncycastle.asn1.x509.AlgorithmIdentifiergetMaskGenAlgorithm()

        return maskGenAlgorithm;
    
public org.bouncycastle.asn1.x509.AlgorithmIdentifiergetPSourceAlgorithm()

        return pSourceAlgorithm;
    
public org.bouncycastle.asn1.DERObjecttoASN1Object()
RSAES-OAEP-params ::= SEQUENCE {
hashAlgorithm [0] OAEP-PSSDigestAlgorithms DEFAULT sha1,
maskGenAlgorithm [1] PKCS1MGFAlgorithms DEFAULT mgf1SHA1,
pSourceAlgorithm [2] PKCS1PSourceAlgorithms DEFAULT pSpecifiedEmpty
}

OAEP-PSSDigestAlgorithms ALGORITHM-IDENTIFIER ::= {
{ OID id-sha1 PARAMETERS NULL }|
{ OID id-sha256 PARAMETERS NULL }|
{ OID id-sha384 PARAMETERS NULL }|
{ OID id-sha512 PARAMETERS NULL },
... -- Allows for future expansion --
}
PKCS1MGFAlgorithms ALGORITHM-IDENTIFIER ::= {
{ OID id-mgf1 PARAMETERS OAEP-PSSDigestAlgorithms },
... -- Allows for future expansion --
}
PKCS1PSourceAlgorithms ALGORITHM-IDENTIFIER ::= {
{ OID id-pSpecified PARAMETERS OCTET STRING },
... -- Allows for future expansion --
}

return
the asn1 primitive representing the parameters.

        ASN1EncodableVector v = new ASN1EncodableVector();
        
        if (!hashAlgorithm.equals(DEFAULT_HASH_ALGORITHM))
        {
            v.add(new DERTaggedObject(true, 0, hashAlgorithm));
        }
        
        if (!maskGenAlgorithm.equals(DEFAULT_MASK_GEN_FUNCTION))
        {
            v.add(new DERTaggedObject(true, 1, maskGenAlgorithm));
        }
        
        if (!pSourceAlgorithm.equals(DEFAULT_P_SOURCE_ALGORITHM))
        {
            v.add(new DERTaggedObject(true, 2, pSourceAlgorithm));
        }
        
        return new DERSequence(v);