org.spongycastle.cms.CMSAuthenticatedGenerator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pkix Show documentation
Show all versions of pkix Show documentation
Spongy Castle is a package-rename (org.bouncycastle.* to org.spongycastle.*) of Bouncy Castle
intended for the Android platform. Android unfortunately ships with a stripped-down version of
Bouncy Castle, which prevents easy upgrades - Spongy Castle overcomes this and provides a full,
up-to-date version of the Bouncy Castle cryptographic libs.
package org.spongycastle.cms;
import java.util.HashMap;
import java.util.Map;
import org.spongycastle.asn1.ASN1ObjectIdentifier;
import org.spongycastle.asn1.x509.AlgorithmIdentifier;
import org.spongycastle.util.Arrays;
public class CMSAuthenticatedGenerator
extends CMSEnvelopedGenerator
{
protected CMSAttributeTableGenerator authGen;
protected CMSAttributeTableGenerator unauthGen;
/**
* base constructor
*/
public CMSAuthenticatedGenerator()
{
}
public void setAuthenticatedAttributeGenerator(CMSAttributeTableGenerator authGen)
{
this.authGen = authGen;
}
public void setUnauthenticatedAttributeGenerator(CMSAttributeTableGenerator unauthGen)
{
this.unauthGen = unauthGen;
}
protected Map getBaseParameters(ASN1ObjectIdentifier contentType, AlgorithmIdentifier digAlgId, AlgorithmIdentifier macAlgId, byte[] hash)
{
Map param = new HashMap();
param.put(CMSAttributeTableGenerator.CONTENT_TYPE, contentType);
param.put(CMSAttributeTableGenerator.DIGEST_ALGORITHM_IDENTIFIER, digAlgId);
param.put(CMSAttributeTableGenerator.DIGEST, Arrays.clone(hash));
param.put(CMSAttributeTableGenerator.MAC_ALGORITHM_IDENTIFIER, macAlgId);
return param;
}
}