bcpkix-jdk15on-147

contentInfo = contentInfo;
    signedContent = signedContent;
    signerInfoStore = signerInfoStore;
  }
  
  public CMSSignedData(byte[] paramArrayOfByte)
    throws CMSException
  {
    this(CMSUtils.readContentInfo(paramArrayOfByte));
  }
  
  public CMSSignedData(CMSProcessable paramCMSProcessable, byte[] paramArrayOfByte)
    throws CMSException
  {
    this(paramCMSProcessable, CMSUtils.readContentInfo(paramArrayOfByte));
  }
  
  public CMSSignedData(Map paramMap, byte[] paramArrayOfByte)
    throws CMSException
  {
    this(paramMap, CMSUtils.readContentInfo(paramArrayOfByte));
  }
  
  public CMSSignedData(CMSProcessable paramCMSProcessable, InputStream paramInputStream)
    throws CMSException
  {
    this(paramCMSProcessable, CMSUtils.readContentInfo(new ASN1InputStream(paramInputStream)));
  }
  
  public CMSSignedData(InputStream paramInputStream)
    throws CMSException
  {
    this(CMSUtils.readContentInfo(paramInputStream));
  }
  
  public CMSSignedData(CMSProcessable paramCMSProcessable, ContentInfo paramContentInfo)
    throws CMSException
  {
    signedContent = paramCMSProcessable;
    contentInfo = paramContentInfo;
    signedData = getSignedData();
  }
  
  public CMSSignedData(Map paramMap, ContentInfo paramContentInfo)
    throws CMSException
  {
    hashes = paramMap;
    contentInfo = paramContentInfo;
    signedData = getSignedData();
  }
  
  public CMSSignedData(ContentInfo paramContentInfo)
    throws CMSException
  {
    contentInfo = paramContentInfo;
    signedData = getSignedData();
    if (signedData.getEncapContentInfo().getContent() != null) {
      signedContent = new CMSProcessableByteArray(((ASN1OctetString)signedData.getEncapContentInfo().getContent()).getOctets());
    } else {
      signedContent = null;
    }
  }
  
  private SignedData getSignedData()
    throws CMSException
  {
    try
    {
      return SignedData.getInstance(contentInfo.getContent());
    }
    catch (ClassCastException localClassCastException)
    {
      throw new CMSException("Malformed content.", localClassCastException);
    }
    catch (IllegalArgumentException localIllegalArgumentException)
    {
      throw new CMSException("Malformed content.", localIllegalArgumentException);
    }
  }
  
  public int getVersion()
  {
    return signedData.getVersion().getValue().intValue();
  }
  
  public SignerInformationStore getSignerInfos()
  {
    if (signerInfoStore == null)
    {
      ASN1Set localASN1Set = signedData.getSignerInfos();
      ArrayList localArrayList = new ArrayList();
      DefaultSignatureAlgorithmIdentifierFinder localDefaultSignatureAlgorithmIdentifierFinder = new DefaultSignatureAlgorithmIdentifierFinder();
      for (int i = 0; i != localASN1Set.size(); i++)
      {
        SignerInfo localSignerInfo = SignerInfo.getInstance(localASN1Set.getObjectAt(i));
        ASN1ObjectIdentifier localASN1ObjectIdentifier = signedData.getEncapContentInfo().getContentType();
        if (hashes == null)
        {
          localArrayList.add(new SignerInformation(localSignerInfo, localASN1ObjectIdentifier, signedContent, null));
        }
        else
        {
          Object localObject = hashes.keySet().iterator().next();
          byte[] arrayOfByte = (localObject instanceof String) ? (byte[])hashes.get(localSignerInfo.getDigestAlgorithm().getAlgorithm().getId()) : (byte[])hashes.get(localSignerInfo.getDigestAlgorithm().getAlgorithm());
          localArrayList.add(new SignerInformation(localSignerInfo, localASN1ObjectIdentifier, null, arrayOfByte));
        }
      }
      signerInfoStore = new SignerInformationStore(localArrayList);
    }
    return signerInfoStore;
  }
  
  /**
   * @deprecated
   */
  public X509Store getAttributeCertificates(String paramString1, String paramString2)
    throws NoSuchStoreException, NoSuchProviderException, CMSException
  {
    return getAttributeCertificates(paramString1, CMSUtils.getProvider(paramString2));
  }
  
  /**
   * @deprecated
   */
  public X509Store getAttributeCertificates(String paramString, Provider paramProvider)
    throws NoSuchStoreException, CMSException
  {
    if (attributeStore == null) {
      attributeStore = HELPER.createAttributeStore(paramString, paramProvider, signedData.getCertificates());
    }
    return attributeStore;
  }
  
  /**
   * @deprecated
   */
  public X509Store getCertificates(String paramString1, String paramString2)
    throws NoSuchStoreException, NoSuchProviderException, CMSException
  {
    return getCertificates(paramString1, CMSUtils.getProvider(paramString2));
  }
  
  /**
   * @deprecated
   */
  public X509Store getCertificates(String paramString, Provider paramProvider)
    throws NoSuchStoreException, CMSException
  {
    if (certificateStore == null) {
      certificateStore = HELPER.createCertificateStore(paramString, paramProvider, signedData.getCertificates());
    }
    return certificateStore;
  }
  
  /**
   * @deprecated
   */
  public X509Store getCRLs(String paramString1, String paramString2)
    throws NoSuchStoreException, NoSuchProviderException, CMSException
  {
    return getCRLs(paramString1, CMSUtils.getProvider(paramString2));
  }
  
  /**
   * @deprecated
   */
  public X509Store getCRLs(String paramString, Provider paramProvider)
    throws NoSuchStoreException, CMSException
  {
    if (crlStore == null) {
      crlStore = HELPER.createCRLsStore(paramString, paramProvider, signedData.getCRLs());
    }
    return crlStore;
  }
  
  /**
   * @deprecated
   */
  public CertStore getCertificatesAndCRLs(String paramString1, String paramString2)
    throws NoSuchAlgorithmException, NoSuchProviderException, CMSException
  {
    return getCertificatesAndCRLs(paramString1, CMSUtils.getProvider(paramString2));
  }
  
  /**
   * @deprecated
   */
  public CertStore getCertificatesAndCRLs(String paramString, Provider paramProvider)
    throws NoSuchAlgorithmException, CMSException
  {
    ASN1Set localASN1Set1 = signedData.getCertificates();
    ASN1Set localASN1Set2 = signedData.getCRLs();
    return HELPER.createCertStore(paramString, paramProvider, localASN1Set1, localASN1Set2);
  }
  
  public Store getCertificates()
  {
    ASN1Set localASN1Set = signedData.getCertificates();
    if (localASN1Set != null)
    {
      ArrayList localArrayList = new ArrayList(localASN1Set.size());
      Enumeration localEnumeration = localASN1Set.getObjects();
      while (localEnumeration.hasMoreElements())
      {
        ASN1Primitive localASN1Primitive = ((ASN1Encodable)localEnumeration.nextElement()).toASN1Primitive();
        if ((localASN1Primitive instanceof ASN1Sequence)) {
          localArrayList.add(new X509CertificateHolder(Certificate.getInstance(localASN1Primitive)));
        }
      }
      return new CollectionStore(localArrayList);
    }
    return new CollectionStore(new ArrayList());
  }
  
  public Store getCRLs()
  {
    ASN1Set localASN1Set = signedData.getCRLs();
    if (localASN1Set != null)
    {
      ArrayList localArrayList = new ArrayList(localASN1Set.size());
      Enumeration localEnumeration = localASN1Set.getObjects();
      while (localEnumeration.hasMoreElements())
      {
        ASN1Primitive localASN1Primitive = ((ASN1Encodable)localEnumeration.nextElement()).toASN1Primitive();
        if ((localASN1Primitive instanceof ASN1Sequence)) {
          localArrayList.add(new X509CRLHolder(CertificateList.getInstance(localASN1Primitive)));
        }
      }
      return new CollectionStore(localArrayList);
    }
    return new CollectionStore(new ArrayList());
  }
  
  public Store getAttributeCertificates()
  {
    ASN1Set localASN1Set = signedData.getCertificates();
    if (localASN1Set != null)
    {
      ArrayList localArrayList = new ArrayList(localASN1Set.size());
      Enumeration localEnumeration = localASN1Set.getObjects();
      while (localEnumeration.hasMoreElements())
      {
        ASN1Primitive localASN1Primitive = ((ASN1Encodable)localEnumeration.nextElement()).toASN1Primitive();
        if ((localASN1Primitive instanceof ASN1TaggedObject)) {
          localArrayList.add(new X509AttributeCertificateHolder(AttributeCertificate.getInstance(((ASN1TaggedObject)localASN1Primitive).getObject())));
        }
      }
      return new CollectionStore(localArrayList);
    }
    return new CollectionStore(new ArrayList());
  }
  
  public String getSignedContentTypeOID()
  {
    return signedData.getEncapContentInfo().getContentType().getId();
  }
  
  public CMSProcessable getSignedContent()
  {
    return signedContent;
  }
  
  /**
   * @deprecated
   */
  public ContentInfo getContentInfo()
  {
    return contentInfo;
  }
  
  public ContentInfo toASN1Structure()
  {
    return contentInfo;
  }
  
  public byte[] getEncoded()
    throws IOException
  {
    return contentInfo.getEncoded();
  }
  
  public static CMSSignedData replaceSigners(CMSSignedData paramCMSSignedData, SignerInformationStore paramSignerInformationStore)
  {
    CMSSignedData localCMSSignedData = new CMSSignedData(paramCMSSignedData);
    signerInfoStore = paramSignerInformationStore;
    ASN1EncodableVector localASN1EncodableVector1 = new ASN1EncodableVector();
    ASN1EncodableVector localASN1EncodableVector2 = new ASN1EncodableVector();
    Iterator localIterator = paramSignerInformationStore.getSigners().iterator();
    while (localIterator.hasNext())
    {
      localObject = (SignerInformation)localIterator.next();
      localASN1EncodableVector1.add(CMSSignedHelper.INSTANCE.fixAlgID(((SignerInformation)localObject).getDigestAlgorithmID()));
      localASN1EncodableVector2.add(((SignerInformation)localObject).toASN1Structure());
    }
    Object localObject = new DERSet(localASN1EncodableVector1);
    DERSet localDERSet = new DERSet(localASN1EncodableVector2);
    ASN1Sequence localASN1Sequence = (ASN1Sequence)signedData.toASN1Primitive();
    localASN1EncodableVector2 = new ASN1EncodableVector();
    localASN1EncodableVector2.add(localASN1Sequence.getObjectAt(0));
    localASN1EncodableVector2.add((ASN1Encodable)localObject);
    for (int i = 2; i != localASN1Sequence.size() - 1; i++) {
      localASN1EncodableVector2.add(localASN1Sequence.getObjectAt(i));
    }
    localASN1EncodableVector2.add(localDERSet);
    signedData = SignedData.getInstance(new BERSequence(localASN1EncodableVector2));
    contentInfo = new ContentInfo(contentInfo.getContentType(), signedData);
    return localCMSSignedData;
  }
  
  public static CMSSignedData replaceCertificatesAndCRLs(CMSSignedData paramCMSSignedData, CertStore paramCertStore)
    throws CMSException
  {
    CMSSignedData localCMSSignedData = new CMSSignedData(paramCMSSignedData);
    Object localObject1 = null;
    Object localObject2 = null;
    try
    {
      ASN1Set localASN1Set1 = CMSUtils.createBerSetFromList(CMSUtils.getCertificatesFromStore(paramCertStore));
      if (localASN1Set1.size() != 0) {
        localObject1 = localASN1Set1;
      }
    }
    catch (CertStoreException localCertStoreException1)
    {
      throw new CMSException("error getting certs from certStore", localCertStoreException1);
    }
    try
    {
      ASN1Set localASN1Set2 = CMSUtils.createBerSetFromList(CMSUtils.getCRLsFromStore(paramCertStore));
      if (localASN1Set2.size() != 0) {
        localObject2 = localASN1Set2;
      }
    }
    catch (CertStoreException localCertStoreException2)
    {
      throw new CMSException("error getting crls from certStore", localCertStoreException2);
    }
    signedData = new SignedData(signedData.getDigestAlgorithms(), signedData.getEncapContentInfo(), (ASN1Set)localObject1, (ASN1Set)localObject2, signedData.getSignerInfos());
    contentInfo = new ContentInfo(contentInfo.getContentType(), signedData);
    return localCMSSignedData;
  }
  
  public static CMSSignedData replaceCertificatesAndCRLs(CMSSignedData paramCMSSignedData, Store paramStore1, Store paramStore2, Store paramStore3)
    throws CMSException
  {
    CMSSignedData localCMSSignedData = new CMSSignedData(paramCMSSignedData);
    Object localObject1 = null;
    Object localObject2 = null;
    Object localObject3;
    if ((paramStore1 != null) || (paramStore2 != null))
    {
      localObject3 = new ArrayList();
      if (paramStore1 != null) {
        ((List)localObject3).addAll(CMSUtils.getCertificatesFromStore(paramStore1));
      }
      if (paramStore2 != null) {
        ((List)localObject3).addAll(CMSUtils.getAttributeCertificatesFromStore(paramStore2));
      }
      ASN1Set localASN1Set = CMSUtils.createBerSetFromList((List)localObject3);
      if (localASN1Set.size() != 0) {
        localObject1 = localASN1Set;
      }
    }
    if (paramStore3 != null)
    {
      localObject3 = CMSUtils.createBerSetFromList(CMSUtils.getCRLsFromStore(paramStore3));
      if (((ASN1Set)localObject3).size() != 0) {
        localObject2 = localObject3;
      }
    }
    signedData = new SignedData(signedData.getDigestAlgorithms(), signedData.getEncapContentInfo(), (ASN1Set)localObject1, (ASN1Set)localObject2, signedData.getSignerInfos());
    contentInfo = new ContentInfo(contentInfo.getContentType(), signedData);
    return localCMSSignedData;
  }
}

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

import java.io.IOException;
import java.io.OutputStream;
import org.bouncycastle.asn1.ASN1ObjectIdentifier;

class CMSSignedDataGenerator$1
  implements CMSTypedData
{
  CMSSignedDataGenerator$1(CMSSignedDataGenerator paramCMSSignedDataGenerator, ASN1ObjectIdentifier paramASN1ObjectIdentifier, CMSProcessable paramCMSProcessable)
    throws CMSException, IOException
  {}
  
  public ASN1ObjectIdentifier getContentType()
  {
    return val$contentTypeOID;
  }
  
  public void write(OutputStream paramOutputStream)
    throws IOException, CMSException
  {
    val$content.write(paramOutputStream);
  }
  
  public Object getContent()
  {
    return val$content.getContent();
  }
}

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

import java.io.IOException;
import java.security.NoSuchAlgorithmException;
import java.security.PrivateKey;
import java.security.Provider;
import java.security.SecureRandom;
import java.security.cert.CertificateEncodingException;
import java.security.cert.X509Certificate;
import org.bouncycastle.asn1.cms.AttributeTable;
import org.bouncycastle.cms.jcajce.JcaSignerInfoGeneratorBuilder;
import org.bouncycastle.operator.ContentSigner;
import org.bouncycastle.operator.OperatorCreationException;
import org.bouncycastle.operator.bc.BcDigestCalculatorProvider;
import org.bouncycastle.operator.jcajce.JcaContentSignerBuilder;

