bcpkix-jdk15on-147

tch (CryptoException localCryptoException)
        {
          throw new RuntimeOperatorException("exception obtaining signature: " + localCryptoException.getMessage(), localCryptoException);
        }
      }
    };
  }
  
  protected abstract Signer createSigner(AlgorithmIdentifier paramAlgorithmIdentifier1, AlgorithmIdentifier paramAlgorithmIdentifier2)
    throws OperatorCreationException;
}

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

import java.io.IOException;
import org.bouncycastle.asn1.x509.AlgorithmIdentifier;
import org.bouncycastle.cert.X509CertificateHolder;
import org.bouncycastle.crypto.params.AsymmetricKeyParameter;
import org.bouncycastle.operator.ContentVerifier;
import org.bouncycastle.operator.ContentVerifierProvider;
import org.bouncycastle.operator.OperatorCreationException;

class BcContentVerifierProviderBuilder$1
  implements ContentVerifierProvider
{
  BcContentVerifierProviderBuilder$1(BcContentVerifierProviderBuilder paramBcContentVerifierProviderBuilder, X509CertificateHolder paramX509CertificateHolder)
    throws OperatorCreationException
  {}
  
  public boolean hasAssociatedCertificate()
  {
    return true;
  }
  
  public X509CertificateHolder getAssociatedCertificate()
  {
    return val$certHolder;
  }
  
  public ContentVerifier get(AlgorithmIdentifier paramAlgorithmIdentifier)
    throws OperatorCreationException
  {
    try
    {
      AsymmetricKeyParameter localAsymmetricKeyParameter = this$0.extractKeyParameters(val$certHolder.getSubjectPublicKeyInfo());
      BcSignerOutputStream localBcSignerOutputStream = BcContentVerifierProviderBuilder.access$000(this$0, paramAlgorithmIdentifier, localAsymmetricKeyParameter);
      return new BcContentVerifierProviderBuilder.SigVerifier(this$0, paramAlgorithmIdentifier, localBcSignerOutputStream);
    }
    catch (IOException localIOException)
    {
      throw new OperatorCreationException("exception on setup: " + localIOException, localIOException);
    }
  }
}

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

import org.bouncycastle.asn1.x509.AlgorithmIdentifier;
import org.bouncycastle.cert.X509CertificateHolder;
import org.bouncycastle.crypto.params.AsymmetricKeyParameter;
import org.bouncycastle.operator.ContentVerifier;
import org.bouncycastle.operator.ContentVerifierProvider;
import org.bouncycastle.operator.OperatorCreationException;

class BcContentVerifierProviderBuilder$2
  implements ContentVerifierProvider
{
  BcContentVerifierProviderBuilder$2(BcContentVerifierProviderBuilder paramBcContentVerifierProviderBuilder, AsymmetricKeyParameter paramAsymmetricKeyParameter)
    throws OperatorCreationException
  {}
  
  public boolean hasAssociatedCertificate()
  {
    return false;
  }
  
  public X509CertificateHolder getAssociatedCertificate()
  {
    return null;
  }
  
  public ContentVerifier get(AlgorithmIdentifier paramAlgorithmIdentifier)
    throws OperatorCreationException
  {
    BcSignerOutputStream localBcSignerOutputStream = BcContentVerifierProviderBuilder.access$000(this$0, paramAlgorithmIdentifier, val$publicKey);
    return new BcContentVerifierProviderBuilder.SigVerifier(this$0, paramAlgorithmIdentifier, localBcSignerOutputStream);
  }
}

