bcpkix-jdk15on-147

tIdentifier, localAlgorithmParameters);
  }
  
  public AlgorithmIdentifier getAlgorithmIdentifier()
  {
    return algorithmIdentifier;
  }
  
  public OutputStream getOutputStream(OutputStream paramOutputStream)
  {
    return new CipherOutputStream(paramOutputStream, cipher);
  }
  
  public GenericKey getKey()
  {
    return new GenericKey(encKey);
  }
}

/* Location:
 * Qualified Name:     org.bouncycastle.cert.crmf.jcajce.JceCRMFEncryptorBuilder.CRMFOutputEncryptor
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.bouncycastle.cert.crmf.jcajce;

import java.io.OutputStream;
import java.security.AlgorithmParameters;
import java.security.GeneralSecurityException;
import java.security.Provider;
import java.security.SecureRandom;
import javax.crypto.Cipher;
import javax.crypto.CipherOutputStream;
import javax.crypto.KeyGenerator;
import javax.crypto.SecretKey;
import org.bouncycastle.asn1.ASN1ObjectIdentifier;
import org.bouncycastle.asn1.x509.AlgorithmIdentifier;
import org.bouncycastle.cert.crmf.CRMFException;
import org.bouncycastle.jcajce.DefaultJcaJceHelper;
import org.bouncycastle.jcajce.NamedJcaJceHelper;
import org.bouncycastle.jcajce.ProviderJcaJceHelper;
import org.bouncycastle.operator.GenericKey;
import org.bouncycastle.operator.OutputEncryptor;

public class JceCRMFEncryptorBuilder
{
  private final ASN1ObjectIdentifier encryptionOID;
  private final int keySize;
  private CRMFHelper helper = new CRMFHelper(new DefaultJcaJceHelper());
  private SecureRandom random;
  
  public JceCRMFEncryptorBuilder(ASN1ObjectIdentifier paramASN1ObjectIdentifier)
  {
    this(paramASN1ObjectIdentifier, -1);
  }
  
  public JceCRMFEncryptorBuilder(ASN1ObjectIdentifier paramASN1ObjectIdentifier, int paramInt)
  {
    encryptionOID = paramASN1ObjectIdentifier;
    keySize = paramInt;
  }
  
  public JceCRMFEncryptorBuilder setProvider(Provider paramProvider)
  {
    helper = new CRMFHelper(new ProviderJcaJceHelper(paramProvider));
    return this;
  }
  
  public JceCRMFEncryptorBuilder setProvider(String paramString)
  {
    helper = new CRMFHelper(new NamedJcaJceHelper(paramString));
    return this;
  }
  
  public JceCRMFEncryptorBuilder setSecureRandom(SecureRandom paramSecureRandom)
  {
    random = paramSecureRandom;
    return this;
  }
  
  public OutputEncryptor build()
    throws CRMFException
  {
    return new CRMFOutputEncryptor(encryptionOID, keySize, random);
  }
  
  private class CRMFOutputEncryptor
    implements OutputEncryptor
  {
    private SecretKey encKey;
    private AlgorithmIdentifier algorithmIdentifier;
    private Cipher cipher;
    
    CRMFOutputEncryptor(ASN1ObjectIdentifier paramASN1ObjectIdentifier, int paramInt, SecureRandom paramSecureRandom)
      throws CRMFException
    {
      KeyGenerator localKeyGenerator = helper.createKeyGenerator(paramASN1ObjectIdentifier);
      if (paramSecureRandom == null) {
        paramSecureRandom = new SecureRandom();
      }
      if (paramInt < 0) {
        localKeyGenerator.init(paramSecureRandom);
      } else {
        localKeyGenerator.init(paramInt, paramSecureRandom);
      }
      cipher = helper.createCipher(paramASN1ObjectIdentifier);
      encKey = localKeyGenerator.generateKey();
      AlgorithmParameters localAlgorithmParameters = helper.generateParameters(paramASN1ObjectIdentifier, encKey, paramSecureRandom);
      try
      {
        cipher.init(1, encKey, localAlgorithmParameters, paramSecureRandom);
      }
      catch (GeneralSecurityException localGeneralSecurityException)
      {
        throw new CRMFException("unable to initialize cipher: " + localGeneralSecurityException.getMessage(), localGeneralSecurityException);
      }
      if (localAlgorithmParameters == null) {
        localAlgorithmParameters = cipher.getParameters();
      }
      algorithmIdentifier = helper.getAlgorithmIdentifier(paramASN1ObjectIdentifier, localAlgorithmParameters);
    }
    
    public AlgorithmIdentifier getAlgorithmIdentifier()
    {
      return algorithmIdentifier;
    }
    
    public OutputStream getOutputStream(OutputStream paramOutputStream)
    {
      return new CipherOutputStream(paramOutputStream, cipher);
    }
    
    public GenericKey getKey()
    {
      return new GenericKey(encKey);
    }
  }
}

/* Location:
 * Qualified Name:     org.bouncycastle.cert.crmf.jcajce.JceCRMFEncryptorBuilder
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.bouncycastle.cert.crmf.jcajce;

import java.security.GeneralSecurityException;
import java.security.MessageDigest;
import java.security.Provider;
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import org.bouncycastle.asn1.x509.AlgorithmIdentifier;
import org.bouncycastle.cert.crmf.CRMFException;
import org.bouncycastle.cert.crmf.PKMACValuesCalculator;
import org.bouncycastle.jcajce.DefaultJcaJceHelper;
import org.bouncycastle.jcajce.NamedJcaJceHelper;
import org.bouncycastle.jcajce.ProviderJcaJceHelper;

public class JcePKMACValuesCalculator
  implements PKMACValuesCalculator
{
  private MessageDigest digest;
  private Mac mac;
  private CRMFHelper helper = new CRMFHelper(new DefaultJcaJceHelper());
  
  public JcePKMACValuesCalculator setProvider(Provider paramProvider)
  {
    helper = new CRMFHelper(new ProviderJcaJceHelper(paramProvider));
    return this;
  }
  
  public JcePKMACValuesCalculator setProvider(String paramString)
  {
    helper = new CRMFHelper(new NamedJcaJceHelper(paramString));
    return this;
  }
  
  public void setup(AlgorithmIdentifier paramAlgorithmIdentifier1, AlgorithmIdentifier paramAlgorithmIdentifier2)
    throws CRMFException
  {
    digest = helper.createDigest(paramAlgorithmIdentifier1.getAlgorithm());
    mac = helper.createMac(paramAlgorithmIdentifier2.getAlgorithm());
  }
  
  public byte[] calculateDigest(byte[] paramArrayOfByte)
  {
    return digest.digest(paramArrayOfByte);
  }
  
  public byte[] calculateMac(byte[] paramArrayOfByte1, byte[] paramArrayOfByte2)
    throws CRMFException
  {
    try
    {
      mac.init(new SecretKeySpec(paramArrayOfByte1, mac.getAlgorithm()));
      return mac.doFinal(paramArrayOfByte2);
    }
    catch (GeneralSecurityException localGeneralSecurityException)
    {
      throw new CRMFException("failure in setup: " + localGeneralSecurityException.getMessage(), localGeneralSecurityException);
    }
  }
}

/* Location:
 * Qualified Name:     org.bouncycastle.cert.crmf.jcajce.JcePKMACValuesCalculator
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.bouncycastle.cert.jcajce;

import java.security.NoSuchProviderException;
import java.security.cert.CertificateException;
import java.security.cert.CertificateFactory;

abstract class CertHelper
{
  public CertificateFactory getCertificateFactory(String paramString)
    throws NoSuchProviderException, CertificateException
  {
    return createCertificateFactory(paramString);
  }
  
  protected abstract CertificateFactory createCertificateFactory(String paramString)
    throws CertificateException, NoSuchProviderException;
}

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

import java.security.cert.CertificateException;
import java.security.cert.CertificateFactory;

class DefaultCertHelper
  extends CertHelper
{
  protected CertificateFactory createCertificateFactory(String paramString)
    throws CertificateException
  {
    return CertificateFactory.getInstance(paramString);
  }
}

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

import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import org.bouncycastle.util.CollectionStore;
import org.bouncycastle.x509.X509AttributeCertificate;

public class JcaAttrCertStore
  extends CollectionStore
{
  public JcaAttrCertStore(Collection paramCollection)
    throws IOException
  {
    super(convertCerts(paramCollection));
  }
  
  public JcaAttrCertStore(X509AttributeCertificate paramX509AttributeCertificate)
    throws IOException
  {
    this(Collections.singletonList(paramX509AttributeCertificate));
  }
  
  private static Collection convertCerts(Collection paramCollection)
    throws IOException
  {
    ArrayList localArrayList = new ArrayList(paramCollection.size());
    Iterator localIterator = paramCollection.iterator();
    while (localIterator.hasNext())
    {
      Object localObject = localIterator.next();
      if ((localObject instanceof X509AttributeCertificate))
      {
        X509AttributeCertificate localX509AttributeCertificate = (X509AttributeCertificate)localObject;
        localArrayList.add(new JcaX509AttributeCertificateHolder(localX509AttributeCertificate));
      }
      else
      {
        localArrayList.add(localObject);
      }
    }
    return localArrayList;
  }
}

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

import java.io.IOException;
import java.security.cert.CRLException;
import java.security.cert.X509CRL;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import org.bouncycastle.cert.X509CRLHolder;
import org.bouncycastle.util.CollectionStore;

public class JcaCRLStore
  extends CollectionStore
{
  public JcaCRLStore(Collection paramCollection)
    throws CRLException
  {
    super(convertCRLs(paramCollection));
  }
  
  private static Collection convertCRLs(Collection paramCollection)
    throws CRLException
  {
    ArrayList localArrayList = new ArrayList(paramCollection.size());
    Iterator localIterator = paramCollection.iterator();
    while (localIterator.hasNext())
    {
      Object localObject = localIterator.next();
      if ((localObject instanceof X509CRL)) {
        try
        {
          localArrayList.add(new X509CRLHolder(((X509CRL)localObject).getEncoded()));
        }
        catch (IOException localIOException)
        {
          throw new CRLException("cannot read encoding: " + localIOException.getMessage());
        }
      } else {
        localArrayList.add((X509CRLHolder)localObject);
      }
    }
    return localArrayList;
  }
}

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

import java.io.IOException;
import java.security.cert.CertificateEncodingException;
import java.security.cert.X509Certificate;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import org.bouncycastle.cert.X509CertificateHolder;
import org.bouncycastle.util.CollectionStore;

public class JcaCertStore
  extends CollectionStore
{
  public JcaCertStore(Collection paramCollection)
    throws CertificateEncodingException
  {
    super(convertCerts(paramCollection));
  }
  
  private static Collection convertCerts(Collection paramCollection)
    throws CertificateEncodingException
  {
    ArrayList localArrayList = new ArrayList(paramCollection.size());
    Iterator localIterator = paramCollection.iterator();
    while (localIterator.hasNext())
    {
      Object localObject = localIterator.next();
      if ((localObject instanceof X509Certificate))
      {
        X509Certificate localX509Certificate = (X509Certificate)localObject;
        try
        {
          localArrayList.add(new X509CertificateHolder(localX509Certificate.getEncoded()));
        }
        catch (IOException localIOException)
        {
          throw new CertificateEncodingException("unable to read encoding: " + localIOException.getMessage());
        }
      }
      else
      {
        localArrayList.add((X509CertificateHolder)localObject);
      }
    }
    return localArrayList;
  }
}

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

import java.security.GeneralSecurityException;
import java.security.Provider;
import java.security.cert.CRLException;
import java.security.cert.CertStore;
import java.security.cert.CertificateException;
import java.security.cert.CollectionCertStoreParameters;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.bouncycastle.cert.X509CRLHolder;
import org.bouncycastle.cert.X509CertificateHolder;
import org.bouncycastle.util.Store;

public class JcaCertStoreBuilder
{
  private List certs = new ArrayList();
  private List crls = new ArrayList();
  private Object provider;
  private JcaX509CertificateConverter certificateConverter = new JcaX509CertificateConverter();
  private JcaX509CRLConverter crlConverter = new JcaX509CRLConverter();
  
  public JcaCertStoreBuilder addCertificates(Store paramStore)
  {
    certs.addAll(paramStore.getMatches(null));
    return this;
  }
  
  public JcaCertStoreBuilder addCertificate(X509CertificateHolder paramX509CertificateHolder)
  {
    certs.add(paramX509CertificateHolder);
    return this;
  }
  
  public JcaCertStoreBuilder addCRLs(Store paramStore)
  {
    crls.addAll(paramStore.getMatches(null));
    return this;
  }
  
  public JcaCertStoreBuilder addCRL(X509CRLHolder paramX509CRLHolder)
  {
    crls.add(paramX509CRLHolder);
    return this;
  }
  
  public JcaCertStoreBuilder setProvider(String paramString)
    throws GeneralSecurityException
  {
    certificateConverter.setProvider(paramString);
    crlConverter.setProvider(paramString);
    provider = paramString;
    return this;
  }
  
  public JcaCertStoreBuilder setProvider(Provider paramProvider)
    throws GeneralSecurityException
  {
    certificateConverter.setProvider(paramProvider);
    crlConverter.setProvider(paramProvider);
    provider = paramProvider;
    return this;
  }
  
  public CertStore build()
    throws GeneralSecurityException
  {
    CollectionCertStoreParameters localCollectionCertStoreParameters = convertHolders(certificateConverter, crlConverter);
    if ((provider instanceof String)) {
      return CertStore.getInstance("Collection", localCollectionCertStoreParameters, (String)provider);
    }
    if ((provider instanceof Provider)) {
      return CertStore.getInstance("Collection", localCollectionCertStoreParameters, (Provider)provider);
    }
    return CertStore.getInstance("Collection", localCollectionCertStoreParameters);
  }
  
  private CollectionCertStoreParameters convertHolders(JcaX509CertificateConverter paramJcaX509CertificateConverter, JcaX509CRLConverter paramJcaX509CRLConverter)
    throws CertificateException, CRLException
  {
    ArrayList localArrayList = new ArrayList(certs.size() + crls.size());
    Iterator localIterator = certs.iterator();
    while (localIterator.hasNext()) {
      localArrayList.add(paramJcaX509CertificateConverter.getCertificate((X509CertificateHolder)localIterator.next()));
    }
    localIterator = crls.iterator();
    while (localIterator.hasNext()) {
      localArrayList.add(paramJcaX509CRLConverter.getCRL((X509CRLHolder)localIterator.next()));
    }
    return new CollectionCertStoreParameters(localArrayList);
  }
}

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

import java.security.cert.X509Certificate;
import javax.security.auth.x500.X500Principal;
import org.bouncycastle.asn1.x500.X500Name;
import org.bouncycastle.asn1.x500.X500NameStyle;

public class JcaX500NameUtil
{
  public static X500Name getIssuer(X509Certificate paramX509Certificate)
  {
    return X500Name.getInstance(paramX509Certificate.getIssuerX500Principal().getEncoded());
  }
  
  public static X500Name getSubject(X509Certificate paramX509Certificate)
  {
    return X500Name.getInstance(paramX509Certificate.getSubjectX500Principal().getEncoded());
  }
  
  public static X500Name getIssuer(X500NameStyle paramX500NameStyle, X509Certificate paramX509Certificate)
  {
    return X500Name.getInstance(paramX500NameStyle, paramX509Certificate.getIssuerX500Principal().getEncoded());
  }
  
  public static X500Name getSubject(X500NameStyle paramX500NameStyle, X509Certificate paramX509Certificate)
  {
    return X500Name.getInstance(paramX500NameStyle, paramX509Certificate.getSubjectX500Principal().getEncoded());
  }
}

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

import java.io.IOException;
import org.bouncycastle.asn1.x509.AttributeCertificate;
import org.bouncycastle.cert.X509AttributeCertificateHolder;
import org.bouncycastle.x509.X509AttributeCertificate;

public class JcaX509AttributeCertificateHolder
  extends X509AttributeCertificateHolder
{
  public JcaX509AttributeCertificateHolder(X509AttributeCertificate paramX509AttributeCertificate)
    throws IOException
  {
    super(AttributeCertificate.getInstance(paramX509AttributeCertificate.getEncoded()));
  }
}

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

import java.security.cert.CRLException;

class JcaX509CRLConverter$ExCRLException
  extends CRLException
{
  private Throwable cause;
  
  public JcaX509CRLConverter$ExCRLException(JcaX509CRLConverter paramJcaX509CRLConverter, String paramString, Throwable paramThrowable)
  {
    super(paramString);
    cause = paramThrowable;
  }
  
  public Throwable getCause()
  {
    return cause;
  }
}

/* Location:
 * Qualified Name:     org.bouncycastle.cert.jcajce.JcaX509CRLConverter.ExCRLException
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.bouncycastle.cert.jcajce;

import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.security.NoSuchProviderException;
import java.security.Provider;
import java.security.cert.CRLException;
import java.security.cert.CertificateException;
import java.security.cert.CertificateFactory;
import java.security.cert.X509CRL;
import org.bouncycastle.cert.X509CRLHolder;

public class JcaX509CRLConverter
{
  private CertHelper helper = new DefaultCertHelper();
  
  public JcaX509CRLConverter setProvider(Provider paramProvider)
  {
    helper = new ProviderCertHelper(paramProvider);
    return this;
  }
  
  public JcaX509CRLConverter setProvider(String paramString)
  {
    helper = new NamedCertHelper(paramString);
    return this;
  }
  
  public X509CRL getCRL(X509CRLHolder paramX509CRLHolder)
    throws CRLException
  {
    try
    {
      CertificateFactory localCertificateFactory = helper.getCertificateFactory("X.509");
      return (X509CRL)localCertificateFactory.generateCRL(new ByteArrayInputStream(paramX509CRLHolder.getEncoded()));
    }
    catch (IOException localIOException)
    {
      throw new ExCRLException("exception parsing certificate: " + localIOException.getMessage(), localIOException);
    }
    catch (NoSuchProviderException localNoSuchProviderException)
    {
      throw new ExCRLException("cannot find required provider:" + localNoSuchProviderException.getMessage(), localNoSuchProviderException);
    }
    catch (CertificateException localCertificateException)
    {
      throw new ExCRLException("cannot create factory: " + localCertificateException.getMessage(), localCertificateException);
    }
  }
  
  private class ExCRLException
    extends CRLException
  {
    private Throwable cause;
    
    public ExCRLException(String paramString, Throwable paramThrowable)
    {
      super();
      cause = paramThrowable;
    }
    
    public Throwable getCause()
    {
      return cause;
    }
  }
}

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

import java.security.cert.CRLException;
import java.security.cert.X509CRL;
import org.bouncycastle.asn1.x509.CertificateList;
import org.bouncycastle.cert.X509CRLHolder;

public class JcaX509CRLHolder
  extends X509CRLHolder
{
  public JcaX509CRLHolder(X509CRL paramX509CRL)
    throws CRLException
  {
    super(CertificateList.getInstance(paramX509CRL.getEncoded()));
  }
}

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

import java.security.cert.CertificateException;

class JcaX509CertificateConverter$ExCertificateException
  extends CertificateException
{
  private Throwable cause;
  
  public JcaX509CertificateConverter$ExCertificateException(JcaX509CertificateConverter paramJcaX509CertificateConverter, String paramString, Throwable paramThrowable)
  {
    super(paramString);
    cause = paramThrowable;
  }
  
  public Throwable getCause()
  {
    return cause;
  }
}

/* Location:
 * Qualified Name:     org.bouncycastle.cert.jcajce.JcaX509CertificateConverter.ExCertificateException
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.bouncycastle.cert.jcajce;

import java.security.cert.CertificateParsingException;

class JcaX509CertificateConverter$ExCertificateParsingException
  extends CertificateParsingException
{
  private Throwable cause;
  
  public JcaX509CertificateConverter$ExCertificateParsingException(JcaX509CertificateConverter paramJcaX509CertificateConverter, String paramString, Throwable paramThrowable)
  {
    super(paramString);
    cause = paramThrowable;
  }
  
  public Throwable getCause()
  {
    return cause;
  }
}

/* Location:
 * Qualified Name:     org.bouncycastle.cert.jcajce.JcaX509CertificateConverter.ExCertificateParsingException
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.bouncycastle.cert.jcajce;

import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.security.NoSuchProviderException;
import java.security.Provider;
import java.security.cert.CertificateException;
import java.security.cert.CertificateFactory;
import java.security.cert.CertificateParsingException;
import java.security.cert.X509Certificate;
import org.bouncycastle.cert.X509CertificateHolder;

public class JcaX509CertificateConverter
{
  private CertHelper helper = new DefaultCertHelper();
  
  public JcaX509CertificateConverter setProvider(Provider paramProvider)
  {
    helper = new ProviderCertHelper(paramProvider);
    return this;
  }
  
  public JcaX509CertificateConverter setProvider(String paramString)
  {
    helper = new NamedCertHelper(paramString);
    return this;
  }
  
  public X509Certificate getCertificate(X509CertificateHolder paramX509CertificateHolder)
    throws CertificateException
  {
    try
    {
      CertificateFactory localCertificateFactory = helper.getCertificateFactory("X.509");
      return (X509Certificate)localCertificateFactory.generateCertificate(new ByteArrayInputStream(paramX509CertificateHolder.getEncoded()));
    }
    catch (IOException localIOException)
    {
      throw new ExCertificateParsingException("exception parsing certificate: " + localIOException.getMessage(), localIOException);
    }
    catch (NoSuchProviderException localNoSuchProviderException)
    {
      throw new ExCertificateException("cannot find required provider:" + localNoSuchProviderException.getMessage(), localNoSuchProviderException);
    }
  }
  
  private class ExCertificateException
    extends CertificateException
  {
    private Throwable cause;
    
    public ExCertificateException(String paramString, Throwable paramThrowable)
    {
      super();
      cause = paramThrowable;
    }
    
    public Throwable getCause()
    {
      return cause;
    }
  }
  
  private class ExCertificateParsingException
    extends CertificateParsingException
  {
    private Throwable cause;
    
    public ExCertificateParsingException(String paramString, Throwable paramThrowable)
    {
      super();
      cause = paramThrowable;
    }
    
    public Throwable getCause()
    {
      return cause;
    }
  }
}

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

import java.security.cert.CertificateEncodingException;
import java.security.cert.X509Certificate;
import org.bouncycastle.asn1.x509.Certificate;
import org.bouncycastle.cert.X509CertificateHolder;

public class JcaX509CertificateHolder
  extends X509CertificateHolder
{
  public JcaX509CertificateHolder(X509Certificate paramX509Certificate)
    throws CertificateEncodingException
  {
    super(Certificate.getInstance(paramX509Certificate.getEncoded()));
  }
}

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

import java.io.ByteArrayOutputStream;
import java.io.OutputStream;
import java.security.MessageDigest;
import org.bouncycastle.asn1.oiw.OIWObjectIdentifiers;
import org.bouncycastle.asn1.x509.AlgorithmIdentifier;
import org.bouncycastle.operator.DigestCalculator;

class JcaX509ExtensionUtils$SHA1DigestCalculator
  implements DigestCalculator
{
  private ByteArrayOutputStream bOut = new ByteArrayOutputStream();
  private MessageDigest digest;
  
  public JcaX509ExtensionUtils$SHA1DigestCalculator(MessageDigest paramMessageDigest)
  {
    digest = paramMessageDigest;
  }
  
  public AlgorithmIdentifier getAlgorithmIdentifier()
  {
    return new AlgorithmIdentifier(OIWObjectIdentifiers.idSHA1);
  }
  
  public OutputStream getOutputStream()
  {
    return bOut;
  }
  
  public byte[] getDigest()
  {
    byte[] arrayOfByte = digest.digest(bOut.toByteArray());
    bOut.reset();
    return arrayOfByte;
  }
}

/* Location:
 * Qualified Name:     org.bouncycastle.cert.jcajce.JcaX509ExtensionUtils.SHA1DigestCalculator
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.bouncycastle.cert.jcajce;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.security.PublicKey;
import java.security.cert.CertificateEncodingException;
import java.security.cert.X509Certificate;
import org.bouncycastle.asn1.ASN1OctetString;
import org.bouncycastle.asn1.ASN1Primitive;
import org.bouncycastle.asn1.oiw.OIWObjectIdentifiers;
import org.bouncycastle.asn1.x509.AlgorithmIdentifier;
import org.bouncycastle.asn1.x509.AuthorityKeyIdentifier;
import org.bouncycastle.asn1.x509.SubjectKeyIdentifier;
import org.bouncycastle.asn1.x509.SubjectPublicKeyInfo;
import org.bouncycastle.cert.X509ExtensionUtils;
import org.bouncycastle.operator.DigestCalculator;

public class JcaX509ExtensionUtils
  extends X509ExtensionUtils
{
  public JcaX509ExtensionUtils()
    throws NoSuchAlgorithmException
  {
    super(new SHA1DigestCalculator(MessageDigest.getInstance("SHA1")));
  }
  
  public JcaX509ExtensionUtils(DigestCalculator paramDigestCalculator)
  {
    super(paramDigestCalculator);
  }
  
  public AuthorityKeyIdentifier createAuthorityKeyIdentifier(X509Certificate paramX509Certificate)
    throws CertificateEncodingException
  {
    return super.createAuthorityKeyIdentifier(new JcaX509CertificateHolder(paramX509Certificate));
  }
  
  public AuthorityKeyIdentifier createAuthorityKeyIdentifier(PublicKey paramPublicKey)
  {
    return super.createAuthorityKeyIdentifier(SubjectPublicKeyInfo.getInstance(paramPublicKey.getEncoded()));
  }
  
  public SubjectKeyIdentifier createSubjectKeyIdentifier(PublicKey paramPublicKey)
  {
    return super.createSubjectKeyIdentifier(SubjectPublicKeyInfo.getInstance(paramPublicKey.getEncoded()));
  }
  
  public SubjectKeyIdentifier createTruncatedSubjectKeyIdentifier(PublicKey paramPublicKey)
  {
    return super.createSubjectKeyIdentifier(SubjectPublicKeyInfo.getInstance(paramPublicKey.getEncoded()));
  }
  
  public static ASN1Primitive parseExtensionValue(byte[] paramArrayOfByte)
    throws IOException
  {
    return ASN1Primitive.fromByteArray(ASN1OctetString.getInstance(paramArrayOfByte).getOctets());
  }
  
  private static class SHA1DigestCalculator
    implements DigestCalculator
  {
    private ByteArrayOutputStream bOut = new ByteArrayOutputStream();
    private MessageDigest digest;
    
    public SHA1DigestCalculator(MessageDigest paramMessageDigest)
    {
      digest = paramMessageDigest;
    }
    
    public AlgorithmIdentifier getAlgorithmIdentifier()
    {
      return new AlgorithmIdentifier(OIWObjectIdentifiers.idSHA1);
    }
    
    public OutputStream getOutputStream()
    {
      return bOut;
    }
    
    public byte[] getDigest()
    {
      byte[] arrayOfByte = digest.digest(bOut.toByteArray());
      bOut.reset();
      return arrayOfByte;
    }
  }
}

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

import java.math.BigInteger;
import java.security.PublicKey;
import java.util.Date;
import javax.security.auth.x500.X500Principal;
import org.bouncycastle.asn1.x500.X500Name;
import org.bouncycastle.asn1.x509.SubjectPublicKeyInfo;
import org.bouncycastle.cert.X509v1CertificateBuilder;

public class JcaX509v1CertificateBuilder
  extends X509v1CertificateBuilder
{
  public JcaX509v1CertificateBuilder(X500Name paramX500Name1, BigInteger paramBigInteger, Date paramDate1, Date paramDate2, X500Name paramX500Name2, PublicKey paramPublicKey)
  {
    super(paramX500Name1, paramBigInteger, paramDate1, paramDate2, paramX500Name2, SubjectPublicKeyInfo.getInstance(paramPublicKey.getEncoded()));
  }
  
  public JcaX509v1CertificateBuilder(X500Principal paramX500Principal1, BigInteger paramBigInteger, Date paramDate1, Date paramDate2, X500Principal paramX500Principal2, PublicKey paramPublicKey)
  {
    super(X500Name.getInstance(paramX500Principal1.getEncoded()), paramBigInteger, paramDate1, paramDate2, X500Name.getInstance(paramX500Principal2.getEncoded()), SubjectPublicKeyInfo.getInstance(paramPublicKey.getEncoded()));
  }
}

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

import java.util.Date;
import javax.security.auth.x500.X500Principal;
import org.bouncycastle.asn1.x500.X500Name;
import org.bouncycastle.cert.X509v2CRLBuilder;

public class JcaX509v2CRLBuilder
  extends X509v2CRLBuilder
{
  public JcaX509v2CRLBuilder(X500Principal paramX500Principal, Date paramDate)
  {
    super(X500Name.getInstance(paramX500Principal.getEncoded()), paramDate);
  }
}

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

import java.math.BigInteger;
import java.security.PublicKey;
import java.security.cert.CertificateEncodingException;
import java.security.cert.X509Certificate;
import java.util.Date;
import javax.security.auth.x500.X500Principal;
import org.bouncycastle.asn1.ASN1ObjectIdentifier;
import org.bouncycastle.asn1.x500.X500Name;
import org.bouncycastle.asn1.x509.SubjectPublicKeyInfo;
import org.bouncycastle.cert.X509v3CertificateBuilder;

public class JcaX509v3CertificateBuilder
  extends X509v3CertificateBuilder
{
  public JcaX509v3CertificateBuilder(X500Name paramX500Name1, BigInteger paramBigInteger, Date paramDate1, Date paramDate2, X500Name paramX500Name2, PublicKey paramPublicKey)
  {
    super(paramX500Name1, paramBigInteger, paramDate1, paramDate2, paramX500Name2, SubjectPublicKeyInfo.getInstance(paramPublicKey.getEncoded()));
  }
  
  public JcaX509v3CertificateBuilder(X500Principal paramX500Principal1, BigInteger paramBigInteger, Date paramDate1, Date paramDate2, X500Principal paramX500Principal2, PublicKey paramPublicKey)
  {
    super(X500Name.getInstance(paramX500Principal1.getEncoded()), paramBigInteger, paramDate1, paramDate2, X500Name.getInstance(paramX500Principal2.getEncoded()), SubjectPublicKeyInfo.getInstance(paramPublicKey.getEncoded()));
  }
  
  public JcaX509v3CertificateBuilder(X509Certificate paramX509Certificate, BigInteger paramBigInteger, Date paramDate1, Date paramDate2, X500Principal paramX500Principal, PublicKey paramPublicKey)
  {
    this(paramX509Certificate.getSubjectX500Principal(), paramBigInteger, paramDate1, paramDate2, paramX500Principal, paramPublicKey);
  }
  
  public JcaX509v3CertificateBuilder copyAndAddExtension(ASN1ObjectIdentifier paramASN1ObjectIdentifier, boolean paramBoolean, X509Certificate paramX509Certificate)
    throws CertificateEncodingException
  {
    copyAndAddExtension(paramASN1ObjectIdentifier, paramBoolean, new JcaX509CertificateHolder(paramX509Certificate));
    return this;
  }
}

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

import java.security.NoSuchProviderException;
import java.security.cert.CertificateException;
import java.security.cert.CertificateFactory;

class NamedCertHelper
  extends CertHelper
{
  private final String providerName;
  
  NamedCertHelper(String paramString)
  {
    providerName = paramString;
  }
  
  protected CertificateFactory createCertificateFactory(String paramString)
    throws CertificateException, NoSuchProviderException
  {
    return CertificateFactory.getInstance(paramString, providerName);
  }
}

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

import java.security.Provider;
import java.security.cert.CertificateException;
import java.security.cert.CertificateFactory;

class ProviderCertHelper
  extends CertHelper
{
  private final Provider provider;
  
  ProviderCertHelper(Provider paramProvider)
  {
    provider = paramProvider;
  }
  
  protected CertificateFactory createCertificateFactory(String paramString)
    throws CertificateException
  {
    return CertificateFactory.getInstance(paramString, provider);
  }
}

/* Location:
 * Qualified Name:     org.bouncycastle.cert.jcajce.ProviderCertHelper
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.bouncycastle.cert.ocsp;

import java.io.IOException;
import java.io.OutputStream;
import java.math.BigInteger;
import java.util.Date;
import java.util.List;
import java.util.Set;
import org.bouncycastle.asn1.ASN1Integer;
import org.bouncycastle.asn1.ASN1ObjectIdentifier;
import org.bouncycastle.asn1.ASN1Sequence;
import org.bouncycastle.asn1.DERBitString;
import org.bouncycastle.asn1.ocsp.BasicOCSPResponse;
import org.bouncycastle.asn1.ocsp.ResponseData;
import org.bouncycastle.asn1.ocsp.SingleResponse;
import org.bouncycastle.asn1.x509.AlgorithmIdentifier;
import org.bouncycastle.asn1.x509.Certificate;
import org.bouncycastle.asn1.x509.Extension;
import org.bouncycastle.asn1.x509.Extensions;
import org.bouncycastle.cert.X509CertificateHolder;
import org.bouncycastle.operator.ContentVerifier;
import org.bouncycastle.operator.ContentVerifierProvider;

public class BasicOCSPResp
{
  private BasicOCSPResponse resp;
  private ResponseData data;
  private Extensions extensions;
  
  public BasicOCSPResp(BasicOCSPResponse paramBasicOCSPResponse)
  {
    resp = paramBasicOCSPResponse;
    data = paramBasicOCSPResponse.getTbsResponseData();
    extensions = Extensions.getInstance(paramBasicOCSPResponse.getTbsResponseData().getResponseExtensions());
  }
  
  public byte[] getTBSResponseData()
  {
    try
    {
      return resp.getTbsResponseData().getEncoded("DER");
    }
    catch (IOException localIOException) {}
    return null;
  }
  
  public int getVersion()
  {
    return data.getVersion().getValue().intValue() + 1;
  }
  
  public RespID getResponderId()
  {
    return new RespID(data.getResponderID());
  }
  
  public Date getProducedAt()
  {
    return OCSPUtils.extractDate(data.getProducedAt());
  }
  
  public SingleResp[] getResponses()
  {
    ASN1Sequence localASN1Sequence = data.getResponses();
    SingleResp[] arrayOfSingleResp = new SingleResp[localASN1Sequence.size()];
    for (int i = 0; i != arrayOfSingleResp.length; i++) {
      arrayOfSingleResp[i] = new SingleResp(SingleResponse.getInstance(localASN1Sequence.getObjectAt(i)));
    }
    return arrayOfSingleResp;
  }
  
  public boolean hasExtensions()
  {
    return extensions != null;
  }
  
  public Extension getExtension(ASN1ObjectIdentifier paramASN1ObjectIdentifier)
  {
    if (extensions != null) {
      return extensions.getExtension(paramASN1ObjectIdentifier);
    }
    return null;
  }
  
  public List getExtensionOIDs()
  {
    return OCSPUtils.getExtensionOIDs(extensions);
  }
  
  public Set getCriticalExtensionOIDs()
  {
    return OCSPUtils.getCriticalExtensionOIDs(extensions);
  }
  
  public Set getNonCriticalExtensionOIDs()
  {
    return OCSPUtils.getNonCriticalExtensionOIDs(extensions);
  }
  
  public ASN1ObjectIdentifier getSignatureAlgOID()
  {
    return resp.getSignatureAlgorithm().getAlgorithm();
  }
  
  public byte[] getSignature()
  {
    return resp.getSignature().getBytes();
  }
  
  public X509CertificateHolder[] getCerts()
  {
    if (resp.getCerts() != null)
    {
      ASN1Sequence localASN1Sequence = resp.getCerts();
      if (localASN1Sequence != null)
      {
        X509CertificateHolder[] arrayOfX509CertificateHolder = new X509CertificateHolder[localASN1Sequence.size()];
        for (int i = 0; i != arrayOfX509CertificateHolder.length; i++) {
          arrayOfX509CertificateHolder[i] = new X509CertificateHolder(Certificate.getInstance(localASN1Sequence.getObjectAt(i)));
        }
        return arrayOfX509CertificateHolder;
      }
      return OCSPUtils.EMPTY_CERTS;
    }
    return OCSPUtils.EMPTY_CERTS;
  }
  
  public boolean isSignatureValid(ContentVerifierProvider paramContentVerifierProvider)
    throws OCSPException
  {
    try
    {
      ContentVerifier localContentVerifier = paramContentVerifierProvider.get(resp.getSignatureAlgorithm());
      OutputStream localOutputStream = localContentVerifier.getOutputStream();
      localOutputStream.write(resp.getTbsResponseData().getEncoded("DER"));
      localOutputStream.close();
      return localContentVerifier.verify(getSignature());
    }
    catch (Exception localException)
    {
      throw new OCSPException("exception processing sig: " + localException, localException);
    }
  }
  
  public byte[] getEncoded()
    throws IOException
  {
    return resp.getEncoded();
  }
  
  public boolean equals(Object paramObject)
  {
    if (paramObject == this) {
      return true;
    }
    if (!(paramObject instanceof BasicOCSPResp)) {
      return false;
    }
    BasicOCSPResp localBasicOCSPResp = (BasicOCSPResp)paramObject;
    return resp.equals(resp);
  }
  
  public int hashCode()
  {
    return resp.hashCode();
  }
}

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

import java.util.Date;
import org.bouncycastle.asn1.DERGeneralizedTime;
import or
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