class CMSSignedDataGenerator$SignerInf
{
  final PrivateKey key;
  final Object signerIdentifier;
  final String digestOID;
  final String encOID;
  final CMSAttributeTableGenerator sAttr;
  final CMSAttributeTableGenerator unsAttr;
  final AttributeTable baseSignedTable;
  
  CMSSignedDataGenerator$SignerInf(CMSSignedDataGenerator paramCMSSignedDataGenerator, PrivateKey paramPrivateKey, Object paramObject, String paramString1, String paramString2, CMSAttributeTableGenerator paramCMSAttributeTableGenerator1, CMSAttributeTableGenerator paramCMSAttributeTableGenerator2, AttributeTable paramAttributeTable)
  {
    key = paramPrivateKey;
    signerIdentifier = paramObject;
    digestOID = paramString1;
    encOID = paramString2;
    sAttr = paramCMSAttributeTableGenerator1;
    unsAttr = paramCMSAttributeTableGenerator2;
    baseSignedTable = paramAttributeTable;
  }
  
  SignerInfoGenerator toSignerInfoGenerator(SecureRandom paramSecureRandom, Provider paramProvider, boolean paramBoolean)
    throws IOException, CertificateEncodingException, CMSException, OperatorCreationException, NoSuchAlgorithmException
  {
    String str1 = CMSSignedHelper.INSTANCE.getDigestAlgName(digestOID);
    String str2 = str1 + "with" + CMSSignedHelper.INSTANCE.getEncryptionAlgName(encOID);
    JcaSignerInfoGeneratorBuilder localJcaSignerInfoGeneratorBuilder = new JcaSignerInfoGeneratorBuilder(new BcDigestCalculatorProvider());
    if (paramBoolean) {
      localJcaSignerInfoGeneratorBuilder.setSignedAttributeGenerator(sAttr);
    }
    localJcaSignerInfoGeneratorBuilder.setDirectSignature(!paramBoolean);
    localJcaSignerInfoGeneratorBuilder.setUnsignedAttributeGenerator(unsAttr);
    JcaContentSignerBuilder localJcaContentSignerBuilder;
    try
    {
      localJcaContentSignerBuilder = new JcaContentSignerBuilder(str2).setSecureRandom(paramSecureRandom);
    }
    catch (IllegalArgumentException localIllegalArgumentException)
    {
      throw new NoSuchAlgorithmException(localIllegalArgumentException.getMessage());
    }
    if (paramProvider != null) {
      localJcaContentSignerBuilder.setProvider(paramProvider);
    }
    ContentSigner localContentSigner = localJcaContentSignerBuilder.build(key);
    if ((signerIdentifier instanceof X509Certificate)) {
      return localJcaSignerInfoGeneratorBuilder.build(localContentSigner, (X509Certificate)signerIdentifier);
    }
    return localJcaSignerInfoGeneratorBuilder.build(localContentSigner, (byte[])signerIdentifier);
  }
}

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

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.security.NoSuchAlgorithmException;
import java.security.NoSuchProviderException;
import java.security.PrivateKey;
import java.security.Provider;
import java.security.SecureRandom;
import java.security.cert.CertificateEncodingException;
import java.security.cert.X509Certificate;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.bouncycastle.asn1.ASN1Encodable;
import org.bouncycastle.asn1.ASN1EncodableVector;
import org.bouncycastle.asn1.ASN1ObjectIdentifier;
import org.bouncycastle.asn1.ASN1Set;
import org.bouncycastle.asn1.BEROctetString;
import org.bouncycastle.asn1.DERSet;
import org.bouncycastle.asn1.cms.AttributeTable;
import org.bouncycastle.asn1.cms.CMSObjectIdentifiers;
import org.bouncycastle.asn1.cms.ContentInfo;
import org.bouncycastle.asn1.cms.SignedData;
import org.bouncycastle.asn1.cms.SignerInfo;
import org.bouncycastle.asn1.x509.AlgorithmIdentifier;
import org.bouncycastle.cms.jcajce.JcaSignerInfoGeneratorBuilder;
import org.bouncycastle.operator.ContentSigner;
import org.bouncycastle.operator.OperatorCreationException;
import org.bouncycastle.operator.bc.BcDigestCalculatorProvider;
import org.bouncycastle.operator.jcajce.JcaContentSignerBuilder;

