
org.spongycastle.cms.jcajce.JceKeyTransRecipientInfoGenerator Maven / Gradle / Ivy
Go to download
Spongy Castle is a package-rename (org.bouncycastle.* to org.spongycastle.*) of Bouncy Castle intended for Android.
Android ships with a stripped-down version of Bouncy Castle - this causes classloader collisions if you try to add
an alternative (updated/complete) Bouncy Castle jar.
This jar contains JCE provider and lightweight API for the Bouncy Castle Cryptography APIs for JDK 1.5.
The newest version!
package org.spongycastle.cms.jcajce;
import java.security.Provider;
import java.security.PublicKey;
import java.security.cert.CertificateEncodingException;
import java.security.cert.X509Certificate;
import org.spongycastle.cert.jcajce.JcaX509CertificateHolder;
import org.spongycastle.cms.KeyTransRecipientInfoGenerator;
import org.spongycastle.operator.OperatorCreationException;
import org.spongycastle.operator.jcajce.JceAsymmetricKeyWrapper;
public class JceKeyTransRecipientInfoGenerator
extends KeyTransRecipientInfoGenerator
{
public JceKeyTransRecipientInfoGenerator(X509Certificate recipientCert)
throws CertificateEncodingException
{
super(new JcaX509CertificateHolder(recipientCert).getIssuerAndSerialNumber(), new JceAsymmetricKeyWrapper(recipientCert.getPublicKey()));
}
public JceKeyTransRecipientInfoGenerator(byte[] subjectKeyIdentifier, PublicKey publicKey)
{
super(subjectKeyIdentifier, new JceAsymmetricKeyWrapper(publicKey));
}
public JceKeyTransRecipientInfoGenerator setProvider(String providerName)
throws OperatorCreationException
{
((JceAsymmetricKeyWrapper)this.wrapper).setProvider(providerName);
return this;
}
public JceKeyTransRecipientInfoGenerator setProvider(Provider provider)
throws OperatorCreationException
{
((JceAsymmetricKeyWrapper)this.wrapper).setProvider(provider);
return this;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy