bcpkix-jdk15on-147

rtificateHolder)localIterator.next();
        localArrayList.add(new DERTaggedObject(false, 2, localX509AttributeCertificateHolder.toASN1Structure()));
      }
      return localArrayList;
    }
    catch (ClassCastException localClassCastException)
    {
      throw new CMSException("error processing certs", localClassCastException);
    }
  }
  
  static List getCRLsFromStore(CertStore paramCertStore)
    throws CertStoreException, CMSException
  {
    ArrayList localArrayList = new ArrayList();
    try
    {
      Iterator localIterator = paramCertStore.getCRLs(null).iterator();
      while (localIterator.hasNext())
      {
        X509CRL localX509CRL = (X509CRL)localIterator.next();
        localArrayList.add(CertificateList.getInstance(ASN1Primitive.fromByteArray(localX509CRL.getEncoded())));
      }
      return localArrayList;
    }
    catch (IllegalArgumentException localIllegalArgumentException)
    {
      throw new CMSException("error processing crls", localIllegalArgumentException);
    }
    catch (IOException localIOException)
    {
      throw new CMSException("error processing crls", localIOException);
    }
    catch (CRLException localCRLException)
    {
      throw new CMSException("error encoding crls", localCRLException);
    }
  }
  
  static List getCRLsFromStore(Store paramStore)
    throws CMSException
  {
    ArrayList localArrayList = new ArrayList();
    try
    {
      Iterator localIterator = paramStore.getMatches(null).iterator();
      while (localIterator.hasNext())
      {
        X509CRLHolder localX509CRLHolder = (X509CRLHolder)localIterator.next();
        localArrayList.add(localX509CRLHolder.toASN1Structure());
      }
      return localArrayList;
    }
    catch (ClassCastException localClassCastException)
    {
      throw new CMSException("error processing certs", localClassCastException);
    }
  }
  
  static ASN1Set createBerSetFromList(List paramList)
  {
    ASN1EncodableVector localASN1EncodableVector = new ASN1EncodableVector();
    Iterator localIterator = paramList.iterator();
    while (localIterator.hasNext()) {
      localASN1EncodableVector.add((ASN1Encodable)localIterator.next());
    }
    return new BERSet(localASN1EncodableVector);
  }
  
  static ASN1Set createDerSetFromList(List paramList)
  {
    ASN1EncodableVector localASN1EncodableVector = new ASN1EncodableVector();
    Iterator localIterator = paramList.iterator();
    while (localIterator.hasNext()) {
      localASN1EncodableVector.add((ASN1Encodable)localIterator.next());
    }
    return new DERSet(localASN1EncodableVector);
  }
  
  static OutputStream createBEROctetOutputStream(OutputStream paramOutputStream, int paramInt1, boolean paramBoolean, int paramInt2)
    throws IOException
  {
    BEROctetStringGenerator localBEROctetStringGenerator = new BEROctetStringGenerator(paramOutputStream, paramInt1, paramBoolean);
    if (paramInt2 != 0) {
      return localBEROctetStringGenerator.getOctetOutputStream(new byte[paramInt2]);
    }
    return localBEROctetStringGenerator.getOctetOutputStream();
  }
  
  static TBSCertificateStructure getTBSCertificateStructure(X509Certificate paramX509Certificate)
  {
    try
    {
      return TBSCertificateStructure.getInstance(ASN1Primitive.fromByteArray(paramX509Certificate.getTBSCertificate()));
    }
    catch (Exception localException)
    {
      throw new IllegalArgumentException("can't extract TBS structure from this cert");
    }
  }
  
  static IssuerAndSerialNumber getIssuerAndSerialNumber(X509Certificate paramX509Certificate)
  {
    TBSCertificateStructure localTBSCertificateStructure = getTBSCertificateStructure(paramX509Certificate);
    return new IssuerAndSerialNumber(localTBSCertificateStructure.getIssuer(), localTBSCertificateStructure.getSerialNumber().getValue());
  }
  
  private static ContentInfo readContentInfo(ASN1InputStream paramASN1InputStream)
    throws CMSException
  {
    try
    {
      return ContentInfo.getInstance(paramASN1InputStream.readObject());
    }
    catch (IOException localIOException)
    {
      throw new CMSException("IOException reading content.", localIOException);
    }
    catch (ClassCastException localClassCastException)
    {
      throw new CMSException("Malformed content.", localClassCastException);
    }
    catch (IllegalArgumentException localIllegalArgumentException)
    {
      throw new CMSException("Malformed content.", localIllegalArgumentException);
    }
  }
  
  public static byte[] streamToByteArray(InputStream paramInputStream)
    throws IOException
  {
    return Streams.readAll(paramInputStream);
  }
  
  public static byte[] streamToByteArray(InputStream paramInputStream, int paramInt)
    throws IOException
  {
    return Streams.readAllLimited(paramInputStream, paramInt);
  }
  
  public static Provider getProvider(String paramString)
    throws NoSuchProviderException
  {
    if (paramString != null)
    {
      Provider localProvider = Security.getProvider(paramString);
      if (localProvider != null) {
        return localProvider;
      }
      throw new NoSuchProviderException("provider " + paramString + " not found.");
    }
    return null;
  }
  
  static InputStream attachDigestsToInputStream(Collection paramCollection, InputStream paramInputStream)
  {
    Object localObject = paramInputStream;
    Iterator localIterator = paramCollection.iterator();
    while (localIterator.hasNext())
    {
      DigestCalculator localDigestCalculator = (DigestCalculator)localIterator.next();
      localObject = new TeeInputStream((InputStream)localObject, localDigestCalculator.getOutputStream());
    }
    return (InputStream)localObject;
  }
  
  static OutputStream attachSignersToOutputStream(Collection paramCollection, OutputStream paramOutputStream)
  {
    OutputStream localOutputStream = paramOutputStream;
    Iterator localIterator = paramCollection.iterator();
    while (localIterator.hasNext())
    {
      SignerInfoGenerator localSignerInfoGenerator = (SignerInfoGenerator)localIterator.next();
      localOutputStream = getSafeTeeOutputStream(localOutputStream, localSignerInfoGenerator.getCalculatingOutputStream());
    }
    return localOutputStream;
  }
  
  static OutputStream getSafeOutputStream(OutputStream paramOutputStream)
  {
    return paramOutputStream == null ? new NullOutputStream() : paramOutputStream;
  }
  
  static OutputStream getSafeTeeOutputStream(OutputStream paramOutputStream1, OutputStream paramOutputStream2)
  {
    return paramOutputStream2 == null ? getSafeOutputStream(paramOutputStream1) : paramOutputStream1 == null ? getSafeOutputStream(paramOutputStream2) : new TeeOutputStream(paramOutputStream1, paramOutputStream2);
  }
}