public class CMSSignedDataGenerator
  extends CMSSignedGenerator
{
  private List signerInfs = new ArrayList();
  
  public CMSSignedDataGenerator() {}
  
  public CMSSignedDataGenerator(SecureRandom paramSecureRandom)
  {
    super(paramSecureRandom);
  }
  
  /**
   * @deprecated
   */
  public void addSigner(PrivateKey paramPrivateKey, X509Certificate paramX509Certificate, String paramString)
    throws IllegalArgumentException
  {
    addSigner(paramPrivateKey, paramX509Certificate, getEncOID(paramPrivateKey, paramString), paramString);
  }
  
  /**
   * @deprecated
   */
  public void addSigner(PrivateKey paramPrivateKey, X509Certificate paramX509Certificate, String paramString1, String paramString2)
    throws IllegalArgumentException
  {
    doAddSigner(paramPrivateKey, paramX509Certificate, paramString1, paramString2, new DefaultSignedAttributeTableGenerator(), null, null);
  }
  
  /**
   * @deprecated
   */
  public void addSigner(PrivateKey paramPrivateKey, byte[] paramArrayOfByte, String paramString)
    throws IllegalArgumentException
  {
    addSigner(paramPrivateKey, paramArrayOfByte, getEncOID(paramPrivateKey, paramString), paramString);
  }
  
  /**
   * @deprecated
   */
  public void addSigner(PrivateKey paramPrivateKey, byte[] paramArrayOfByte, String paramString1, String paramString2)
    throws IllegalArgumentException
  {
    doAddSigner(paramPrivateKey, paramArrayOfByte, paramString1, paramString2, new DefaultSignedAttributeTableGenerator(), null, null);
  }
  
  /**
   * @deprecated
   */
  public void addSigner(PrivateKey paramPrivateKey, X509Certificate paramX509Certificate, String paramString, AttributeTable paramAttributeTable1, AttributeTable paramAttributeTable2)
    throws IllegalArgumentException
  {
    addSigner(paramPrivateKey, paramX509Certificate, getEncOID(paramPrivateKey, paramString), paramString, paramAttributeTable1, paramAttributeTable2);
  }
  
  /**
   * @deprecated
   */
  public void addSigner(PrivateKey paramPrivateKey, X509Certificate paramX509Certificate, String paramString1, String paramString2, AttributeTable paramAttributeTable1, AttributeTable paramAttributeTable2)
    throws IllegalArgumentException
  {
    doAddSigner(paramPrivateKey, paramX509Certificate, paramString1, paramString2, new DefaultSignedAttributeTableGenerator(paramAttributeTable1), new SimpleAttributeTableGenerator(paramAttributeTable2), paramAttributeTable1);
  }
  
  /**
   * @deprecated
   */
  public void addSigner(PrivateKey paramPrivateKey, byte[] paramArrayOfByte, String paramString, AttributeTable paramAttributeTable1, AttributeTable paramAttributeTable2)
    throws IllegalArgumentException
  {
    addSigner(paramPrivateKey, paramArrayOfByte, getEncOID(paramPrivateKey, paramString), paramString, paramAttributeTable1, paramAttributeTable2);
  }
  
  /**
   * @deprecated
   */
  public void addSigner(PrivateKey paramPrivateKey, byte[] paramArrayOfByte, String paramString1, String paramString2, AttributeTable paramAttributeTable1, AttributeTable paramAttributeTable2)
    throws IllegalArgumentException
  {
    doAddSigner(paramPrivateKey, paramArrayOfByte, paramString1, paramString2, new DefaultSignedAttributeTableGenerator(paramAttributeTable1), new SimpleAttributeTableGenerator(paramAttributeTable2), paramAttributeTable1);
  }
  
  /**
   * @deprecated
   */
  public void addSigner(PrivateKey paramPrivateKey, X509Certificate paramX509Certificate, String paramString, CMSAttributeTableGenerator paramCMSAttributeTableGenerator1, CMSAttributeTableGenerator paramCMSAttributeTableGenerator2)
    throws IllegalArgumentException
  {
    addSigner(paramPrivateKey, paramX509Certificate, getEncOID(paramPrivateKey, paramString), paramString, paramCMSAttributeTableGenerator1, paramCMSAttributeTableGenerator2);
  }
  
  /**
   * @deprecated
   */
  public void addSigner(PrivateKey paramPrivateKey, X509Certificate paramX509Certificate, String paramString1, String paramString2, CMSAttributeTableGenerator paramCMSAttributeTableGenerator1, CMSAttributeTableGenerator paramCMSAttributeTableGenerator2)
    throws IllegalArgumentException
  {
    doAddSigner(paramPrivateKey, paramX509Certificate, paramString1, paramString2, paramCMSAttributeTableGenerator1, paramCMSAttributeTableGenerator2, null);
  }
  
  /**
   * @deprecated
   */
  public void addSigner(PrivateKey paramPrivateKey, byte[] paramArrayOfByte, String paramString, CMSAttributeTableGenerator paramCMSAttributeTableGenerator1, CMSAttributeTableGenerator paramCMSAttributeTableGenerator2)
    throws IllegalArgumentException
  {
    addSigner(paramPrivateKey, paramArrayOfByte, getEncOID(paramPrivateKey, paramString), paramString, paramCMSAttributeTableGenerator1, paramCMSAttributeTableGenerator2);
  }
  
  /**
   * @deprecated
   */
  public void addSigner(PrivateKey paramPrivateKey, byte[] paramArrayOfByte, String paramString1, String paramString2, CMSAttributeTableGenerator paramCMSAttributeTableGenerator1, CMSAttributeTableGenerator paramCMSAttributeTableGenerator2)
    throws IllegalArgumentException
  {
    doAddSigner(paramPrivateKey, paramArrayOfByte, paramString1, paramString2, paramCMSAttributeTableGenerator1, paramCMSAttributeTableGenerator2, null);
  }
  
  private void doAddSigner(PrivateKey paramPrivateKey, Object paramObject, String paramString1, String paramString2, CMSAttributeTableGenerator paramCMSAttributeTableGenerator1, CMSAttributeTableGenerator paramCMSAttributeTableGenerator2, AttributeTable paramAttributeTable)
    throws IllegalArgumentException
  {
    signerInfs.add(new SignerInf(paramPrivateKey, paramObject, paramString2, paramString1, paramCMSAttributeTableGenerator1, paramCMSAttributeTableGenerator2, paramAttributeTable));
  }
  
  /**
   * @deprecated
   */
  public CMSSignedData generate(CMSProcessable paramCMSProcessable, String paramString)
    throws NoSuchAlgorithmException, NoSuchProviderException, CMSException
  {
    return generate(paramCMSProcessable, CMSUtils.getProvider(paramString));
  }
  
  /**
   * @deprecated
   */
  public CMSSignedData generate(CMSProcessable paramCMSProcessable, Provider paramProvider)
    throws NoSuchAlgorithmException, CMSException
  {
    return generate(paramCMSProcessable, false, paramProvider);
  }
  
  /**
   * @deprecated
   */
  public CMSSignedData generate(String paramString1, CMSProcessable paramCMSProcessable, boolean paramBoolean, String paramString2)
    throws NoSuchAlgorithmException, NoSuchProviderException, CMSException
  {
    return generate(paramString1, paramCMSProcessable, paramBoolean, CMSUtils.getProvider(paramString2), true);
  }
  
  /**
   * @deprecated
   */
  public CMSSignedData generate(String paramString, CMSProcessable paramCMSProcessable, boolean paramBoolean, Provider paramProvider)
    throws NoSuchAlgorithmException, CMSException
  {
    return generate(paramString, paramCMSProcessable, paramBoolean, paramProvider, true);
  }
  
  /**
   * @deprecated
   */
  public CMSSignedData generate(String paramString1, CMSProcessable paramCMSProcessable, boolean paramBoolean1, String paramString2, boolean paramBoolean2)
    throws NoSuchAlgorithmException, NoSuchProviderException, CMSException
  {
    return generate(paramString1, paramCMSProcessable, paramBoolean1, CMSUtils.getProvider(paramString2), paramBoolean2);
  }
  
  public CMSSignedData generate(String paramString, final CMSProcessable paramCMSProcessable, boolean paramBoolean1, Provider paramProvider, boolean paramBoolean2)
    throws NoSuchAlgorithmException, CMSException
  {
    int i = paramString == null ? 1 : 0;
    final ASN1ObjectIdentifier localASN1ObjectIdentifier = i != 0 ? null : new ASN1ObjectIdentifier(paramString);
    Iterator localIterator = signerInfs.iterator();
    while (localIterator.hasNext())
    {
      SignerInf localSignerInf = (SignerInf)localIterator.next();
      try
      {
        signerGens.add(localSignerInf.toSignerInfoGenerator(rand, paramProvider, paramBoolean2));
      }
      catch (OperatorCreationException localOperatorCreationException)
      {
        throw new CMSException("exception creating signerInf", localOperatorCreationException);
      }
      catch (IOException localIOException)
      {
        throw new CMSException("exception encoding attributes", localIOException);
      }
      catch (CertificateEncodingException localCertificateEncodingException)
      {
        throw new CMSException("error creating sid.", localCertificateEncodingException);
      }
    }
    signerInfs.clear();
    if (paramCMSProcessable != null) {
      generate(new CMSTypedData()
      {
        public ASN1ObjectIdentifier getContentType()
        {
          return localASN1ObjectIdentifier;
        }
        
        public void write(OutputStream paramAnonymousOutputStream)
          throws IOException, CMSException
        {
          paramCMSProcessable.write(paramAnonymousOutputStream);
        }
        
        public Object getContent()
        {
          return paramCMSProcessable.getContent();
        }
      }, paramBoolean1);
    }
    return generate(new CMSAbsentContent(localASN1ObjectIdentifier), paramBoolean1);
  }
  
  /**
   * @deprecated
   */
  public CMSSignedData generate(CMSProcessable paramCMSProcessable, boolean paramBoolean, String paramString)
    throws NoSuchAlgorithmException, NoSuchProviderException, CMSException
  {
    if ((paramCMSProcessable instanceof CMSTypedData)) {
      return generate(((CMSTypedData)paramCMSProcessable).getContentType().getId(), paramCMSProcessable, paramBoolean, paramString);
    }
    return generate(DATA, paramCMSProcessable, paramBoolean, paramString);
  }
  
  /**
   * @deprecated
   */
  public CMSSignedData generate(CMSProcessable paramCMSProcessable, boolean paramBoolean, Provider paramProvider)
    throws NoSuchAlgorithmException, CMSException
  {
    if ((paramCMSProcessable instanceof CMSTypedData)) {
      return generate(((CMSTypedData)paramCMSProcessable).getContentType().getId(), paramCMSProcessable, paramBoolean, paramProvider);
    }
    return generate(DATA, paramCMSProcessable, paramBoolean, paramProvider);
  }
  
  public CMSSignedData generate(CMSTypedData paramCMSTypedData)
    throws CMSException
  {
    return generate(paramCMSTypedData, false);
  }
  
  public CMSSignedData generate(CMSTypedData paramCMSTypedData, boolean paramBoolean)
    throws CMSException
  {
    if (!signerInfs.isEmpty()) {
      throw new IllegalStateException("this method can only be used with SignerInfoGenerator");
    }
    ASN1EncodableVector localASN1EncodableVector1 = new ASN1EncodableVector();
    ASN1EncodableVector localASN1EncodableVector2 = new ASN1EncodableVector();
    digests.clear();
    Object localObject1 = _signers.iterator();
    while (((Iterator)localObject1).hasNext())
    {
      localObject2 = (SignerInformation)((Iterator)localObject1).next();
      localASN1EncodableVector1.add(CMSSignedHelper.INSTANCE.fixAlgID(((SignerInformation)localObject2).getDigestAlgorithmID()));
      localASN1EncodableVector2.add(((SignerInformation)localObject2).toASN1Structure());
    }
    localObject1 = paramCMSTypedData.getContentType();
    Object localObject2 = null;
    if (paramCMSTypedData != null)
    {
      localObject3 = null;
      if (paramBoolean) {
        localObject3 = new ByteArrayOutputStream();
      }
      localObject4 = CMSUtils.attachSignersToOutputStream(signerGens, (OutputStream)localObject3);
      localObject4 = CMSUtils.getSafeOutputStream((OutputStream)localObject4);
      try
      {
        paramCMSTypedData.write((OutputStream)localObject4);
        ((OutputStream)localObject4).close();
      }
      catch (IOException localIOException)
      {
        throw new CMSException("data processing exception: " + localIOException.getMessage(), localIOException);
      }
      if (paramBoolean) {
        localObject2 = new BEROctetString(((ByteArrayOutputStream)localObject3).toByteArray());
      }
    }
    Object localObject3 = signerGens.iterator();
    while (((Iterator)localObject3).hasNext())
    {
      localObject4 = (SignerInfoGenerator)((Iterator)localObject3).next();
      localObject5 = ((SignerInfoGenerator)localObject4).generate((ASN1ObjectIdentifier)localObject1);
      localASN1EncodableVector1.add(((SignerInfo)localObject5).getDigestAlgorithm());
      localASN1EncodableVector2.add((ASN1Encodable)localObject5);
      localObject6 = ((SignerInfoGenerator)localObject4).getCalculatedDigest();
      if (localObject6 != null) {
        digests.put(((SignerInfo)localObject5).getDigestAlgorithm().getAlgorithm().getId(), localObject6);
      }
    }
    localObject3 = null;
    if (certs.size() != 0) {
      localObject3 = CMSUtils.createBerSetFromList(certs);
    }
    Object localObject4 = null;
    if (crls.size() != 0) {
      localObject4 = CMSUtils.createBerSetFromList(crls);
    }
    Object localObject5 = new ContentInfo((ASN1ObjectIdentifier)localObject1, (ASN1Encodable)localObject2);
    Object localObject6 = new SignedData(new DERSet(localASN1EncodableVector1), (ContentInfo)localObject5, (ASN1Set)localObject3, (ASN1Set)localObject4, new DERSet(localASN1EncodableVector2));
    ContentInfo localContentInfo = new ContentInfo(CMSObjectIdentifiers.signedData, (ASN1Encodable)localObject6);
    return new CMSSignedData(paramCMSTypedData, localContentInfo);
  }
  
  /**
   * @deprecated
   */
  public SignerInformationStore generateCounterSigners(SignerInformation paramSignerInformation, Provider paramProvider)
    throws NoSuchAlgorithmException, CMSException
  {
    return generate(null, new CMSProcessableByteArray(paramSignerInformation.getSignature()), false, paramProvider).getSignerInfos();
  }
  
  /**
   * @deprecated
   */
  public SignerInformationStore generateCounterSigners(SignerInformation paramSignerInformation, String paramString)
    throws NoSuchAlgorithmException, NoSuchProviderException, CMSException
  {
    return generate(null, new CMSProcessableByteArray(paramSignerInformation.getSignature()), false, CMSUtils.getProvider(paramString)).getSignerInfos();
  }
  
  public SignerInformationStore generateCounterSigners(SignerInformation paramSignerInformation)
    throws CMSException
  {
    return generate(new CMSProcessableByteArray(null, paramSignerInformation.getSignature()), false).getSignerInfos();
  }
  
  private class SignerInf
  {
    final PrivateKey key;
    final Object signerIdentifier;
    final String digestOID;
    final String encOID;
    final CMSAttributeTableGenerator sAttr;
    final CMSAttributeTableGenerator unsAttr;
    final AttributeTable baseSignedTable;
    
    SignerInf(PrivateKey paramPrivateKey, Object paramObject, String paramString1, String paramString2, CMSAttributeTableGenerator paramCMSAttributeTableGenerator1, CMSAttributeTableGenerator paramCMSAttributeTableGenerator2, AttributeTable paramAttributeTable)
    {
      key = paramPrivateKey;
      signerIdentifier = paramObject;
      digestOID = paramString1;
      encOID = paramString2;
      sAttr = paramCMSAttributeTableGenerator1;
      unsAttr = paramCMSAttributeTableGenerator2;
      baseSignedTable = paramAttributeTable;
    }
    
    SignerInfoGenerator toSignerInfoGenerator(SecureRandom paramSecureRandom, Provider paramProvider, boolean paramBoolean)
      throws IOException, CertificateEncodingException, CMSException, OperatorCreationException, NoSuchAlgorithmException
    {
      String str1 = CMSSignedHelper.INSTANCE.getDigestAlgName(digestOID);
      String str2 = str1 + "with" + CMSSignedHelper.INSTANCE.getEncryptionAlgName(encOID);
      JcaSignerInfoGeneratorBuilder localJcaSignerInfoGeneratorBuilder = new JcaSignerInfoGeneratorBuilder(new BcDigestCalculatorProvider());
      if (paramBoolean) {
        localJcaSignerInfoGeneratorBuilder.setSignedAttributeGenerator(sAttr);
      }
      localJcaSignerInfoGeneratorBuilder.setDirectSignature(!paramBoolean);
      localJcaSignerInfoGeneratorBuilder.setUnsignedAttributeGenerator(unsAttr);
      JcaContentSignerBuilder localJcaContentSignerBuilder;
      try
      {
        localJcaContentSignerBuilder = new JcaContentSignerBuilder(str2).setSecureRandom(paramSecureRandom);
      }
      catch (IllegalArgumentException localIllegalArgumentException)
      {
        throw new NoSuchAlgorithmException(localIllegalArgumentException.getMessage());
      }
      if (paramProvider != null) {
        localJcaContentSignerBuilder.setProvider(paramProvider);
      }
      ContentSigner localContentSigner = localJcaContentSignerBuilder.build(key);
      if ((signerIdentifier instanceof X509Certificate)) {
        return localJcaSignerInfoGeneratorBuilder.build(localContentSigner, (X509Certificate)signerIdentifier);
      }
      return localJcaSignerInfoGeneratorBuilder.build(localContentSigner, (byte[])signerIdentifier);
    }
  }
}

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