/* Location:
 * Qualified Name:     org.bouncycastle.operator.bc.BcContentVerifierProviderBuilder.2
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.bouncycastle.operator.bc;

import java.io.OutputStream;
import org.bouncycastle.asn1.x509.AlgorithmIdentifier;
import org.bouncycastle.operator.ContentVerifier;

class BcContentVerifierProviderBuilder$SigVerifier
  implements ContentVerifier
{
  private BcSignerOutputStream stream;
  private AlgorithmIdentifier algorithm;
  
  BcContentVerifierProviderBuilder$SigVerifier(BcContentVerifierProviderBuilder paramBcContentVerifierProviderBuilder, AlgorithmIdentifier paramAlgorithmIdentifier, BcSignerOutputStream paramBcSignerOutputStream)
  {
    algorithm = paramAlgorithmIdentifier;
    stream = paramBcSignerOutputStream;
  }
  
  public AlgorithmIdentifier getAlgorithmIdentifier()
  {
    return algorithm;
  }
  
  public OutputStream getOutputStream()
  {
    if (stream == null) {
      throw new IllegalStateException("verifier not initialised");
    }
    return stream;
  }
  
  public boolean verify(byte[] paramArrayOfByte)
  {
    return stream.verify(paramArrayOfByte);
  }
}

/* Location:
 * Qualified Name:     org.bouncycastle.operator.bc.BcContentVerifierProviderBuilder.SigVerifier
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.bouncycastle.operator.bc;

import java.io.IOException;
import java.io.OutputStream;
import org.bouncycastle.asn1.x509.AlgorithmIdentifier;
import org.bouncycastle.asn1.x509.SubjectPublicKeyInfo;
import org.bouncycastle.cert.X509CertificateHolder;
import org.bouncycastle.crypto.Signer;
import org.bouncycastle.crypto.params.AsymmetricKeyParameter;
import org.bouncycastle.operator.ContentVerifier;
import org.bouncycastle.operator.ContentVerifierProvider;
import org.bouncycastle.operator.OperatorCreationException;

public abstract class BcContentVerifierProviderBuilder
{
  public ContentVerifierProvider build(final X509CertificateHolder paramX509CertificateHolder)
    throws OperatorCreationException
  {
    new ContentVerifierProvider()
    {
      public boolean hasAssociatedCertificate()
      {
        return true;
      }
      
      public X509CertificateHolder getAssociatedCertificate()
      {
        return paramX509CertificateHolder;
      }
      
      public ContentVerifier get(AlgorithmIdentifier paramAnonymousAlgorithmIdentifier)
        throws OperatorCreationException
      {
        try
        {
          AsymmetricKeyParameter localAsymmetricKeyParameter = extractKeyParameters(paramX509CertificateHolder.getSubjectPublicKeyInfo());
          BcSignerOutputStream localBcSignerOutputStream = BcContentVerifierProviderBuilder.this.createSignatureStream(paramAnonymousAlgorithmIdentifier, localAsymmetricKeyParameter);
          return new BcContentVerifierProviderBuilder.SigVerifier(BcContentVerifierProviderBuilder.this, paramAnonymousAlgorithmIdentifier, localBcSignerOutputStream);
        }
        catch (IOException localIOException)
        {
          throw new OperatorCreationException("exception on setup: " + localIOException, localIOException);
        }
      }
    };
  }
  
  public ContentVerifierProvider build(final AsymmetricKeyParameter paramAsymmetricKeyParameter)
    throws OperatorCreationException
  {
    new ContentVerifierProvider()
    {
      public boolean hasAssociatedCertificate()
      {
        return false;
      }
      
      public X509CertificateHolder getAssociatedCertificate()
      {
        return null;
      }
      
      public ContentVerifier get(AlgorithmIdentifier paramAnonymousAlgorithmIdentifier)
        throws OperatorCreationException
      {
        BcSignerOutputStream localBcSignerOutputStream = BcContentVerifierProviderBuilder.this.createSignatureStream(paramAnonymousAlgorithmIdentifier, paramAsymmetricKeyParameter);
        return new BcContentVerifierProviderBuilder.SigVerifier(BcContentVerifierProviderBuilder.this, paramAnonymousAlgorithmIdentifier, localBcSignerOutputStream);
      }
    };
  }
  
  private BcSignerOutputStream createSignatureStream(AlgorithmIdentifier paramAlgorithmIdentifier, AsymmetricKeyParameter paramAsymmetricKeyParameter)
    throws OperatorCreationException
  {
    Signer localSigner = createSigner(paramAlgorithmIdentifier);
    localSigner.init(false, paramAsymmetricKeyParameter);
    return new BcSignerOutputStream(localSigner);
  }
  
  protected abstract AsymmetricKeyParameter extractKeyParameters(SubjectPublicKeyInfo paramSubjectPublicKeyInfo)
    throws IOException;
  
  protected abstract Signer createSigner(AlgorithmIdentifier paramAlgorithmIdentifier)
    throws OperatorCreationException;
  
  private class SigVerifier
    implements ContentVerifier
  {
    private BcSignerOutputStream stream;
    private AlgorithmIdentifier algorithm;
    
    SigVerifier(AlgorithmIdentifier paramAlgorithmIdentifier, BcSignerOutputStream paramBcSignerOutputStream)
    {
      algorithm = paramAlgorithmIdentifier;
      stream = paramBcSignerOutputStream;
    }
    
    public AlgorithmIdentifier getAlgorithmIdentifier()
    {
      return algorithm;
    }
    
    public OutputStream getOutputStream()
    {
      if (stream == null) {
        throw new IllegalStateException("verifier not initialised");
      }
      return stream;
    }
    
    public boolean verify(byte[] paramArrayOfByte)
    {
      return stream.verify(paramArrayOfByte);
    }
  }
}

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

import java.io.OutputStream;
import org.bouncycastle.asn1.x509.AlgorithmIdentifier;
import org.bouncycastle.operator.DigestCalculator;

class BcDigestCalculatorProvider$1
  implements DigestCalculator
{
  BcDigestCalculatorProvider$1(BcDigestCalculatorProvider paramBcDigestCalculatorProvider, AlgorithmIdentifier paramAlgorithmIdentifier, BcDigestCalculatorProvider.DigestOutputStream paramDigestOutputStream) {}
  
  public AlgorithmIdentifier getAlgorithmIdentifier()
  {
    return val$algorithm;
  }
  
  public OutputStream getOutputStream()
  {
    return val$stream;
  }
  
  public byte[] getDigest()
  {
    return val$stream.getDigest();
  }
}

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

import java.io.IOException;
import java.io.OutputStream;
import org.bouncycastle.crypto.Digest;

class BcDigestCalculatorProvider$DigestOutputStream
  extends OutputStream
{
  private Digest dig;
  
  BcDigestCalculatorProvider$DigestOutputStream(BcDigestCalculatorProvider paramBcDigestCalculatorProvider, Digest paramDigest)
  {
    dig = paramDigest;
  }
  
  public void write(byte[] paramArrayOfByte, int paramInt1, int paramInt2)
    throws IOException
  {
    dig.update(paramArrayOfByte, paramInt1, paramInt2);
  }
  
  public void write(byte[] paramArrayOfByte)
    throws IOException
  {
    dig.update(paramArrayOfByte, 0, paramArrayOfByte.length);
  }
  
  public void write(int paramInt)
    throws IOException
  {
    dig.update((byte)paramInt);
  }
  
  byte[] getDigest()
  {
    byte[] arrayOfByte = new byte[dig.getDigestSize()];
    dig.doFinal(arrayOfByte, 0);
    return arrayOfByte;
  }
}

/* Location:
 * Qualified Name:     org.bouncycastle.operator.bc.BcDigestCalculatorProvider.DigestOutputStream
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.bouncycastle.operator.bc;

import java.io.IOException;
import java.io.OutputStream;
import org.bouncycastle.asn1.x509.AlgorithmIdentifier;
import org.bouncycastle.crypto.Digest;
import org.bouncycastle.operator.DigestCalculator;
import org.bouncycastle.operator.DigestCalculatorProvider;
import org.bouncycastle.operator.OperatorCreationException;

public class BcDigestCalculatorProvider
  implements DigestCalculatorProvider
{
  public DigestCalculator get(final AlgorithmIdentifier paramAlgorithmIdentifier)
    throws OperatorCreationException
  {
    Digest localDigest = BcUtil.createDigest(paramAlgorithmIdentifier);
    final DigestOutputStream localDigestOutputStream = new DigestOutputStream(localDigest);
    new DigestCalculator()
    {
      public AlgorithmIdentifier getAlgorithmIdentifier()
      {
        return paramAlgorithmIdentifier;
      }
      
      public OutputStream getOutputStream()
      {
        return localDigestOutputStream;
      }
      
      public byte[] getDigest()
      {
        return localDigestOutputStream.getDigest();
      }
    };
  }
  
  private class DigestOutputStream
    extends OutputStream
  {
    private Digest dig;
    
    DigestOutputStream(Digest paramDigest)
    {
      dig = paramDigest;
    }
    
    public void write(byte[] paramArrayOfByte, int paramInt1, int paramInt2)
      throws IOException
    {
      dig.update(paramArrayOfByte, paramInt1, paramInt2);
    }
    
    public void write(byte[] paramArrayOfByte)
      throws IOException
    {
      dig.update(paramArrayOfByte, 0, paramArrayOfByte.length);
    }
    
    public void write(int paramInt)
      throws IOException
    {
      dig.update((byte)paramInt);
    }
    
    byte[] getDigest()
    {
      byte[] arrayOfByte = new byte[dig.getDigestSize()];
      dig.doFinal(arrayOfByte, 0);
      return arrayOfByte;
    }
  }
}

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

import java.io.IOException;
import org.bouncycastle.asn1.ASN1ObjectIdentifier;
import org.bouncycastle.asn1.x509.AlgorithmIdentifier;
import org.bouncycastle.asn1.x509.SubjectPublicKeyInfo;
import org.bouncycastle.crypto.AsymmetricBlockCipher;
import org.bouncycastle.crypto.encodings.PKCS1Encoding;
import org.bouncycastle.crypto.engines.RSAEngine;
import org.bouncycastle.crypto.params.AsymmetricKeyParameter;
import org.bouncycastle.crypto.util.PublicKeyFactory;

public class BcRSAAsymmetricKeyWrapper
  extends BcAsymmetricKeyWrapper
{
  public BcRSAAsymmetricKeyWrapper(AlgorithmIdentifier paramAlgorithmIdentifier, AsymmetricKeyParameter paramAsymmetricKeyParameter)
  {
    super(paramAlgorithmIdentifier, paramAsymmetricKeyParameter);
  }
  
  public BcRSAAsymmetricKeyWrapper(AlgorithmIdentifier paramAlgorithmIdentifier, SubjectPublicKeyInfo paramSubjectPublicKeyInfo)
    throws IOException
  {
    super(paramAlgorithmIdentifier, PublicKeyFactory.createKey(paramSubjectPublicKeyInfo));
  }
  
  protected AsymmetricBlockCipher createAsymmetricWrapper(ASN1ObjectIdentifier paramASN1ObjectIdentifier)
  {
    return new PKCS1Encoding(new RSAEngine());
  }
}

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

import org.bouncycastle.asn1.x509.AlgorithmIdentifier;
import org.bouncycastle.crypto.Digest;
import org.bouncycastle.crypto.Signer;
import org.bouncycastle.crypto.signers.RSADigestSigner;
import org.bouncycastle.operator.OperatorCreationException;

public class BcRSAContentSignerBuilder
  extends BcContentSignerBuilder
{
  public BcRSAContentSignerBuilder(AlgorithmIdentifier paramAlgorithmIdentifier1, AlgorithmIdentifier paramAlgorithmIdentifier2)
  {
    super(paramAlgorithmIdentifier1, paramAlgorithmIdentifier2);
  }
  
  protected Signer createSigner(AlgorithmIdentifier paramAlgorithmIdentifier1, AlgorithmIdentifier paramAlgorithmIdentifier2)
    throws OperatorCreationException
  {
    Digest localDigest = BcUtil.createDigest(paramAlgorithmIdentifier2);
    return new RSADigestSigner(localDigest);
  }
}

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

import java.io.IOException;
import org.bouncycastle.asn1.x509.AlgorithmIdentifier;
import org.bouncycastle.asn1.x509.SubjectPublicKeyInfo;
import org.bouncycastle.crypto.Digest;
import org.bouncycastle.crypto.Signer;
import org.bouncycastle.crypto.params.AsymmetricKeyParameter;
import org.bouncycastle.crypto.signers.RSADigestSigner;
import org.bouncycastle.crypto.util.PublicKeyFactory;
import org.bouncycastle.operator.DigestAlgorithmIdentifierFinder;
import org.bouncycastle.operator.OperatorCreationException;

public class BcRSAContentVerifierProviderBuilder
  extends BcContentVerifierProviderBuilder
{
  private DigestAlgorithmIdentifierFinder digestAlgorithmFinder;
  
  public BcRSAContentVerifierProviderBuilder(DigestAlgorithmIdentifierFinder paramDigestAlgorithmIdentifierFinder)
  {
    digestAlgorithmFinder = paramDigestAlgorithmIdentifierFinder;
  }
  
  protected Signer createSigner(AlgorithmIdentifier paramAlgorithmIdentifier)
    throws OperatorCreationException
  {
    AlgorithmIdentifier localAlgorithmIdentifier = digestAlgorithmFinder.find(paramAlgorithmIdentifier);
    Digest localDigest = BcUtil.createDigest(localAlgorithmIdentifier);
    return new RSADigestSigner(localDigest);
  }
  
  protected AsymmetricKeyParameter extractKeyParameters(SubjectPublicKeyInfo paramSubjectPublicKeyInfo)
    throws IOException
  {
    return PublicKeyFactory.createKey(paramSubjectPublicKeyInfo);
  }
}

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

import java.io.IOException;
import java.io.OutputStream;
import org.bouncycastle.crypto.CryptoException;
import org.bouncycastle.crypto.Signer;

public class BcSignerOutputStream
  extends OutputStream
{
  private Signer sig;
  
  BcSignerOutputStream(Signer paramSigner)
  {
    sig = paramSigner;
  }
  
  public void write(byte[] paramArrayOfByte, int paramInt1, int paramInt2)
    throws IOException
  {
    sig.update(paramArrayOfByte, paramInt1, paramInt2);
  }
  
  public void write(byte[] paramArrayOfByte)
    throws IOException
  {
    sig.update(paramArrayOfByte, 0, paramArrayOfByte.length);
  }
  
  public void write(int paramInt)
    throws IOException
  {
    sig.update((byte)paramInt);
  }
  
  byte[] getSignature()
    throws CryptoException
  {
    return sig.generateSignature();
  }
  
  boolean verify(byte[] paramArrayOfByte)
  {
    return sig.verifySignature(paramArrayOfByte);
  }
}

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

import org.bouncycastle.asn1.ASN1ObjectIdentifier;
import org.bouncycastle.asn1.cryptopro.CryptoProObjectIdentifiers;
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.crypto.Digest;
import org.bouncycastle.crypto.digests.GOST3411Digest;
import org.bouncycastle.crypto.digests.MD2Digest;
import org.bouncycastle.crypto.digests.MD4Digest;
import org.bouncycastle.crypto.digests.MD5Digest;
import org.bouncycastle.crypto.digests.RIPEMD128Digest;
import org.bouncycastle.crypto.digests.RIPEMD160Digest;
import org.bouncycastle.crypto.digests.RIPEMD256Digest;
import org.bouncycastle.crypto.digests.SHA1Digest;
import org.bouncycastle.crypto.digests.SHA224Digest;
import org.bouncycastle.crypto.digests.SHA256Digest;
import org.bouncycastle.crypto.digests.SHA384Digest;
import org.bouncycastle.crypto.digests.SHA512Digest;
import org.bouncycastle.operator.OperatorCreationException;

class BcUtil
{
  static Digest createDigest(AlgorithmIdentifier paramAlgorithmIdentifier)
    throws OperatorCreationException
  {
    Object localObject;
    if (paramAlgorithmIdentifier.getAlgorithm().equals(OIWObjectIdentifiers.idSHA1)) {
      localObject = new SHA1Digest();
    } else if (paramAlgorithmIdentifier.getAlgorithm().equals(NISTObjectIdentifiers.id_sha224)) {
      localObject = new SHA224Digest();
    } else if (paramAlgorithmIdentifier.getAlgorithm().equals(NISTObjectIdentifiers.id_sha256)) {
      localObject = new SHA256Digest();
    } else if (paramAlgorithmIdentifier.getAlgorithm().equals(NISTObjectIdentifiers.id_sha384)) {
      localObject = new SHA384Digest();
    } else if (paramAlgorithmIdentifier.getAlgorithm().equals(NISTObjectIdentifiers.id_sha512)) {
      localObject = new SHA512Digest();
    } else if (paramAlgorithmIdentifier.getAlgorithm().equals(PKCSObjectIdentifiers.md5)) {
      localObject = new MD5Digest();
    } else if (paramAlgorithmIdentifier.getAlgorithm().equals(PKCSObjectIdentifiers.md4)) {
      localObject = new MD4Digest();
    } else if (paramAlgorithmIdentifier.getAlgorithm().equals(PKCSObjectIdentifiers.md2)) {
      localObject = new MD2Digest();
    } else if (paramAlgorithmIdentifier.getAlgorithm().equals(CryptoProObjectIdentifiers.gostR3411)) {
      localObject = new GOST3411Digest();
    } else if (paramAlgorithmIdentifier.getAlgorithm().equals(TeleTrusTObjectIdentifiers.ripemd128)) {
      localObject = new RIPEMD128Digest();
    } else if (paramAlgorithmIdentifier.getAlgorithm().equals(TeleTrusTObjectIdentifiers.ripemd160)) {
      localObject = new RIPEMD160Digest();
    } else if (paramAlgorithmIdentifier.getAlgorithm().equals(TeleTrusTObjectIdentifiers.ripemd256)) {
      localObject = new RIPEMD256Digest();
    } else {
      throw new OperatorCreationException("cannot recognise digest");
    }
    return (Digest)localObject;
  }
}

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

import java.security.Key;
import org.bouncycastle.operator.GenericKey;

class OperatorUtils
{
  static byte[] getKeyBytes(GenericKey paramGenericKey)
  {
    if ((paramGenericKey.getRepresentation() instanceof Key)) {
      return ((Key)paramGenericKey.getRepresentation()).getEncoded();
    }
    if ((paramGenericKey.getRepresentation() instanceof byte[])) {
      return (byte[])paramGenericKey.getRepresentation();
    }
    throw new IllegalArgumentException("unknown generic key type");
  }
}

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

import java.io.OutputStream;
import java.security.Signature;
import java.security.SignatureException;
import org.bouncycastle.asn1.x509.AlgorithmIdentifier;
import org.bouncycastle.operator.ContentSigner;
import org.bouncycastle.operator.RuntimeOperatorException;

class JcaContentSignerBuilder$1
  implements ContentSigner
{
  private JcaContentSignerBuilder.SignatureOutputStream stream = new JcaContentSignerBuilder.SignatureOutputStream(this$0, val$sig);
  
  JcaContentSignerBuilder$1(JcaContentSignerBuilder paramJcaContentSignerBuilder, Signature paramSignature) {}
  
  public AlgorithmIdentifier getAlgorithmIdentifier()
  {
    return JcaContentSignerBuilder.access$000(this$0);
  }
  
  public OutputStream getOutputStream()
  {
    return stream;
  }
  
  public byte[] getSignature()
  {
    try
    {
      return stream.getSignature();
    }
    catch (SignatureException localSignatureException)
    {
      throw new RuntimeOperatorException("exception obtaining signature: " + localSignatureException.getMessage(), localSignatureException);
    }
  }
}

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

import java.io.IOException;
import java.io.OutputStream;
import java.security.Signature;
import java.security.SignatureException;
import org.bouncycastle.operator.OperatorStreamException;

class JcaContentSignerBuilder$SignatureOutputStream
  extends OutputStream
{
  private Signature sig;
  
  JcaContentSignerBuilder$SignatureOutputStream(JcaContentSignerBuilder paramJcaContentSignerBuilder, Signature paramSignature)
  {
    sig = paramSignature;
  }
  
  public void write(byte[] paramArrayOfByte, int paramInt1, int paramInt2)
    throws IOException
  {
    try
    {
      sig.update(paramArrayOfByte, paramInt1, paramInt2);
    }
    catch (SignatureException localSignatureException)
    {
      throw new OperatorStreamException("exception in content signer: " + localSignatureException.getMessage(), localSignatureException);
    }
  }
  
  public void write(byte[] paramArrayOfByte)
    throws IOException
  {
    try
    {
      sig.update(paramArrayOfByte);
    }
    catch (SignatureException localSignatureException)
    {
      throw new OperatorStreamException("exception in content signer: " + localSignatureException.getMessage(), localSignatureException);
    }
  }
  
  public void write(int paramInt)
    throws IOException
  {
    try
    {
      sig.update((byte)paramInt);
    }
    catch (SignatureException localSignatureException)
    {
      throw new OperatorStreamException("exception in content signer: " + localSignatureException.getMessage(), localSignatureException);
    }
  }
  
  byte[] getSignature()
    throws SignatureException
  {
    return sig.sign();
  }
}

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

import java.io.IOException;
import java.io.OutputStream;
import java.security.GeneralSecurityException;
import java.security.PrivateKey;
import java.security.Provider;
import java.security.SecureRandom;
import java.security.Signature;
import java.security.SignatureException;
import org.bouncycastle.asn1.x509.AlgorithmIdentifier;
import org.bouncycastle.jcajce.DefaultJcaJceHelper;
import org.bouncycastle.jcajce.NamedJcaJceHelper;
import org.bouncycastle.jcajce.ProviderJcaJceHelper;
import org.bouncycastle.operator.ContentSigner;
import org.bouncycastle.operator.DefaultSignatureAlgorithmIdentifierFinder;
import org.bouncycastle.operator.OperatorCreationException;
import org.bouncycastle.operator.OperatorStreamException;
import org.bouncycastle.operator.RuntimeOperatorException;

public class JcaContentSignerBuilder
{
  private OperatorHelper helper = new OperatorHelper(new DefaultJcaJceHelper());
  private SecureRandom random;
  private String signatureAlgorithm;
  private AlgorithmIdentifier sigAlgId;
  
  public JcaContentSignerBuilder(String paramString)
  {
    signatureAlgorithm = paramString;
    sigAlgId = new DefaultSignatureAlgorithmIdentifierFinder().find(paramString);
  }
  
  public JcaContentSignerBuilder setProvider(Provider paramProvider)
  {
    helper = new OperatorHelper(new ProviderJcaJceHelper(paramProvider));
    return this;
  }
  
  public JcaContentSignerBuilder setProvider(String paramString)
  {
    helper = new OperatorHelper(new NamedJcaJceHelper(paramString));
    return this;
  }
  
  public JcaContentSignerBuilder setSecureRandom(SecureRandom paramSecureRandom)
  {
    random = paramSecureRandom;
    return this;
  }
  
  public ContentSigner build(PrivateKey paramPrivateKey)
    throws OperatorCreationException
  {
    try
    {
      final Signature localSignature = helper.createSignature(sigAlgId);
      if (random != null) {
        localSignature.initSign(paramPrivateKey, random);
      } else {
        localSignature.initSign(paramPrivateKey);
      }
      new ContentSigner()
      {
        private JcaContentSignerBuilder.SignatureOutputStream stream = new JcaContentSignerBuilder.SignatureOutputStream(JcaContentSignerBuilder.this, localSignature);
        
        public AlgorithmIdentifier getAlgorithmIdentifier()
        {
          return sigAlgId;
        }
        
        public OutputStream getOutputStream()
        {
          return stream;
        }
        
        public byte[] getSignature()
        {
          try
          {
            return stream.getSignature();
          }
          catch (SignatureException localSignatureException)
          {
            throw new RuntimeOperatorException("exception obtaining signature: " + localSignatureException.getMessage(), localSignatureException);
          }
        }
      };
    }
    catch (GeneralSecurityException localGeneralSecurityException)
    {
      throw new OperatorCreationException("cannot create signer: " + localGeneralSecurityException.getMessage(), localGeneralSecurityException);
    }
  }
  
  private class SignatureOutputStream
    extends OutputStream
  {
    private Signature sig;
    
    SignatureOutputStream(Signature paramSignature)
    {
      sig = paramSignature;
    }
    
    public void write(byte[] paramArrayOfByte, int paramInt1, int paramInt2)
      throws IOException
    {
      try
      {
        sig.update(paramArrayOfByte, paramInt1, paramInt2);
      }
      catch (SignatureException localSignatureException)
      {
        throw new OperatorStreamException("exception in content signer: " + localSignatureException.getMessage(), localSignatureException);
      }
    }
    
    public void write(byte[] paramArrayOfByte)
      throws IOException
    {
      try
      {
        sig.update(paramArrayOfByte);
      }
      catch (SignatureException localSignatureException)
      {
        throw new OperatorStreamException("exception in content signer: " + localSignatureException.getMessage(), localSignatureException);
      }
    }
    
    public void write(int paramInt)
      throws IOException
    {
      try
      {
        sig.update((byte)paramInt);
      }
      catch (SignatureException localSignatureException)
      {
        throw new OperatorStreamException("exception in content signer: " + localSignatureException.getMessage(), localSignatureException);
      }
    }
    
    byte[] getSignature()
      throws SignatureException
    {
      return sig.sign();
    }
  }
}

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

import java.security.GeneralSecurityException;
import java.security.Signature;
import java.security.cert.X509Certificate;
import org.bouncycastle.asn1.x509.AlgorithmIdentifier;
import org.bouncycastle.cert.X509CertificateHolder;
import org.bouncycastle.operator.ContentVerifier;
import org.bouncycastle.operator.ContentVerifierProvider;
import org.bouncycastle.operator.OperatorCreationException;

class JcaContentVerifierProviderBuilder$1
  implements ContentVerifierProvider
{
  private JcaContentVerifierProviderBuilder.SignatureOutputStream stream;
  
  JcaContentVerifierProviderBuilder$1(JcaContentVerifierProviderBuilder paramJcaContentVerifierProviderBuilder, X509CertificateHolder paramX509CertificateHolder, X509Certificate paramX509Certificate)
    throws OperatorCreationException
  {}
  
  public boolean hasAssociatedCertificate()
  {
    return true;
  }
  
  public X509CertificateHolder getAssociatedCertificate()
  {
    return val$certHolder;
  }
  
  public ContentVerifier get(AlgorithmIdentifier paramAlgorithmIdentifier)
    throws OperatorCreationException
  {
    try
    {
      Signature localSignature1 = JcaContentVerifierProviderBuilder.access$000(this$0).createSignature(paramAlgorithmIdentifier);
      localSignature1.initVerify(val$certificate.getPublicKey());
      stream = new JcaContentVerifierProviderBuilder.SignatureOutputStream(this$0, localSignature1);
    }
    catch (GeneralSecurityException localGeneralSecurityException)
    {
      throw new OperatorCreationException("exception on setup: " + localGeneralSecurityException, localGeneralSecurityException);
    }
    Signature localSignature2 = JcaContentVerifierProviderBuilder.access$100(this$0, paramAlgorithmIdentifier, val$certificate.getPublicKey());
    if (localSignature2 != null) {
      return new JcaContentVerifierProviderBuilder.RawSigVerifier(this$0, paramAlgorithmIdentifier, stream, localSignature2);
    }
    return new JcaContentVerifierProviderBuilder.SigVerifier(this$0, paramAlgorithmIdentifier, stream);
  }
}

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

import java.security.PublicKey;
import java.security.Signature;
import org.bouncycastle.asn1.x509.AlgorithmIdentifier;
import org.bouncycastle.cert.X509CertificateHolder;
import org.bouncycastle.operator.ContentVerifier;
import org.bouncycastle.operator.ContentVerifierProvider;
import org.bouncycastle.operator.OperatorCreationException;

class JcaContentVerifierProviderBuilder$2
  implements ContentVerifierProvider
{
  JcaContentVerifierProviderBuilder$2(JcaContentVerifierProviderBuilder paramJcaContentVerifierProviderBuilder, PublicKey paramPublicKey)
    throws OperatorCreationException
  {}
  
  public boolean hasAssociatedCertificate()
  {
    return false;
  }
  
  public X509CertificateHolder getAssociatedCertificate()
  {
    return null;
  }
  
  public ContentVerifier get(AlgorithmIdentifier paramAlgorithmIdentifier)
    throws OperatorCreationException
  {
    JcaContentVerifierProviderBuilder.SignatureOutputStream localSignatureOutputStream = JcaContentVerifierProviderBuilder.access$200(this$0, paramAlgorithmIdentifier, val$publicKey);
    Signature localSignature = JcaContentVerifierProviderBuilder.access$100(this$0, paramAlgorithmIdentifier, val$publicKey);
    if (localSignature != null) {
      return new JcaContentVerifierProviderBuilder.RawSigVerifier(this$0, paramAlgorithmIdentifier, localSignatureOutputStream, localSignature);
    }
    return new JcaContentVerifierProviderBuilder.SigVerifier(this$0, paramAlgorithmIdentifier, localSignatureOutputStream);
  }
}

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

import java.security.Signature;
import java.security.SignatureException;
import org.bouncycastle.asn1.x509.AlgorithmIdentifier;
import org.bouncycastle.operator.RawContentVerifier;
import org.bouncycastle.operator.RuntimeOperatorException;

class JcaContentVerifierProviderBuilder$RawSigVerifier
  extends JcaContentVerifierProviderBuilder.SigVerifier
  implements RawContentVerifier
{
  private Signature rawSignature;
  
  JcaContentVerifierProviderBuilder$RawSigVerifier(JcaContentVerifierProviderBuilder paramJcaContentVerifierProviderBuilder, AlgorithmIdentifier paramAlgorithmIdentifier, JcaContentVerifierProviderBuilder.SignatureOutputStream paramSignatureOutputStream, Signature paramSignature)
  {
    super(paramJcaContentVerifierProviderBuilder, paramAlgorithmIdentifier, paramSignatureOutputStream);
    rawSignature = paramSignature;
  }
  
  public boolean verify(byte[] paramArrayOfByte1, byte[] paramArrayOfByte2)
  {
    try
    {
      rawSignature.update(paramArrayOfByte1);
      return rawSignature.verify(paramArrayOfByte2);
    }
    catch (SignatureException localSignatureException)
    {
      throw new RuntimeOperatorException("exception obtaining raw signature: " + localSignatureException.getMessage(), localSignatureException);
    }
  }
}

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

import java.io.OutputStream;
import java.security.SignatureException;
import org.bouncycastle.asn1.x509.AlgorithmIdentifier;
import org.bouncycastle.operator.ContentVerifier;
import org.bouncycastle.operator.RuntimeOperatorException;

class JcaContentVerifierProviderBuilder$SigVerifier
  implements ContentVerifier
{
  private JcaContentVerifierProviderBuilder.SignatureOutputStream stream;
  private AlgorithmIdentifier algorithm;
  
  JcaContentVerifierProviderBuilder$SigVerifier(JcaContentVerifierProviderBuilder paramJcaContentVerifierProviderBuilder, AlgorithmIdentifier paramAlgorithmIdentifier, JcaContentVerifierProviderBuilder.SignatureOutputStream paramSignatureOutputStream)
  {
    algorithm = paramAlgorithmIdentifier;
    stream = paramSignatureOutputStream;
  }
  
  public AlgorithmIdentifier getAlgorithmIdentifier()
  {
    return algorithm;
  }
  
  public OutputStream getOutputStream()
  {
    if (stream == null) {
      throw new IllegalStateException("verifier not initialised");
    }
    return stream;
  }
  
  public boolean verify(byte[] paramArrayOfByte)
  {
    try
    {
      return stream.verify(paramArrayOfByte);
    }
    catch (SignatureException localSignatureException)
    {
      throw new RuntimeOperatorException("exception obtaining signature: " + localSignatureException.getMessage(), localSignatureException);
    }
  }
}

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

import java.io.IOException;
import java.io.OutputStream;
import java.security.Signature;
import java.security.SignatureException;
import org.bouncycastle.operator.OperatorStreamException;

class JcaContentVerifierProviderBuilder$SignatureOutputStream
  extends OutputStream
{
  private Signature sig;
  
  JcaContentVerifierProviderBuilder$SignatureOutputStream(JcaContentVerifierProviderBuilder paramJcaContentVerifierProviderBuilder, Signature paramSignature)
  {
    sig = paramSignature;
  }
  
  public void write(byte[] paramArrayOfByte, int paramInt1, int paramInt2)
    throws IOException
  {
    try
    {
      sig.update(paramArrayOfByte, paramInt1, paramInt2);
    }
    catch (SignatureException localSignatureException)
    {
      throw new OperatorStreamException("exception in content signer: " + localSignatureException.getMessage(), localSignatureException);
    }
  }
  
  public void write(byte[] paramArrayOfByte)
    throws IOException
  {
    try
    {
      sig.update(paramArrayOfByte);
    }
    catch (SignatureException localSignatureException)
    {
      throw new OperatorStreamException("exception in content signer: " + localSignatureException.getMessage(), localSignatureException);
    }
  }
  
  public void write(int paramInt)
    throws IOException
  {
    try
    {
      sig.update((byte)paramInt);
    }
    catch (SignatureException localSignatureException)
    {
      throw new OperatorStreamException("exception in content signer: " + localSignatureException.getMessage(), localSignatureException);
    }
  }
  
  boolean verify(byte[] paramArrayOfByte)
    throws SignatureException
  {
    return sig.verify(paramArrayOfByte);
  }
}

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

import java.io.IOException;
import java.io.OutputStream;
import java.security.GeneralSecurityException;
import java.security.Provider;
import java.security.PublicKey;
import java.security.Signature;
import java.security.SignatureException;
import java.security.cert.CertificateEncodingException;
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
import org.bouncycastle.asn1.x509.AlgorithmIdentifier;
import org.bouncycastle.cert.X509CertificateHolder;
import org.bouncycastle.cert.jcajce.JcaX509CertificateHolder;
import org.bouncycastle.jcajce.DefaultJcaJceHelper;
import org.bouncycastle.jcajce.NamedJcaJceHelper;
import org.bouncycastle.jcajce.ProviderJcaJceHelper;
import org.bouncycastle.operator.ContentVerifier;
import org.bouncycastle.operator.ContentVerifierProvider;
import org.bouncycastle.operator.OperatorCreationException;
import org.bouncycastle.operator.OperatorStreamException;
import org.bounc
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-2019. Infinite Loop Ltd