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

RSASSAPSSparams

public class RSASSAPSSparams 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.DERInteger
saltLength
private org.bouncycastle.asn1.DERInteger
trailerField
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.DERInteger
DEFAULT_SALT_LENGTH
public static final org.bouncycastle.asn1.DERInteger
DEFAULT_TRAILER_FIELD
Constructors Summary
public RSASSAPSSparams()
The default version

        hashAlgorithm = DEFAULT_HASH_ALGORITHM;
        maskGenAlgorithm = DEFAULT_MASK_GEN_FUNCTION;
        saltLength = DEFAULT_SALT_LENGTH;
        trailerField = DEFAULT_TRAILER_FIELD;
    
public RSASSAPSSparams(org.bouncycastle.asn1.x509.AlgorithmIdentifier hashAlgorithm, org.bouncycastle.asn1.x509.AlgorithmIdentifier maskGenAlgorithm, org.bouncycastle.asn1.DERInteger saltLength, org.bouncycastle.asn1.DERInteger trailerField)

        this.hashAlgorithm = hashAlgorithm;
        this.maskGenAlgorithm = maskGenAlgorithm;
        this.saltLength = saltLength;
        this.trailerField = trailerField;
    
public RSASSAPSSparams(org.bouncycastle.asn1.ASN1Sequence seq)

        hashAlgorithm = DEFAULT_HASH_ALGORITHM;
        maskGenAlgorithm = DEFAULT_MASK_GEN_FUNCTION;
        saltLength = DEFAULT_SALT_LENGTH;
        trailerField = DEFAULT_TRAILER_FIELD;
        
        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:
                saltLength = DERInteger.getInstance(o, true);
                break;
            case 3:
                trailerField = DERInteger.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.RSASSAPSSparamsgetInstance(java.lang.Object obj)

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

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

        return maskGenAlgorithm;
    
public org.bouncycastle.asn1.DERIntegergetSaltLength()

        return saltLength;
    
public org.bouncycastle.asn1.DERIntegergetTrailerField()

        return trailerField;
    
public org.bouncycastle.asn1.DERObjecttoASN1Object()
RSASSA-PSS-params ::= SEQUENCE {
hashAlgorithm [0] OAEP-PSSDigestAlgorithms DEFAULT sha1,
maskGenAlgorithm [1] PKCS1MGFAlgorithms DEFAULT mgf1SHA1,
saltLength [2] INTEGER DEFAULT 20,
trailerField [3] TrailerField DEFAULT trailerFieldBC
}

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 --
}

TrailerField ::= INTEGER { trailerFieldBC(1) }

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 (!saltLength.equals(DEFAULT_SALT_LENGTH))
        {
            v.add(new DERTaggedObject(true, 2, saltLength));
        }
        
        if (!trailerField.equals(DEFAULT_TRAILER_FIELD))
        {
            v.add(new DERTaggedObject(true, 3, trailerField));
        }
        
        return new DERSequence(v);