/* Location:
 * Qualified Name:     org.bouncycastle.cms.CMSUtils
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.bouncycastle.cms;

public class CMSVerifierCertificateNotValidException
  extends CMSException
{
  public CMSVerifierCertificateNotValidException(String paramString)
  {
    super(paramString);
  }
}

/* Location:
 * Qualified Name:     org.bouncycastle.cms.CMSVerifierCertificateNotValidException
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.bouncycastle.cms;

import java.util.Hashtable;
import java.util.Map;
import org.bouncycastle.asn1.ASN1Encodable;
import org.bouncycastle.asn1.DERObjectIdentifier;
import org.bouncycastle.asn1.DEROctetString;
import org.bouncycastle.asn1.DERSet;
import org.bouncycastle.asn1.cms.Attribute;
import org.bouncycastle.asn1.cms.AttributeTable;
import org.bouncycastle.asn1.cms.CMSAttributes;

public class DefaultAuthenticatedAttributeTableGenerator
  implements CMSAttributeTableGenerator
{
  private final Hashtable table;
  
  public DefaultAuthenticatedAttributeTableGenerator()
  {
    table = new Hashtable();
  }
  
  public DefaultAuthenticatedAttributeTableGenerator(AttributeTable paramAttributeTable)
  {
    if (paramAttributeTable != null) {
      table = paramAttributeTable.toHashtable();
    } else {
      table = new Hashtable();
    }
  }
  
  protected Hashtable createStandardAttributeTable(Map paramMap)
  {
    Hashtable localHashtable = (Hashtable)table.clone();
    Object localObject;
    Attribute localAttribute;
    if (!localHashtable.containsKey(CMSAttributes.contentType))
    {
      localObject = (DERObjectIdentifier)paramMap.get("contentType");
      localAttribute = new Attribute(CMSAttributes.contentType, new DERSet((ASN1Encodable)localObject));
      localHashtable.put(localAttribute.getAttrType(), localAttribute);
    }
    if (!localHashtable.containsKey(CMSAttributes.messageDigest))
    {
      localObject = (byte[])paramMap.get("digest");
      localAttribute = new Attribute(CMSAttributes.messageDigest, new DERSet(new DEROctetString((byte[])localObject)));
      localHashtable.put(localAttribute.getAttrType(), localAttribute);
    }
    return localHashtable;
  }
  
  public AttributeTable getAttributes(Map paramMap)
  {
    return new AttributeTable(createStandardAttributeTable(paramMap));
  }
}

/* Location:
 * Qualified Name:     org.bouncycastle.cms.DefaultAuthenticatedAttributeTableGenerator
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.bouncycastle.cms;

import java.util.HashMap;
import java.util.Map;
import org.bouncycastle.asn1.ASN1ObjectIdentifier;
import org.bouncycastle.asn1.cryptopro.CryptoProObjectIdentifiers;
import org.bouncycastle.asn1.eac.EACObjectIdentifiers;
import org.bouncycastle.asn1.nist.NISTObjectIdentifiers;
import org.bouncycastle.asn1.oiw.OIWObjectIdentifiers;
import org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers;
import org.bouncycastle.asn1.teletrust.TeleTrusTObjectIdentifiers;
import org.bouncycastle.asn1.x509.AlgorithmIdentifier;
import org.bouncycastle.asn1.x509.X509ObjectIdentifiers;
import org.bouncycastle.asn1.x9.X9ObjectIdentifiers;

public class DefaultCMSSignatureAlgorithmNameGenerator
  implements CMSSignatureAlgorithmNameGenerator
{
  private final Map encryptionAlgs = new HashMap();
  private final Map digestAlgs = new HashMap();
  
  private void addEntries(ASN1ObjectIdentifier paramASN1ObjectIdentifier, String paramString1, String paramString2)
  {
    digestAlgs.put(paramASN1ObjectIdentifier, paramString1);
    encryptionAlgs.put(paramASN1ObjectIdentifier, paramString2);
  }
  
  public DefaultCMSSignatureAlgorithmNameGenerator()
  {
    addEntries(NISTObjectIdentifiers.dsa_with_sha224, "SHA224", "DSA");
    addEntries(NISTObjectIdentifiers.dsa_with_sha256, "SHA256", "DSA");
    addEntries(NISTObjectIdentifiers.dsa_with_sha384, "SHA384", "DSA");
    addEntries(NISTObjectIdentifiers.dsa_with_sha512, "SHA512", "DSA");
    addEntries(OIWObjectIdentifiers.dsaWithSHA1, "SHA1", "DSA");
    addEntries(OIWObjectIdentifiers.md4WithRSA, "MD4", "RSA");
    addEntries(OIWObjectIdentifiers.md4WithRSAEncryption, "MD4", "RSA");
    addEntries(OIWObjectIdentifiers.md5WithRSA, "MD5", "RSA");
    addEntries(OIWObjectIdentifiers.sha1WithRSA, "SHA1", "RSA");
    addEntries(PKCSObjectIdentifiers.md2WithRSAEncryption, "MD2", "RSA");
    addEntries(PKCSObjectIdentifiers.md4WithRSAEncryption, "MD4", "RSA");
    addEntries(PKCSObjectIdentifiers.md5WithRSAEncryption, "MD5", "RSA");
    addEntries(PKCSObjectIdentifiers.sha1WithRSAEncryption, "SHA1", "RSA");
    addEntries(PKCSObjectIdentifiers.sha224WithRSAEncryption, "SHA224", "RSA");
    addEntries(PKCSObjectIdentifiers.sha256WithRSAEncryption, "SHA256", "RSA");
    addEntries(PKCSObjectIdentifiers.sha384WithRSAEncryption, "SHA384", "RSA");
    addEntries(PKCSObjectIdentifiers.sha512WithRSAEncryption, "SHA512", "RSA");
    addEntries(X9ObjectIdentifiers.ecdsa_with_SHA1, "SHA1", "ECDSA");
    addEntries(X9ObjectIdentifiers.ecdsa_with_SHA224, "SHA224", "ECDSA");
    addEntries(X9ObjectIdentifiers.ecdsa_with_SHA256, "SHA256", "ECDSA");
    addEntries(X9ObjectIdentifiers.ecdsa_with_SHA384, "SHA384", "ECDSA");
    addEntries(X9ObjectIdentifiers.ecdsa_with_SHA512, "SHA512", "ECDSA");
    addEntries(X9ObjectIdentifiers.id_dsa_with_sha1, "SHA1", "DSA");
    addEntries(EACObjectIdentifiers.id_TA_ECDSA_SHA_1, "SHA1", "ECDSA");
    addEntries(EACObjectIdentifiers.id_TA_ECDSA_SHA_224, "SHA224", "ECDSA");
    addEntries(EACObjectIdentifiers.id_TA_ECDSA_SHA_256, "SHA256", "ECDSA");
    addEntries(EACObjectIdentifiers.id_TA_ECDSA_SHA_384, "SHA384", "ECDSA");
    addEntries(EACObjectIdentifiers.id_TA_ECDSA_SHA_512, "SHA512", "ECDSA");
    addEntries(EACObjectIdentifiers.id_TA_RSA_v1_5_SHA_1, "SHA1", "RSA");
    addEntries(EACObjectIdentifiers.id_TA_RSA_v1_5_SHA_256, "SHA256", "RSA");
    addEntries(EACObjectIdentifiers.id_TA_RSA_PSS_SHA_1, "SHA1", "RSAandMGF1");
    addEntries(EACObjectIdentifiers.id_TA_RSA_PSS_SHA_256, "SHA256", "RSAandMGF1");
    encryptionAlgs.put(X9ObjectIdentifiers.id_dsa, "DSA");
    encryptionAlgs.put(PKCSObjectIdentifiers.rsaEncryption, "RSA");
    encryptionAlgs.put(TeleTrusTObjectIdentifiers.teleTrusTRSAsignatureAlgorithm, "RSA");
    encryptionAlgs.put(X509ObjectIdentifiers.id_ea_rsa, "RSA");
    encryptionAlgs.put(PKCSObjectIdentifiers.id_RSASSA_PSS, "RSAandMGF1");
    encryptionAlgs.put(CryptoProObjectIdentifiers.gostR3410_94, "GOST3410");
    encryptionAlgs.put(CryptoProObjectIdentifiers.gostR3410_2001, "ECGOST3410");
    encryptionAlgs.put(new ASN1ObjectIdentifier("1.3.6.1.4.1.5849.1.6.2"), "ECGOST3410");
    encryptionAlgs.put(new ASN1ObjectIdentifier("1.3.6.1.4.1.5849.1.1.5"), "GOST3410");
    encryptionAlgs.put(CryptoProObjectIdentifiers.gostR3411_94_with_gostR3410_2001, "ECGOST3410");
    encryptionAlgs.put(CryptoProObjectIdentifiers.gostR3411_94_with_gostR3410_94, "GOST3410");
    digestAlgs.put(PKCSObjectIdentifiers.md2, "MD2");
    digestAlgs.put(PKCSObjectIdentifiers.md4, "MD4");
    digestAlgs.put(PKCSObjectIdentifiers.md5, "MD5");
    digestAlgs.put(OIWObjectIdentifiers.idSHA1, "SHA1");
    digestAlgs.put(NISTObjectIdentifiers.id_sha224, "SHA224");
    digestAlgs.put(NISTObjectIdentifiers.id_sha256, "SHA256");
    digestAlgs.put(NISTObjectIdentifiers.id_sha384, "SHA384");
    digestAlgs.put(NISTObjectIdentifiers.id_sha512, "SHA512");
    digestAlgs.put(TeleTrusTObjectIdentifiers.ripemd128, "RIPEMD128");
    digestAlgs.put(TeleTrusTObjectIdentifiers.ripemd160, "RIPEMD160");
    digestAlgs.put(TeleTrusTObjectIdentifiers.ripemd256, "RIPEMD256");
    digestAlgs.put(CryptoProObjectIdentifiers.gostR3411, "GOST3411");
    digestAlgs.put(new ASN1ObjectIdentifier("1.3.6.1.4.1.5849.1.2.1"), "GOST3411");
  }
  
  private String getDigestAlgName(ASN1ObjectIdentifier paramASN1ObjectIdentifier)
  {
    String str = (String)digestAlgs.get(paramASN1ObjectIdentifier);
    if (str != null) {
      return str;
    }
    return paramASN1ObjectIdentifier.getId();
  }
  
  private String getEncryptionAlgName(ASN1ObjectIdentifier paramASN1ObjectIdentifier)
  {
    String str = (String)encryptionAlgs.get(paramASN1ObjectIdentifier);
    if (str != null) {
      return str;
    }
    return paramASN1ObjectIdentifier.getId();
  }
  
  protected void setSigningEncryptionAlgorithmMapping(ASN1ObjectIdentifier paramASN1ObjectIdentifier, String paramString)
  {
    encryptionAlgs.put(paramASN1ObjectIdentifier, paramString);
  }
  
  protected void setSigningDigestAlgorithmMapping(ASN1ObjectIdentifier paramASN1ObjectIdentifier, String paramString)
  {
    digestAlgs.put(paramASN1ObjectIdentifier, paramString);
  }
  
  public String getSignatureName(AlgorithmIdentifier paramAlgorithmIdentifier1, AlgorithmIdentifier paramAlgorithmIdentifier2)
  {
    return getDigestAlgName(paramAlgorithmIdentifier1.getAlgorithm()) + "with" + getEncryptionAlgName(paramAlgorithmIdentifier2.getAlgorithm());
  }
}

/* Location:
 * Qualified Name:     org.bouncycastle.cms.DefaultCMSSignatureAlgorithmNameGenerator
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.bouncycastle.cms;

import java.util.HashSet;
import java.util.Set;
import org.bouncycastle.asn1.DERNull;
import org.bouncycastle.asn1.oiw.OIWObjectIdentifiers;
import org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers;
import org.bouncycastle.asn1.teletrust.TeleTrusTObjectIdentifiers;
import org.bouncycastle.asn1.x509.AlgorithmIdentifier;

public class DefaultCMSSignatureEncryptionAlgorithmFinder
  implements CMSSignatureEncryptionAlgorithmFinder
{
  private static final Set RSA_PKCS1d5 = new HashSet();
  
  public AlgorithmIdentifier findEncryptionAlgorithm(AlgorithmIdentifier paramAlgorithmIdentifier)
  {
    if (RSA_PKCS1d5.contains(paramAlgorithmIdentifier.getAlgorithm())) {
      return new AlgorithmIdentifier(PKCSObjectIdentifiers.rsaEncryption, DERNull.INSTANCE);
    }
    return paramAlgorithmIdentifier;
  }
  
  static
  {
    RSA_PKCS1d5.add(PKCSObjectIdentifiers.md2WithRSAEncryption);
    RSA_PKCS1d5.add(PKCSObjectIdentifiers.md4WithRSAEncryption);
    RSA_PKCS1d5.add(PKCSObjectIdentifiers.md5WithRSAEncryption);
    RSA_PKCS1d5.add(PKCSObjectIdentifiers.sha1WithRSAEncryption);
    RSA_PKCS1d5.add(PKCSObjectIdentifiers.sha224WithRSAEncryption);
    RSA_PKCS1d5.add(PKCSObjectIdentifiers.sha256WithRSAEncryption);
    RSA_PKCS1d5.add(PKCSObjectIdentifiers.sha384WithRSAEncryption);
    RSA_PKCS1d5.add(PKCSObjectIdentifiers.sha512WithRSAEncryption);
    RSA_PKCS1d5.add(OIWObjectIdentifiers.md4WithRSAEncryption);
    RSA_PKCS1d5.add(OIWObjectIdentifiers.md4WithRSA);
    RSA_PKCS1d5.add(OIWObjectIdentifiers.md5WithRSA);
    RSA_PKCS1d5.add(OIWObjectIdentifiers.sha1WithRSA);
    RSA_PKCS1d5.add(TeleTrusTObjectIdentifiers.rsaSignatureWithripemd128);
    RSA_PKCS1d5.add(TeleTrusTObjectIdentifiers.rsaSignatureWithripemd160);
    RSA_PKCS1d5.add(TeleTrusTObjectIdentifiers.rsaSignatureWithripemd256);
  }
}

/* Location:
 * Qualified Name:     org.bouncycastle.cms.DefaultCMSSignatureEncryptionAlgorithmFinder
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.bouncycastle.cms;

import java.util.Date;
import java.util.Hashtable;
import java.util.Map;
import org.bouncycastle.asn1.ASN1Encodable;
import org.bouncycastle.asn1.DERObjectIdentifier;
import org.bouncycastle.asn1.DEROctetString;
import org.bouncycastle.asn1.DERSet;
import org.bouncycastle.asn1.cms.Attribute;
import org.bouncycastle.asn1.cms.AttributeTable;
import org.bouncycastle.asn1.cms.CMSAttributes;
import org.bouncycastle.asn1.cms.Time;

public class DefaultSignedAttributeTableGenerator
  implements CMSAttributeTableGenerator
{
  private final Hashtable table;
  
  public DefaultSignedAttributeTableGenerator()
  {
    table = new Hashtable();
  }
  
  public DefaultSignedAttributeTableGenerator(AttributeTable paramAttributeTable)
  {
    if (paramAttributeTable != null) {
      table = paramAttributeTable.toHashtable();
    } else {
      table = new Hashtable();
    }
  }
  
  protected Hashtable createStandardAttributeTable(Map paramMap)
  {
    Hashtable localHashtable = (Hashtable)table.clone();
    Object localObject;
    Attribute localAttribute;
    if (!localHashtable.containsKey(CMSAttributes.contentType))
    {
      localObject = (DERObjectIdentifier)paramMap.get("contentType");
      if (localObject != null)
      {
        localAttribute = new Attribute(CMSAttributes.contentType, new DERSet((ASN1Encodable)localObject));
        localHashtable.put(localAttribute.getAttrType(), localAttribute);
      }
    }
    if (!localHashtable.containsKey(CMSAttributes.signingTime))
    {
      localObject = new Date();
      localAttribute = new Attribute(CMSAttributes.signingTime, new DERSet(new Time((Date)localObject)));
      localHashtable.put(localAttribute.getAttrType(), localAttribute);
    }
    if (!localHashtable.containsKey(CMSAttributes.messageDigest))
    {
      localObject = (byte[])paramMap.get("digest");
      localAttribute = new Attribute(CMSAttributes.messageDigest, new DERSet(new DEROctetString((byte[])localObject)));
      localHashtable.put(localAttribute.getAttrType(), localAttribute);
    }
    return localHashtable;
  }
  
  public AttributeTable getAttributes(Map paramMap)
  {
    return new AttributeTable(createStandardAttributeTable(paramMap));
  }
}

/* Location:
 * Qualified Name:     org.bouncycastle.cms.DefaultSignedAttributeTableGenerator
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.bouncycastle.cms;

import org.bouncycastle.asn1.x509.AlgorithmIdentifier;

public abstract interface KEKRecipient
  extends Recipient
{
  public abstract RecipientOperator getRecipientOperator(AlgorithmIdentifier paramAlgorithmIdentifier1, AlgorithmIdentifier paramAlgorithmIdentifier2, byte[] paramArrayOfByte)
    throws CMSException;
}

/* Location:
 * Qualified Name:     org.bouncycastle.cms.KEKRecipient
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.bouncycastle.cms;

import org.bouncycastle.util.Arrays;

public class KEKRecipientId
  extends RecipientId
{
  private byte[] keyIdentifier;
  
  public KEKRecipientId(byte[] paramArrayOfByte)
  {
    super(1);
    keyIdentifier = paramArrayOfByte;
  }
  
  public int hashCode()
  {
    return Arrays.hashCode(keyIdentifier);
  }
  
  public boolean equals(Object paramObject)
  {
    if (!(paramObject instanceof KEKRecipientId)) {
      return false;
    }
    KEKRecipientId localKEKRecipientId = (KEKRecipientId)paramObject;
    return Arrays.areEqual(keyIdentifier, keyIdentifier);
  }
  
  public byte[] getKeyIdentifier()
  {
    return Arrays.clone(keyIdentifier);
  }
  
  public Object clone()
  {
    return new KEKRecipientId(keyIdentifier);
  }
  
  public boolean match(Object paramObject)
  {
    if ((paramObject instanceof byte[])) {
      return Arrays.areEqual(keyIdentifier, (byte[])paramObject);
    }
    if ((paramObject instanceof KEKRecipientInformation)) {
      return ((KEKRecipientInformation)paramObject).getRID().equals(this);
    }
    return false;
  }
}

/* Location:
 * Qualified Name:     org.bouncycastle.cms.KEKRecipientId
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.bouncycastle.cms;

import org.bouncycastle.asn1.DEROctetString;
import org.bouncycastle.asn1.cms.KEKIdentifier;
import org.bouncycastle.asn1.cms.KEKRecipientInfo;
import org.bouncycastle.asn1.cms.RecipientInfo;
import org.bouncycastle.operator.GenericKey;
import org.bouncycastle.operator.OperatorException;
import org.bouncycastle.operator.SymmetricKeyWrapper;

public abstract class KEKRecipientInfoGenerator
  implements RecipientInfoGenerator
{
  private final KEKIdentifier kekIdentifier;
  protected final SymmetricKeyWrapper wrapper;
  
  protected KEKRecipientInfoGenerator(KEKIdentifier paramKEKIdentifier, SymmetricKeyWrapper paramSymmetricKeyWrapper)
  {
    kekIdentifier = paramKEKIdentifier;
    wrapper = paramSymmetricKeyWrapper;
  }
  
  public final RecipientInfo generate(GenericKey paramGenericKey)
    throws CMSException
  {
    try
    {
      DEROctetString localDEROctetString = new DEROctetString(wrapper.generateWrappedKey(paramGenericKey));
      return new RecipientInfo(new KEKRecipientInfo(kekIdentifier, wrapper.getAlgorithmIdentifier(), localDEROctetString));
    }
    catch (OperatorException localOperatorException)
    {
      throw new CMSException("exception wrapping content key: " + localOperatorException.getMessage(), localOperatorException);
    }
  }
}

/* Location:
 * Qualified Name:     org.bouncycastle.cms.KEKRecipientInfoGenerator
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.bouncycastle.cms;

import java.io.IOException;
import java.security.Key;
import java.security.NoSuchProviderException;
import java.security.Provider;
import javax.crypto.SecretKey;
import org.bouncycastle.asn1.ASN1OctetString;
import org.bouncycastle.asn1.cms.KEKIdentifier;
import org.bouncycastle.asn1.cms.KEKRecipientInfo;
import org.bouncycastle.asn1.x509.AlgorithmIdentifier;
import org.bouncycastle.cms.jcajce.JceKEKAuthenticatedRecipient;
import org.bouncycastle.cms.jcajce.JceKEKEnvelopedRecipient;
import org.bouncycastle.cms.jcajce.JceKEKRecipient;

public class KEKRecipientInformation
  extends RecipientInformation
{
  private KEKRecipientInfo info;
  
  KEKRecipientInformation(KEKRecipientInfo paramKEKRecipientInfo, AlgorithmIdentifier paramAlgorithmIdentifier, CMSSecureReadable paramCMSSecureReadable, AuthAttributesProvider paramAuthAttributesProvider)
  {
    super(paramKEKRecipientInfo.getKeyEncryptionAlgorithm(), paramAlgorithmIdentifier, paramCMSSecureReadable, paramAuthAttributesProvider);
    info = paramKEKRecipientInfo;
    KEKIdentifier localKEKIdentifier = paramKEKRecipientInfo.getKekid();
    rid = new KEKRecipientId(localKEKIdentifier.getKeyIdentifier().getOctets());
  }
  
  public CMSTypedStream getContentStream(Key paramKey, String paramString)
    throws CMSException, NoSuchProviderException
  {
    return getContentStream(paramKey, CMSUtils.getProvider(paramString));
  }
  
  /**
   * @deprecated
   */
  public CMSTypedStream getContentStream(Key paramKey, Provider paramProvider)
    throws CMSException
  {
    try
    {
      Object localObject;
      if ((secureReadable instanceof CMSEnvelopedHelper.CMSEnvelopedSecureReadable)) {
        localObject = new JceKEKEnvelopedRecipient((SecretKey)paramKey);
      } else {
        localObject = new JceKEKAuthenticatedRecipient((SecretKey)paramKey);
      }
      if (paramProvider != null) {
        ((JceKEKRecipient)localObject).setProvider(paramProvider);
      }
      return getContentStream((Recipient)localObject);
    }
    catch (IOException localIOException)
    {
      throw new CMSException("encoding error: " + localIOException.getMessage(), localIOException);
    }
  }
  
  protected RecipientOperator getRecipientOperator(Recipient paramRecipient)
    throws CMSException, IOException
  {
    return ((KEKRecipient)paramRecipient).getRecipientOperator(keyEncAlg, messageAlgorithm, info.getEncryptedKey().getOctets());
  }
}