import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.math.BigInteger;
import java.security.NoSuchAlgorithmException;
import java.security.NoSuchProviderException;
import java.security.Provider;
import java.security.cert.CertStore;
import java.security.cert.CertStoreException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.bouncycastle.asn1.ASN1Encodable;
import org.bouncycastle.asn1.ASN1EncodableVector;
import org.bouncycastle.asn1.ASN1Generator;
import org.bouncycastle.asn1.ASN1Integer;
import org.bouncycastle.asn1.ASN1ObjectIdentifier;
import org.bouncycastle.asn1.ASN1OctetStringParser;
import org.bouncycastle.asn1.ASN1Primitive;
import org.bouncycastle.asn1.ASN1Sequence;
import org.bouncycastle.asn1.ASN1SequenceParser;
import org.bouncycastle.asn1.ASN1Set;
import org.bouncycastle.asn1.ASN1SetParser;
import org.bouncycastle.asn1.ASN1StreamParser;
import org.bouncycastle.asn1.ASN1TaggedObject;
import org.bouncycastle.asn1.BERSequenceGenerator;
import org.bouncycastle.asn1.BERSetParser;
import org.bouncycastle.asn1.BERTaggedObject;
import org.bouncycastle.asn1.DERSet;
import org.bouncycastle.asn1.DERTaggedObject;
import org.bouncycastle.asn1.cms.CMSObjectIdentifiers;
import org.bouncycastle.asn1.cms.ContentInfoParser;
import org.bouncycastle.asn1.cms.SignedDataParser;
import org.bouncycastle.asn1.cms.SignerInfo;
import org.bouncycastle.asn1.x509.AlgorithmIdentifier;
import org.bouncycastle.asn1.x509.AttributeCertificate;
import org.bouncycastle.asn1.x509.Certificate;
import org.bouncycastle.asn1.x509.CertificateList;
import org.bouncycastle.cert.X509AttributeCertificateHolder;
import org.bouncycastle.cert.X509CRLHolder;
import org.bouncycastle.cert.X509CertificateHolder;
import org.bouncycastle.operator.DigestCalculator;
import org.bouncycastle.operator.DigestCalculatorProvider;
import org.bouncycastle.operator.OperatorCreationException;
import org.bouncycastle.operator.bc.BcDigestCalculatorProvider;
import org.bouncycastle.util.CollectionStore;
import org.bouncycastle.util.Store;
import org.bouncycastle.util.io.Streams;
import org.bouncycastle.x509.NoSuchStoreException;
import org.bouncycastle.x509.X509Store;

public class CMSSignedDataParser
  extends CMSContentInfoParser
{
  private static final CMSSignedHelper HELPER = CMSSignedHelper.INSTANCE;
  private SignedDataParser _signedData;
  private ASN1ObjectIdentifier _signedContentType;
  private CMSTypedStream _signedContent;
  private Map digests;
  private SignerInformationStore _signerInfoStore;
  private X509Store _attributeStore;
  private ASN1Set _certSet;
  private ASN1Set _crlSet;
  private boolean _isCertCrlParsed;
  private X509Store _certificateStore;
  private X509Store _crlStore;
  
  /**
   * @deprecated
   */
  public CMSSignedDataParser(byte[] paramArrayOfByte)
    throws CMSException
  {
    this(createDefaultDigestProvider(), new ByteArrayInputStream(paramArrayOfByte));
  }
  
  public CMSSignedDataParser(DigestCalculatorProvider paramDigestCalculatorProvider, byte[] paramArrayOfByte)
    throws CMSException
  {
    this(paramDigestCalculatorProvider, new ByteArrayInputStream(paramArrayOfByte));
  }
  
  /**
   * @deprecated
   */
  public CMSSignedDataParser(CMSTypedStream paramCMSTypedStream, byte[] paramArrayOfByte)
    throws CMSException
  {
    this(createDefaultDigestProvider(), paramCMSTypedStream, new ByteArrayInputStream(paramArrayOfByte));
  }
  
  public CMSSignedDataParser(DigestCalculatorProvider paramDigestCalculatorProvider, CMSTypedStream paramCMSTypedStream, byte[] paramArrayOfByte)
    throws CMSException
  {
    this(paramDigestCalculatorProvider, paramCMSTypedStream, new ByteArrayInputStream(paramArrayOfByte));
  }
  
  private static DigestCalculatorProvider createDefaultDigestProvider()
    throws CMSException
  {
    return new BcDigestCalculatorProvider();
  }
  
  /**
   * @deprecated
   */
  pub
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