/* Location:
 * Qualified Name:     org.bouncycastle.cms.KEKRecipientInformation
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.bouncycastle.cms;

import org.bouncycastle.asn1.ASN1OctetString;
import org.bouncycastle.asn1.x509.AlgorithmIdentifier;
import org.bouncycastle.asn1.x509.SubjectPublicKeyInfo;

public abstract interface KeyAgreeRecipient
  extends Recipient
{
  public abstract RecipientOperator getRecipientOperator(AlgorithmIdentifier paramAlgorithmIdentifier1, AlgorithmIdentifier paramAlgorithmIdentifier2, SubjectPublicKeyInfo paramSubjectPublicKeyInfo, ASN1OctetString paramASN1OctetString, byte[] paramArrayOfByte)
    throws CMSException;
  
  public abstract AlgorithmIdentifier getPrivateKeyAlgorithmIdentifier();
}

/* Location:
 * Qualified Name:     org.bouncycastle.cms.KeyAgreeRecipient
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.bouncycastle.cms;

import java.math.BigInteger;
import org.bouncycastle.asn1.x500.X500Name;
import org.bouncycastle.cert.selector.X509CertificateHolderSelector;

public class KeyAgreeRecipientId
  extends RecipientId
{
  private X509CertificateHolderSelector baseSelector;
  
  private KeyAgreeRecipientId(X509CertificateHolderSelector paramX509CertificateHolderSelector)
  {
    super(2);
    baseSelector = paramX509CertificateHolderSelector;
  }
  
  public KeyAgreeRecipientId(byte[] paramArrayOfByte)
  {
    this(null, null, paramArrayOfByte);
  }
  
  public KeyAgreeRecipientId(X500Name paramX500Name, BigInteger paramBigInteger)
  {
    this(paramX500Name, paramBigInteger, null);
  }
  
  public KeyAgreeRecipientId(X500Name paramX500Name, BigInteger paramBigInteger, byte[] paramArrayOfByte)
  {
    this(new X509CertificateHolderSelector(paramX500Name, paramBigInteger, paramArrayOfByte));
  }
  
  public BigInteger getSerialNumber()
  {
    return baseSelector.getSerialNumber();
  }
  
  public byte[] getSubjectKeyIdentifier()
  {
    return baseSelector.getSubjectKeyIdentifier();
  }
  
  public int hashCode()
  {
    return baseSelector.hashCode();
  }
  
  public boolean equals(Object paramObject)
  {
    if (!(paramObject instanceof KeyAgreeRecipientId)) {
      return false;
    }
    KeyAgreeRecipientId localKeyAgreeRecipientId = (KeyAgreeRecipientId)paramObject;
    return baseSelector.equals(baseSelector);
  }
  
  public Object clone()
  {
    return new KeyAgreeRecipientId(baseSelector);
  }
  
  public boolean match(Object paramObject)
  {
    if ((paramObject instanceof KeyAgreeRecipientInformation)) {
      return ((KeyAgreeRecipientInformation)paramObject).getRID().equals(this);
    }
    return baseSelector.match(paramObject);
  }
}

/* Location:
 * Qualified Name:     org.bouncycastle.cms.KeyAgreeRecipientId
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.bouncycastle.cms;

import java.io.IOException;
import org.bouncycastle.asn1.ASN1Encodable;
import org.bouncycastle.asn1.ASN1EncodableVector;
import org.bouncycastle.asn1.ASN1ObjectIdentifier;
import org.bouncycastle.asn1.ASN1Sequence;
import org.bouncycastle.asn1.DERBitString;
import org.bouncycastle.asn1.DERNull;
import org.bouncycastle.asn1.DEROctetString;
import org.bouncycastle.asn1.cms.KeyAgreeRecipientInfo;
import org.bouncycastle.asn1.cms.OriginatorIdentifierOrKey;
import org.bouncycastle.asn1.cms.OriginatorPublicKey;
import org.bouncycastle.asn1.cms.RecipientInfo;
import org.bouncycastle.asn1.x509.AlgorithmIdentifier;
import org.bouncycastle.asn1.x509.SubjectPublicKeyInfo;
import org.bouncycastle.operator.GenericKey;

public abstract class KeyAgreeRecipientInfoGenerator
  implements RecipientInfoGenerator
{
  private ASN1ObjectIdentifier keyAgreementOID;
  private ASN1ObjectIdentifier keyEncryptionOID;
  private SubjectPublicKeyInfo originatorKeyInfo;
  
  protected KeyAgreeRecipientInfoGenerator(ASN1ObjectIdentifier paramASN1ObjectIdentifier1, SubjectPublicKeyInfo paramSubjectPublicKeyInfo, ASN1ObjectIdentifier paramASN1ObjectIdentifier2)
  {
    originatorKeyInfo = paramSubjectPublicKeyInfo;
    keyAgreementOID = paramASN1ObjectIdentifier1;
    keyEncryptionOID = paramASN1ObjectIdentifier2;
  }
  
  public RecipientInfo generate(GenericKey paramGenericKey)
    throws CMSException
  {
    OriginatorIdentifierOrKey localOriginatorIdentifierOrKey = new OriginatorIdentifierOrKey(createOriginatorPublicKey(originatorKeyInfo));
    ASN1EncodableVector localASN1EncodableVector = new ASN1EncodableVector();
    localASN1EncodableVector.add(keyEncryptionOID);
    localASN1EncodableVector.add(DERNull.INSTANCE);
    AlgorithmIdentifier localAlgorithmIdentifier1 = new AlgorithmIdentifier(keyEncryptionOID, DERNull.INSTANCE);
    AlgorithmIdentifier localAlgorithmIdentifier2 = new AlgorithmIdentifier(keyAgreementOID, localAlgorithmIdentifier1);
    ASN1Sequence localASN1Sequence = generateRecipientEncryptedKeys(localAlgorithmIdentifier2, localAlgorithmIdentifier1, paramGenericKey);
    ASN1Encodable localASN1Encodable = getUserKeyingMaterial(localAlgorithmIdentifier2);
    if (localASN1Encodable != null) {
      try
      {
        return new RecipientInfo(new KeyAgreeRecipientInfo(localOriginatorIdentifierOrKey, new DEROctetString(localASN1Encodable), localAlgorithmIdentifier2, localASN1Sequence));
      }
      catch (IOException localIOException)
      {
        throw new CMSException("unable to encode userKeyingMaterial: " + localIOException.getMessage(), localIOException);
      }
    }
    return new RecipientInfo(new KeyAgreeRecipientInfo(localOriginatorIdentifierOrKey, null, localAlgorithmIdentifier2, localASN1Sequence));
  }
  
  protected OriginatorPublicKey createOriginatorPublicKey(SubjectPublicKeyInfo paramSubjectPublicKeyInfo)
  {
    return new OriginatorPublicKey(new AlgorithmIdentifier(paramSubjectPublicKeyInfo.getAlgorithmId().getAlgorithm(), DERNull.INSTANCE), paramSubjectPublicKeyInfo.getPublicKeyData().getBytes());
  }
  
  protected abstract ASN1Sequence generateRecipientEncryptedKeys(AlgorithmIdentifier paramAlgorithmIdentifier1, AlgorithmIdentifier paramAlgorithmIdentifier2, GenericKey paramGenericKey)
    throws CMSException;
  
  protected abstract ASN1Encodable getUserKeyingMaterial(AlgorithmIdentifier paramAlgorithmIdentifier)
    throws CMSException;
}

/* Location:
 * Qualified Name:     org.bouncycastle.cms.KeyAgreeRecipientInfoGenerator
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.bouncycastle.cms;

import java.io.IOException;
import java.security.Key;
import java.security.NoSuchProviderException;
import java.security.PrivateKey;
import java.security.Provider;
import java.util.List;
import org.bouncycastle.asn1.ASN1Integer;
import org.bouncycastle.asn1.ASN1OctetString;
import org.bouncycastle.asn1.ASN1Sequence;
import org.bouncycastle.asn1.DERBitString;
import org.bouncycastle.asn1.cms.IssuerAndSerialNumber;
import org.bouncycastle.asn1.cms.KeyAgreeRecipientIdentifier;
import org.bouncycastle.asn1.cms.KeyAgreeRecipientInfo;
import org.bouncycastle.asn1.cms.OriginatorIdentifierOrKey;
import org.bouncycastle.asn1.cms.OriginatorPublicKey;
import org.bouncycastle.asn1.cms.RecipientEncryptedKey;
import org.bouncycastle.asn1.cms.RecipientKeyIdentifier;
import org.bouncycastle.asn1.x509.AlgorithmIdentifier;
import org.bouncycastle.asn1.x509.SubjectKeyIdentifier;
import org.bouncycastle.asn1.x509.SubjectPublicKeyInfo;
import org.bouncycastle.cms.jcajce.JceKeyAgreeAuthenticatedRecipient;
import org.bouncycastle.cms.jcajce.JceKeyAgreeEnvelopedRecipient;
import org.bouncycastle.cms.jcajce.JceKeyAgreeRecipient;

public class KeyAgreeRecipientInformation
  extends RecipientInformation
{
  private KeyAgreeRecipientInfo info;
  private ASN1OctetString encryptedKey;
  
  static void readRecipientInfo(List paramList, KeyAgreeRecipientInfo paramKeyAgreeRecipientInfo, AlgorithmIdentifier paramAlgorithmIdentifier, CMSSecureReadable paramCMSSecureReadable, AuthAttributesProvider paramAuthAttributesProvider)
  {
    ASN1Sequence localASN1Sequence = paramKeyAgreeRecipientInfo.getRecipientEncryptedKeys();
    for (int i = 0; i < localASN1Sequence.size(); i++)
    {
      RecipientEncryptedKey localRecipientEncryptedKey = RecipientEncryptedKey.getInstance(localASN1Sequence.getObjectAt(i));
      KeyAgreeRecipientIdentifier localKeyAgreeRecipientIdentifier = localRecipientEncryptedKey.getIdentifier();
      IssuerAndSerialNumber localIssuerAndSerialNumber = localKeyAgreeRecipientIdentifier.getIssuerAndSerialNumber();
      KeyAgreeRecipientId localKeyAgreeRecipientId;
      if (localIssuerAndSerialNumber != null)
      {
        localKeyAgreeRecipientId = new KeyAgreeRecipientId(localIssuerAndSerialNumber.getName(), localIssuerAndSerialNumber.getSerialNumber().getValue());
      }
      else
      {
        RecipientKeyIdentifier localRecipientKeyIdentifier = localKeyAgreeRecipientIdentifier.getRKeyID();
        localKeyAgreeRecipientId = new KeyAgreeRecipientId(localRecipientKeyIdentifier.getSubjectKeyIdentifier().getOctets());
      }
      paramList.add(new KeyAgreeRecipientInformation(paramKeyAgreeRecipientInfo, localKeyAgreeRecipientId, localRecipientEncryptedKey.getEncryptedKey(), paramAlgorithmIdentifier, paramCMSSecureReadable, paramAuthAttributesProvider));
    }
  }
  
  KeyAgreeRecipientInformation(KeyAgreeRecipientInfo paramKeyAgreeRecipientInfo, RecipientId paramRecipientId, ASN1OctetString paramASN1OctetString, AlgorithmIdentifier paramAlgorithmIdentifier, CMSSecureReadable paramCMSSecureReadable, AuthAttributesProvider paramAuthAttributesProvider)
  {
    super(paramKeyAgreeRecipientInfo.getKeyEncryptionAlgorithm(), paramAlgorithmIdentifier, paramCMSSecureReadable, paramAuthAttributesProvider);
    info = paramKeyAgreeRecipientInfo;
    rid = paramRecipientId;
    encryptedKey = paramASN1OctetString;
  }
  
  private SubjectPublicKeyInfo getSenderPublicKeyInfo(AlgorithmIdentifier paramAlgorithmIdentifier, OriginatorIdentifierOrKey paramOriginatorIdentifierOrKey)
    throws CMSException, IOException
  {
    OriginatorPublicKey localOriginatorPublicKey = paramOriginatorIdentifierOrKey.getOriginatorKey();
    if (localOriginatorPublicKey != null) {
      return getPublicKeyInfoFromOriginatorPublicKey(paramAlgorithmIdentifier, localOriginatorPublicKey);
    }
    IssuerAndSerialNumber localIssuerAndSerialNumber = paramOriginatorIdentifierOrKey.getIssuerAndSerialNumber();
    OriginatorId localOriginatorId;
    if (localIssuerAndSerialNumber != null)
    {
      localOriginatorId = new OriginatorId(localIssuerAndSerialNumber.getName(), localIssuerAndSerialNumber.getSerialNumber().getValue());
    }
    else
    {
      SubjectKeyIdentifier localSubjectKeyIdentifier = paramOriginatorIdentifierOrKey.getSubjectKeyIdentifier();
      localOriginatorId = new OriginatorId(localSubjectKeyIdentifier.getKeyIdentifier());
    }
    return getPublicKeyInfoFromOriginatorId(localOriginatorId);
  }
  
  private SubjectPublicKeyInfo getPublicKeyInfoFromOriginatorPublicKey(AlgorithmIdentifier paramAlgorithmIdentifier, OriginatorPublicKey paramOriginatorPublicKey)
  {
    SubjectPublicKeyInfo localSubjectPublicKeyInfo = new SubjectPublicKeyInfo(paramAlgorithmIdentifier, paramOriginatorPublicKey.getPublicKey().getBytes());
    return localSubjectPublicKeyInfo;
  }
  
  private SubjectPublicKeyInfo getPublicKeyInfoFromOriginatorId(OriginatorId paramOriginatorId)
    throws CMSException
  {
    throw new CMSException("No support for 'originator' as IssuerAndSerialNumber or SubjectKeyIdentifier");
  }
  
  /**
   * @deprecated
   */
  public CMSTypedStream getContentStream(Key paramKey, String paramString)
    throws CMSException, NoSuchProviderException
  {
    return getContentStream(paramKey, CMSUtils.getProvider(paramString));
  }
  
  /**
   * @deprecated
   */
  public CMSTypedStream getContentStream(Key paramKey, Provider paramProvider)
    throws CMSException
  {
    try
    {
      Object localObject;
      if ((secureReadable instanceof CMSEnvelopedHelper.CMSEnvelopedSecureReadable)) {
        localObject = new JceKeyAgreeEnvelopedRecipient((PrivateKey)paramKey);
      } else {
        localObject = new JceKeyAgreeAuthenticatedRecipient((PrivateKey)paramKey);
      }
      if (paramProvider != null)
      {
        ((JceKeyAgreeRecipient)localObject).setProvider(paramProvider);
        if (paramProvider.getName().equalsIgnoreCase("SunJCE")) {
          ((JceKeyAgreeRecipient)localObject).setContentProvider((String)null);
        }
      }
      return getContentStream((Recipient)localObject);
    }
    catch (IOException localIOException)
    {
      throw new CMSException("encoding error: " + localIOException.getMessage(), localIOException);
    }
  }
  
  protected RecipientOperator getRecipientOperator(Recipient paramRecipient)
    throws CMSException, IOException
  {
    KeyAgreeRecipient localKeyAgreeRecipient = (KeyAgreeRecipient)paramRecipient;
    AlgorithmIdentifier localAlgorithmIdentifier = localKeyAgreeRecipient.getPrivateKeyAlgorithmIdentifier();
    return ((KeyAgreeRecipient)paramRecipient).getRecipientOperator(keyEncAlg, messageAlgorithm, getSenderPublicKeyInfo(localAlgorithmIdentifier, info.getOriginator()), info.getUserKeyingMaterial(), encryptedKey.getOctets());
  }
}

/* Location:
 * Qualified Name:     org.bouncycastle.cms.KeyAgreeRecipientInformation
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.bouncycastle.cms;

import org.bouncycastle.asn1.x509.AlgorithmIdentifier;

public abstract interface KeyTransRecipient
  extends Recipient
{
  public abstract RecipientOperator getRecipientOperator(AlgorithmIdentifier paramAlgorithmIdentifier1, AlgorithmIdentifier paramAlgorithmIdentifier2, byte[] paramArrayOfByte)
    throws CMSException;
}

/* Location:
 * Qualified Name:     org.bouncycastle.cms.KeyTransRecipient
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.bouncycastle.cms;

import java.math.BigInteger;
import org.bouncycastle.asn1.x500.X500Name;
import org.bouncycastle.cert.selector.X509Cer
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31

Further reading...

For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.

New!JAR listings


Copyright 2006-2017. Infinite Loop Ltd