bcpkix-jdk15on-147

aramPrivateKey;
    algorithm = paramString;
    iterationCount = 2048;
    try
    {
      cipher = Cipher.getInstance(paramString, paramProvider);
    }
    catch (NoSuchPaddingException localNoSuchPaddingException)
    {
      throw new NoSuchAlgorithmException(paramString + " found, but padding not available: " + localNoSuchPaddingException.getMessage());
    }
    ASN1ObjectIdentifier localASN1ObjectIdentifier = new ASN1ObjectIdentifier(paramString);
    if (PEMUtilities.isPKCS5Scheme2(localASN1ObjectIdentifier)) {
      paramGen = AlgorithmParameterGenerator.getInstance(paramString, paramProvider);
    } else {
      secKeyFact = SecretKeyFactory.getInstance(paramString, paramProvider);
    }
  }
  
  public PKCS8Generator setSecureRandom(SecureRandom paramSecureRandom)
  {
    random = paramSecureRandom;
    return this;
  }
  
  public PKCS8Generator setPassword(char[] paramArrayOfChar)
  {
    password = paramArrayOfChar;
    return this;
  }
  
  public PKCS8Generator setIterationCount(int paramInt)
  {
    iterationCount = paramInt;
    return this;
  }
  
  public PemObject generate()
    throws PemGenerationException
  {
    byte[] arrayOfByte1 = key.getEncoded();
    if (algorithm == null) {
      return new PemObject("PRIVATE KEY", arrayOfByte1);
    }
    ASN1ObjectIdentifier localASN1ObjectIdentifier = new ASN1ObjectIdentifier(algorithm);
    byte[] arrayOfByte2;
    Object localObject1;
    Object localObject2;
    Object localObject3;
    if (PEMUtilities.isPKCS5Scheme2(localASN1ObjectIdentifier))
    {
      arrayOfByte2 = new byte[20];
      if (random == null) {
        random = new SecureRandom();
      }
      random.nextBytes(arrayOfByte2);
      localObject1 = PEMUtilities.generateSecretKeyForPKCS5Scheme2(algorithm, password, arrayOfByte2, iterationCount);
      localObject2 = paramGen.generateParameters();
      try
      {
        cipher.init(1, (Key)localObject1, (AlgorithmParameters)localObject2);
        EncryptionScheme localEncryptionScheme = new EncryptionScheme(new ASN1ObjectIdentifier(algorithm), ASN1Primitive.fromByteArray(((AlgorithmParameters)localObject2).getEncoded()));
        localObject3 = new KeyDerivationFunc(PKCSObjectIdentifiers.id_PBKDF2, new PBKDF2Params(arrayOfByte2, iterationCount));
        ASN1EncodableVector localASN1EncodableVector2 = new ASN1EncodableVector();
        localASN1EncodableVector2.add((ASN1Encodable)localObject3);
        localASN1EncodableVector2.add(localEncryptionScheme);
        EncryptedPrivateKeyInfo localEncryptedPrivateKeyInfo = new EncryptedPrivateKeyInfo(new AlgorithmIdentifier(PKCSObjectIdentifiers.id_PBES2, new PBES2Parameters(new DERSequence(localASN1EncodableVector2))), cipher.doFinal(arrayOfByte1));
        return new PemObject("ENCRYPTED PRIVATE KEY", localEncryptedPrivateKeyInfo.getEncoded());
      }
      catch (IOException localIOException2)
      {
        throw new PemGenerationException(localIOException2.getMessage(), localIOException2);
      }
      catch (GeneralSecurityException localGeneralSecurityException2)
      {
        throw new PemGenerationException(localGeneralSecurityException2.getMessage(), localGeneralSecurityException2);
      }
    }
    if (PEMUtilities.isPKCS12(localASN1ObjectIdentifier))
    {
      arrayOfByte2 = new byte[20];
      if (random == null) {
        random = new SecureRandom();
      }
      random.nextBytes(arrayOfByte2);
      try
      {
        localObject1 = new PBEKeySpec(password);
        localObject2 = new PBEParameterSpec(arrayOfByte2, iterationCount);
        cipher.init(1, secKeyFact.generateSecret((KeySpec)localObject1), (AlgorithmParameterSpec)localObject2);
        ASN1EncodableVector localASN1EncodableVector1 = new ASN1EncodableVector();
        localASN1EncodableVector1.add(new DEROctetString(arrayOfByte2));
        localASN1EncodableVector1.add(new ASN1Integer(iterationCount));
        localObject3 = new EncryptedPrivateKeyInfo(new AlgorithmIdentifier(localASN1ObjectIdentifier, PKCS12PBEParams.getInstance(new DERSequence(localASN1EncodableVector1))), cipher.doFinal(arrayOfByte1));
        return new PemObject("ENCRYPTED PRIVATE KEY", ((EncryptedPrivateKeyInfo)localObject3).getEncoded());
      }
      catch (IOException localIOException1)
      {
        throw new PemGenerationException(localIOException1.getMessage(), localIOException1);
      }
      catch (GeneralSecurityException localGeneralSecurityException1)
      {
        throw new PemGenerationException(localGeneralSecurityException1.getMessage(), localGeneralSecurityException1);
      }
    }
    throw new PemGenerationException("unknown algorithm: " + algorithm);
  }
}

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

import java.io.IOException;

public class PasswordException
  extends IOException
{
  public PasswordException(String paramString)
  {
    super(paramString);
  }
}

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

public abstract interface PasswordFinder
{
  public abstract char[] getPassword();
}

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

import org.bouncycastle.asn1.x509.AlgorithmIdentifier;

public abstract class AsymmetricKeyUnwrapper
  implements KeyUnwrapper
{
  private AlgorithmIdentifier algorithmId;
  
  protected AsymmetricKeyUnwrapper(AlgorithmIdentifier paramAlgorithmIdentifier)
  {
    algorithmId = paramAlgorithmIdentifier;
  }
  
  public AlgorithmIdentifier getAlgorithmIdentifier()
  {
    return algorithmId;
  }
}

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

import org.bouncycastle.asn1.x509.AlgorithmIdentifier;

public abstract class AsymmetricKeyWrapper
  implements KeyWrapper
{
  private AlgorithmIdentifier algorithmId;
  
  protected AsymmetricKeyWrapper(AlgorithmIdentifier paramAlgorithmIdentifier)
  {
    algorithmId = paramAlgorithmIdentifier;
  }
  
  public AlgorithmIdentifier getAlgorithmIdentifier()
  {
    return algorithmId;
  }
}

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

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

public abstract interface ContentSigner
{
  public abstract AlgorithmIdentifier getAlgorithmIdentifier();
  
  public abstract OutputStream getOutputStream();
  
  public abstract byte[] getSignature();
}

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

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

public abstract interface ContentVerifier
{
  public abstract AlgorithmIdentifier getAlgorithmIdentifier();
  
  public abstract OutputStream getOutputStream();
  
  public abstract boolean verify(byte[] paramArrayOfByte);
}

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

import org.bouncycastle.asn1.x509.AlgorithmIdentifier;
import org.bouncycastle.cert.X509CertificateHolder;

public abstract interface ContentVerifierProvider
{
  public abstract boolean hasAssociatedCertificate();
  
  public abstract X509CertificateHolder getAssociatedCertificate();
  
  public abstract ContentVerifier get(AlgorithmIdentifier paramAlgorithmIdentifier)
    throws OperatorCreationException;
}

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

import java.util.HashMap;
import java.util.Map;
import org.bouncycastle.asn1.ASN1ObjectIdentifier;
import org.bouncycastle.asn1.DERNull;
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.pkcs.RSASSAPSSparams;
import org.bouncycastle.asn1.teletrust.TeleTrusTObjectIdentifiers;
import org.bouncycastle.asn1.x509.AlgorithmIdentifier;
import org.bouncycastle.asn1.x9.X9ObjectIdentifiers;

public class DefaultDigestAlgorithmIdentifierFinder
  implements DigestAlgorithmIdentifierFinder
{
  private static Map digestOids = new HashMap();
  private static Map digestNameToOids = new HashMap();
  
  public AlgorithmIdentifier find(AlgorithmIdentifier paramAlgorithmIdentifier)
  {
    AlgorithmIdentifier localAlgorithmIdentifier;
    if (paramAlgorithmIdentifier.getAlgorithm().equals(PKCSObjectIdentifiers.id_RSASSA_PSS)) {
      localAlgorithmIdentifier = ((RSASSAPSSparams)paramAlgorithmIdentifier.getParameters()).getHashAlgorithm();
    } else {
      localAlgorithmIdentifier = new AlgorithmIdentifier((ASN1ObjectIdentifier)digestOids.get(paramAlgorithmIdentifier.getAlgorithm()), new DERNull());
    }
    return localAlgorithmIdentifier;
  }
  
  public AlgorithmIdentifier find(String paramString)
  {
    return new AlgorithmIdentifier((ASN1ObjectIdentifier)digestNameToOids.get(paramString), new DERNull());
  }
  
  static
  {
    digestOids.put(OIWObjectIdentifiers.md4WithRSAEncryption, PKCSObjectIdentifiers.md4);
    digestOids.put(OIWObjectIdentifiers.md4WithRSA, PKCSObjectIdentifiers.md4);
    digestOids.put(OIWObjectIdentifiers.sha1WithRSA, OIWObjectIdentifiers.idSHA1);
    digestOids.put(PKCSObjectIdentifiers.sha224WithRSAEncryption, NISTObjectIdentifiers.id_sha224);
    digestOids.put(PKCSObjectIdentifiers.sha256WithRSAEncryption, NISTObjectIdentifiers.id_sha256);
    digestOids.put(PKCSObjectIdentifiers.sha384WithRSAEncryption, NISTObjectIdentifiers.id_sha384);
    digestOids.put(PKCSObjectIdentifiers.sha512WithRSAEncryption, NISTObjectIdentifiers.id_sha512);
    digestOids.put(PKCSObjectIdentifiers.md2WithRSAEncryption, PKCSObjectIdentifiers.md2);
    digestOids.put(PKCSObjectIdentifiers.md4WithRSAEncryption, PKCSObjectIdentifiers.md4);
    digestOids.put(PKCSObjectIdentifiers.md5WithRSAEncryption, PKCSObjectIdentifiers.md5);
    digestOids.put(PKCSObjectIdentifiers.sha1WithRSAEncryption, OIWObjectIdentifiers.idSHA1);
    digestOids.put(X9ObjectIdentifiers.ecdsa_with_SHA1, OIWObjectIdentifiers.idSHA1);
    digestOids.put(X9ObjectIdentifiers.ecdsa_with_SHA224, NISTObjectIdentifiers.id_sha224);
    digestOids.put(X9ObjectIdentifiers.ecdsa_with_SHA256, NISTObjectIdentifiers.id_sha256);
    digestOids.put(X9ObjectIdentifiers.ecdsa_with_SHA384, NISTObjectIdentifiers.id_sha384);
    digestOids.put(X9ObjectIdentifiers.ecdsa_with_SHA512, NISTObjectIdentifiers.id_sha512);
    digestOids.put(X9ObjectIdentifiers.id_dsa_with_sha1, OIWObjectIdentifiers.idSHA1);
    digestOids.put(NISTObjectIdentifiers.dsa_with_sha224, NISTObjectIdentifiers.id_sha224);
    digestOids.put(NISTObjectIdentifiers.dsa_with_sha256, NISTObjectIdentifiers.id_sha256);
    digestOids.put(NISTObjectIdentifiers.dsa_with_sha384, NISTObjectIdentifiers.id_sha384);
    digestOids.put(NISTObjectIdentifiers.dsa_with_sha512, NISTObjectIdentifiers.id_sha512);
    digestOids.put(TeleTrusTObjectIdentifiers.rsaSignatureWithripemd128, TeleTrusTObjectIdentifiers.ripemd128);
    digestOids.put(TeleTrusTObjectIdentifiers.rsaSignatureWithripemd160, TeleTrusTObjectIdentifiers.ripemd160);
    digestOids.put(TeleTrusTObjectIdentifiers.rsaSignatureWithripemd256, TeleTrusTObjectIdentifiers.ripemd256);
    digestOids.put(CryptoProObjectIdentifiers.gostR3411_94_with_gostR3410_94, CryptoProObjectIdentifiers.gostR3411);
    digestOids.put(CryptoProObjectIdentifiers.gostR3411_94_with_gostR3410_2001, CryptoProObjectIdentifiers.gostR3411);
    digestNameToOids.put("SHA-1", OIWObjectIdentifiers.idSHA1);
    digestNameToOids.put("SHA-224", NISTObjectIdentifiers.id_sha224);
    digestNameToOids.put("SHA-256", NISTObjectIdentifiers.id_sha256);
    digestNameToOids.put("SHA-384", NISTObjectIdentifiers.id_sha384);
    digestNameToOids.put("SHA-512", NISTObjectIdentifiers.id_sha512);
    digestNameToOids.put("GOST3411", CryptoProObjectIdentifiers.gostR3411);
    digestNameToOids.put("MD2", PKCSObjectIdentifiers.md2);
    digestNameToOids.put("MD4", PKCSObjectIdentifiers.md4);
    digestNameToOids.put("MD5", PKCSObjectIdentifiers.md5);
    digestNameToOids.put("RIPEMD128", TeleTrusTObjectIdentifiers.ripemd128);
    digestNameToOids.put("RIPEMD160", TeleTrusTObjectIdentifiers.ripemd160);
    digestNameToOids.put("RIPEMD256", TeleTrusTObjectIdentifiers.ripemd256);
  }
}

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

import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import org.bouncycastle.asn1.ASN1Encodable;
import org.bouncycastle.asn1.ASN1Integer;
import org.bouncycastle.asn1.ASN1ObjectIdentifier;
import org.bouncycastle.asn1.DERNull;
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.pkcs.RSASSAPSSparams;
import org.bouncycastle.asn1.teletrust.TeleTrusTObjectIdentifiers;
import org.bouncycastle.asn1.x509.AlgorithmIdentifier;
import org.bouncycastle.asn1.x9.X9ObjectIdentifiers;
import org.bouncycastle.util.Strings;

public class DefaultSignatureAlgorithmIdentifierFinder
  implements SignatureAlgorithmIdentifierFinder
{
  private static Map algorithms = new HashMap();
  private static Set noParams = new HashSet();
  private static Map params = new HashMap();
  private static Set pkcs15RsaEncryption = new HashSet();
  private static Map digestOids = new HashMap();
  private static final ASN1ObjectIdentifier ENCRYPTION_RSA = PKCSObjectIdentifiers.rsaEncryption;
  private static final ASN1ObjectIdentifier ENCRYPTION_DSA = X9ObjectIdentifiers.id_dsa_with_sha1;
  private static final ASN1ObjectIdentifier ENCRYPTION_ECDSA = X9ObjectIdentifiers.ecdsa_with_SHA1;
  private static final ASN1ObjectIdentifier ENCRYPTION_RSA_PSS = PKCSObjectIdentifiers.id_RSASSA_PSS;
  private static final ASN1ObjectIdentifier ENCRYPTION_GOST3410 = CryptoProObjectIdentifiers.gostR3410_94;
  private static final ASN1ObjectIdentifier ENCRYPTION_ECGOST3410 = CryptoProObjectIdentifiers.gostR3410_2001;
  
  private static AlgorithmIdentifier generate(String paramString)
  {
    String str = Strings.toUpperCase(paramString);
    ASN1ObjectIdentifier localASN1ObjectIdentifier = (ASN1ObjectIdentifier)algorithms.get(str);
    if (localASN1ObjectIdentifier == null) {
      throw new IllegalArgumentException("Unknown signature type requested: " + str);
    }
    AlgorithmIdentifier localAlgorithmIdentifier1;
    if (noParams.contains(localASN1ObjectIdentifier)) {
      localAlgorithmIdentifier1 = new AlgorithmIdentifier(localASN1ObjectIdentifier);
    } else if (params.containsKey(str)) {
      localAlgorithmIdentifier1 = new AlgorithmIdentifier(localASN1ObjectIdentifier, (ASN1Encodable)params.get(str));
    } else {
      localAlgorithmIdentifier1 = new AlgorithmIdentifier(localASN1ObjectIdentifier, DERNull.INSTANCE);
    }
    AlgorithmIdentifier localAlgorithmIdentifier2;
    if (pkcs15RsaEncryption.contains(localASN1ObjectIdentifier)) {
      localAlgorithmIdentifier2 = new AlgorithmIdentifier(PKCSObjectIdentifiers.rsaEncryption, new DERNull());
    } else {
      localAlgorithmIdentifier2 = localAlgorithmIdentifier1;
    }
    AlgorithmIdentifier localAlgorithmIdentifier3;
    if (localAlgorithmIdentifier1.getAlgorithm().equals(PKCSObjectIdentifiers.id_RSASSA_PSS)) {
      localAlgorithmIdentifier3 = ((RSASSAPSSparams)localAlgorithmIdentifier1.getParameters()).getHashAlgorithm();
    } else {
      localAlgorithmIdentifier3 = new AlgorithmIdentifier((ASN1ObjectIdentifier)digestOids.get(localASN1ObjectIdentifier), new DERNull());
    }
    return localAlgorithmIdentifier1;
  }
  
  private static RSASSAPSSparams createPSSParams(AlgorithmIdentifier paramAlgorithmIdentifier, int paramInt)
  {
    return new RSASSAPSSparams(paramAlgorithmIdentifier, new AlgorithmIdentifier(PKCSObjectIdentifiers.id_mgf1, paramAlgorithmIdentifier), new ASN1Integer(paramInt), new ASN1Integer(1));
  }
  
  public AlgorithmIdentifier find(String paramString)
  {
    return generate(paramString);
  }
  
  static
  {
    algorithms.put("MD2WITHRSAENCRYPTION", PKCSObjectIdentifiers.md2WithRSAEncryption);
    algorithms.put("MD2WITHRSA", PKCSObjectIdentifiers.md2WithRSAEncryption);
    algorithms.put("MD5WITHRSAENCRYPTION", PKCSObjectIdentifiers.md5WithRSAEncryption);
    algorithms.put("MD5WITHRSA", PKCSObjectIdentifiers.md5WithRSAEncryption);
    algorithms.put("SHA1WITHRSAENCRYPTION", PKCSObjectIdentifiers.sha1WithRSAEncryption);
    algorithms.put("SHA1WITHRSA", PKCSObjectIdentifiers.sha1WithRSAEncryption);
    algorithms.put("SHA224WITHRSAENCRYPTION", PKCSObjectIdentifiers.sha224WithRSAEncryption);
    algorithms.put("SHA224WITHRSA", PKCSObjectIdentifiers.sha224WithRSAEncryption);
    algorithms.put("SHA256WITHRSAENCRYPTION", PKCSObjectIdentifiers.sha256WithRSAEncryption);
    algorithms.put("SHA256WITHRSA", PKCSObjectIdentifiers.sha256WithRSAEncryption);
    algorithms.put("SHA384WITHRSAENCRYPTION", PKCSObjectIdentifiers.sha384WithRSAEncryption);
    algorithms.put("SHA384WITHRSA", PKCSObjectIdentifiers.sha384WithRSAEncryption);
    algorithms.put("SHA512WITHRSAENCRYPTION", PKCSObjectIdentifiers.sha512WithRSAEncryption);
    algorithms.put("SHA512WITHRSA", PKCSObjectIdentifiers.sha512WithRSAEncryption);
    algorithms.put("SHA1WITHRSAANDMGF1", PKCSObjectIdentifiers.id_RSASSA_PSS);
    algorithms.put("SHA224WITHRSAANDMGF1", PKCSObjectIdentifiers.id_RSASSA_PSS);
    algorithms.put("SHA256WITHRSAANDMGF1", PKCSObjectIdentifiers.id_RSASSA_PSS);
    algorithms.put("SHA384WITHRSAANDMGF1", PKCSObjectIdentifiers.id_RSASSA_PSS);
    algorithms.put("SHA512WITHRSAANDMGF1", PKCSObjectIdentifiers.id_RSASSA_PSS);
    algorithms.put("RIPEMD160WITHRSAENCRYPTION", TeleTrusTObjectIdentifiers.rsaSignatureWithripemd160);
    algorithms.put("RIPEMD160WITHRSA", TeleTrusTObjectIdentifiers.rsaSignatureWithripemd160);
    algorithms.put("RIPEMD128WITHRSAENCRYPTION", TeleTrusTObjectIdentifiers.rsaSignatureWithripemd128);
    algorithms.put("RIPEMD128WITHRSA", TeleTrusTObjectIdentifiers.rsaSignatureWithripemd128);
    algorithms.put("RIPEMD256WITHRSAENCRYPTION", TeleTrusTObjectIdentifiers.rsaSignatureWithripemd256);
    algorithms.put("RIPEMD256WITHRSA", TeleTrusTObjectIdentifiers.rsaSignatureWithripemd256);
    algorithms.put("SHA1WITHDSA", X9ObjectIdentifiers.id_dsa_with_sha1);
    algorithms.put("DSAWITHSHA1", X9ObjectIdentifiers.id_dsa_with_sha1);
    algorithms.put("SHA224WITHDSA", NISTObjectIdentifiers.dsa_with_sha224);
    algorithms.put("SHA256WITHDSA", NISTObjectIdentifiers.dsa_with_sha256);
    algorithms.put("SHA384WITHDSA", NISTObjectIdentifiers.dsa_with_sha384);
    algorithms.put("SHA512WITHDSA", NISTObjectIdentifiers.dsa_with_sha512);
    algorithms.put("SHA1WITHECDSA", X9ObjectIdentifiers.ecdsa_with_SHA1);
    algorithms.put("ECDSAWITHSHA1", X9ObjectIdentifiers.ecdsa_with_SHA1);
    algorithms.put("SHA224WITHECDSA", X9ObjectIdentifiers.ecdsa_with_SHA224);
    algorithms.put("SHA256WITHECDSA", X9ObjectIdentifiers.ecdsa_with_SHA256);
    algorithms.put("SHA384WITHECDSA", X9ObjectIdentifiers.ecdsa_with_SHA384);
    algorithms.put("SHA512WITHECDSA", X9ObjectIdentifiers.ecdsa_with_SHA512);
    algorithms.put("GOST3411WITHGOST3410", CryptoProObjectIdentifiers.gostR3411_94_with_gostR3410_94);
    algorithms.put("GOST3411WITHGOST3410-94", CryptoProObjectIdentifiers.gostR3411_94_with_gostR3410_94);
    algorithms.put("GOST3411WITHECGOST3410", CryptoProObjectIdentifiers.gostR3411_94_with_gostR3410_2001);
    algorithms.put("GOST3411WITHECGOST3410-2001", CryptoProObjectIdentifiers.gostR3411_94_with_gostR3410_2001);
    algorithms.put("GOST3411WITHGOST3410-2001", CryptoProObjectIdentifiers.gostR3411_94_with_gostR3410_2001);
    noParams.add(X9ObjectIdentifiers.ecdsa_with_SHA1);
    noParams.add(X9ObjectIdentifiers.ecdsa_with_SHA224);
    noParams.add(X9ObjectIdentifiers.ecdsa_with_SHA256);
    noParams.add(X9ObjectIdentifiers.ecdsa_with_SHA384);
    noParams.add(X9ObjectIdentifiers.ecdsa_with_SHA512);
    noParams.add(X9ObjectIdentifiers.id_dsa_with_sha1);
    noParams.add(NISTObjectIdentifiers.dsa_with_sha224);
    noParams.add(NISTObjectIdentifiers.dsa_with_sha256);
    noParams.add(NISTObjectIdentifiers.dsa_with_sha384);
    noParams.add(NISTObjectIdentifiers.dsa_with_sha512);
    noParams.add(CryptoProObjectIdentifiers.gostR3411_94_with_gostR3410_94);
    noParams.add(CryptoProObjectIdentifiers.gostR3411_94_with_gostR3410_2001);
    pkcs15RsaEncryption.add(PKCSObjectIdentifiers.sha1WithRSAEncryption);
    pkcs15RsaEncryption.add(PKCSObjectIdentifiers.sha224WithRSAEncryption);
    pkcs15RsaEncryption.add(PKCSObjectIdentifiers.sha256WithRSAEncryption);
    pkcs15RsaEncryption.add(PKCSObjectIdentifiers.sha384WithRSAEncryption);
    pkcs15RsaEncryption.add(PKCSObjectIdentifiers.sha512WithRSAEncryption);
    pkcs15RsaEncryption.add(TeleTrusTObjectIdentifiers.rsaSignatureWithripemd128);
    pkcs15RsaEncryption.add(TeleTrusTObjectIdentifiers.rsaSignatureWithripemd160);
    pkcs15RsaEncryption.add(TeleTrusTObjectIdentifiers.rsaSignatureWithripemd256);
    AlgorithmIdentifier localAlgorithmIdentifier1 = new AlgorithmIdentifier(OIWObjectIdentifiers.idSHA1, new DERNull());
    params.put("SHA1WITHRSAANDMGF1", createPSSParams(localAlgorithmIdentifier1, 20));
    AlgorithmIdentifier localAlgorithmIdentifier2 = new AlgorithmIdentifier(NISTObjectIdentifiers.id_sha224, new DERNull());
    params.put("SHA224WITHRSAANDMGF1", createPSSParams(localAlgorithmIdentifier2, 28));
    AlgorithmIdentifier localAlgorithmIdentifier3 = new AlgorithmIdentifier(NISTObjectIdentifiers.id_sha256, new DERNull());
    params.put("SHA256WITHRSAANDMGF1", createPSSParams(localAlgorithmIdentifier3, 32));
    AlgorithmIdentifier localAlgorithmIdentifier4 = new AlgorithmIdentifier(NISTObjectIdentifiers.id_sha384, new DERNull());
    params.put("SHA384WITHRSAANDMGF1", createPSSParams(localAlgorithmIdentifier4, 48));
    AlgorithmIdentifier localAlgorithmIdentifier5 = new AlgorithmIdentifier(NISTObjectIdentifiers.id_sha512, new DERNull());
    params.put("SHA512WITHRSAANDMGF1", createPSSParams(localAlgorithmIdentifier5, 64));
    digestOids.put(PKCSObjectIdentifiers.sha224WithRSAEncryption, NISTObjectIdentifiers.id_sha224);
    digestOids.put(PKCSObjectIdentifiers.sha256WithRSAEncryption, NISTObjectIdentifiers.id_sha256);
    digestOids.put(PKCSObjectIdentifiers.sha384WithRSAEncryption, NISTObjectIdentifiers.id_sha384);
    digestOids.put(PKCSObjectIdentifiers.sha512WithRSAEncryption, NISTObjectIdentifiers.id_sha512);
    digestOids.put(PKCSObjectIdentifiers.md2WithRSAEncryption, PKCSObjectIdentifiers.md2);
    digestOids.put(PKCSObjectIdentifiers.md4WithRSAEncryption, PKCSObjectIdentifiers.md4);
    digestOids.put(PKCSObjectIdentifiers.md5WithRSAEncryption, PKCSObjectIdentifiers.md5);
    digestOids.put(PKCSObjectIdentifiers.sha1WithRSAEncryption, OIWObjectIdentifiers.idSHA1);
    digestOids.put(TeleTrusTObjectIdentifiers.rsaSignatureWithripemd128, TeleTrusTObjectIdentifiers.ripemd128);
    digestOids.put(TeleTrusTObjectIdentifiers.rsaSignatureWithripemd160, TeleTrusTObjectIdentifiers.ripemd160);
    digestOids.put(TeleTrusTObjectIdentifiers.rsaSignatureWithripemd256, TeleTrusTObjectIdentifiers.ripemd256);
    digestOids.put(CryptoProObjectIdentifiers.gostR3411_94_with_gostR3410_94, CryptoProObjectIdentifiers.gostR3411);
    digestOids.put(CryptoProObjectIdentifiers.gostR3411_94_with_gostR3410_2001, CryptoProObjectIdentifiers.gostR3411);
  }
}

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

import org.bouncycastle.asn1.x509.AlgorithmIdentifier;

public abstract interface DigestAlgorithmIdentifierFinder
{
  public abstract AlgorithmIdentifier find(AlgorithmIdentifier paramAlgorithmIdentifier);
  
  public abstract AlgorithmIdentifier find(String paramString);
}

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

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

public abstract interface DigestCalculator
{
  public abstract AlgorithmIdentifier getAlgorithmIdentifier();
  
  public abstract OutputStream getOutputStream();
  
  public abstract byte[] getDigest();
}

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

import org.bouncycastle.asn1.x509.AlgorithmIdentifier;

public abstract interface DigestCalculatorProvider
{
  public abstract DigestCalculator get(AlgorithmIdentifier paramAlgorithmIdentifier)
    throws OperatorCreationException;
}

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

public class GenericKey
{
  private Object representation;
  
  public GenericKey(Object paramObject)
  {
    representation = paramObject;
  }
  
  public Object getRepresentation()
  {
    return representation;
  }
}

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

import java.io.InputStream;
import org.bouncycastle.asn1.x509.AlgorithmIdentifier;

public abstract interface InputDecryptor
{
  public abstract AlgorithmIdentifier getAlgorithmIdentifier();
  
  public abstract InputStream getInputStream(InputStream paramInputStream);
}

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

import org.bouncycastle.asn1.x509.AlgorithmIdentifier;

public abstract interface InputDecryptorProvider
{
  public abstract InputDecryptor get(AlgorithmIdentifier paramAlgorithmIdentifier);
}

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

import java.io.InputStream;
import org.bouncycastle.asn1.x509.AlgorithmIdentifier;

public abstract interface InputExpander
{
  public abstract AlgorithmIdentifier getAlgorithmIdentifier();
  
  public abstract InputStream getInputStream(InputStream paramInputStream);
}

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

import org.bouncycastle.asn1.x509.AlgorithmIdentifier;

public abstract interface InputExpanderProvider
{
  public abstract InputExpander get(AlgorithmIdentifier paramAlgorithmIdentifier);
}

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

import org.bouncycastle.asn1.x509.AlgorithmIdentifier;

public abstract interface KeyUnwrapper
{
  public abstract AlgorithmIdentifier getAlgorithmIdentifier();
  
  public abstract GenericKey generateUnwrappedKey(AlgorithmIdentifier paramAlgorithmIdentifier, byte[] paramArrayOfByte)
    throws OperatorException;
}

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

import org.bouncycastle.asn1.x509.AlgorithmIdentifier;

public abstract interface KeyWrapper
{
  public abstract AlgorithmIdentifier getAlgorithmIdentifier();
  
  public abstract byte[] generateWrappedKey(GenericKey paramGenericKey)
    throws OperatorException;
}

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

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

public abstract interface MacCalculator
{
  public abstract AlgorithmIdentifier getAlgorithmIdentifier();
  
  public abstract OutputStream getOutputStream();
  
  public abstract byte[] getMac();
  
  public abstract GenericKey getKey();
}

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

import org.bouncycastle.asn1.x509.AlgorithmIdentifier;

public abstract interface MacCalculatorProvider
{
  public abstract MacCalculator get(AlgorithmIdentifier paramAlgorithmIdentifier);
}

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

public class OperatorCreationException
  extends OperatorException
{
  public OperatorCreationException(String paramString, Throwable paramThrowable)
  {
    super(paramString, paramThrowable);
  }
  
  public OperatorCreationException(String paramString)
  {
    super(paramString);
  }
}

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

public class OperatorException
  extends Exception
{
  private Throwable cause;
  
  public OperatorException(String paramString, Throwable paramThrowable)
  {
    super(paramString);
    cause = paramThrowable;
  }
  
  public OperatorException(String paramString)
  {
    super(paramString);
  }
  
  public Throwable getCause()
  {
    return cause;
  }
}

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

import java.io.IOException;

public class OperatorStreamException
  extends IOException
{
  private Throwable cause;
  
  public OperatorStreamException(String paramString, Throwable paramThrowable)
  {
    super(paramString);
    cause = paramThrowable;
  }
  
  public Throwable getCause()
  {
    return cause;
  }
}

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

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

public abstract interface OutputCompressor
{
  public abstract AlgorithmIdentifier getAlgorithmIdentifier();
  
  public abstract OutputStream getOutputStream(OutputStream paramOutputStream);
}

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

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

public abstract interface OutputEncryptor
{
  public abstract AlgorithmIdentifier getAlgorithmIdentifier();
  
  public abstract OutputStream getOutputStream(OutputStream paramOutputStream);
  
  public abstract GenericKey getKey();
}

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

public abstract interface RawContentVerifier
{
  public abstract boolean verify(byte[] paramArrayOfByte1, byte[] paramArrayOfByte2);
}

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

public class RuntimeOperatorException
  extends RuntimeException
{
  private Throwable cause;
  
  public RuntimeOperatorException(String paramString, Throwable paramThrowable)
  {
    super(paramString);
    cause = paramThrowable;
  }
  
  public Throwable getCause()
  {
    return cause;
  }
}

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

import org.bouncycastle.asn1.x509.AlgorithmIdentifier;

public abstract interface SignatureAlgorithmIdentifierFinder
{
  public abstract AlgorithmIdentifier find(String paramString);
}

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

import org.bouncycastle.asn1.x509.AlgorithmIdentifier;

public abstract class SymmetricKeyUnwrapper
  implements KeyUnwrapper
{
  private AlgorithmIdentifier algorithmId;
  
  protected SymmetricKeyUnwrapper(AlgorithmIdentifier paramAlgorithmIdentifier)
  {
    algorithmId = paramAlgorithmIdentifier;
  }
  
  public AlgorithmIdentifier getAlgorithmIdentifier()
  {
    return algorithmId;
  }
}

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

import org.bouncycastle.asn1.x509.AlgorithmIdentifier;

public abstract class SymmetricKeyWrapper
  implements KeyWrapper
{
  private AlgorithmIdentifier algorithmId;
  
  protected SymmetricKeyWrapper(AlgorithmIdentifier paramAlgorithmIdentifier)
  {
    algorithmId = paramAlgorithmIdentifier;
  }
  
  public AlgorithmIdentifier getAlgorithmIdentifier()
  {
    return algorithmId;
  }
}

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

import java.security.SecureRandom;
import org.bouncycastle.asn1.ASN1ObjectIdentifier;
import org.bouncycastle.asn1.x509.AlgorithmIdentifier;
import org.bouncycastle.crypto.AsymmetricBlockCipher;
import org.bouncycastle.crypto.CipherParameters;
import org.bouncycastle.crypto.InvalidCipherTextException;
import org.bouncycastle.crypto.params.AsymmetricKeyParameter;
import org.bouncycastle.crypto.params.ParametersWithRandom;
import org.bouncycastle.operator.AsymmetricKeyWrapper;
import org.bouncycastle.operator.GenericKey;
import org.bouncycastle.operator.OperatorException;

public abstract class BcAsymmetricKeyWrapper
  extends AsymmetricKeyWrapper
{
  private AsymmetricKeyParameter publicKey;
  private SecureRandom random;
  
  public BcAsymmetricKeyWrapper(AlgorithmIdentifier paramAlgorithmIdentifier, AsymmetricKeyParameter paramAsymmetricKeyParameter)
  {
    super(paramAlgorithmIdentifier);
    publicKey = paramAsymmetricKeyParameter;
  }
  
  public BcAsymmetricKeyWrapper setSecureRandom(SecureRandom paramSecureRandom)
  {
    random = paramSecureRandom;
    return this;
  }
  
  public byte[] generateWrappedKey(GenericKey paramGenericKey)
    throws OperatorException
  {
    AsymmetricBlockCipher localAsymmetricBlockCipher = createAsymmetricWrapper(getAlgorithmIdentifier().getAlgorithm());
    Object localObject = publicKey;
    if (random != null) {
      localObject = new ParametersWithRandom((CipherParameters)localObject, random);
    }
    try
    {
      byte[] arrayOfByte = OperatorUtils.getKeyBytes(paramGenericKey);
      localAsymmetricBlockCipher.init(true, publicKey);
      return localAsymmetricBlockCipher.processBlock(arrayOfByte, 0, arrayOfByte.length);
    }
    catch (InvalidCipherTextException localInvalidCipherTextException)
    {
      throw new OperatorException("unable to encrypt contents key", localInvalidCipherTextException);
    }
  }
  
  protected abstract AsymmetricBlockCipher createAsymmetricWrapper(ASN1ObjectIdentifier paramASN1ObjectIdentifier);
}

/* Location:
 * Qualified Name:     org.bouncycastle.operator.bc.BcAsymmetricKeyWrapper
 * 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.crypto.CryptoException;
import org.bouncycastle.crypto.Signer;
import org.bouncycastle.operator.ContentSigner;
import org.bouncycastle.operator.RuntimeOperatorException;

class BcContentSignerBuilder$1
  implements ContentSigner
{
  private BcSignerOutputStream stream = new BcSignerOutputStream(val$sig);
  
  BcContentSignerBuilder$1(BcContentSignerBuilder paramBcContentSignerBuilder, Signer paramSigner) {}
  
  public AlgorithmIdentifier getAlgorithmIdentifier()
  {
    return BcContentSignerBuilder.access$000(this$0);
  }
  
  public OutputStream getOutputStream()
  {
    return stream;
  }
  
  public byte[] getSignature()
  {
    try
    {
      return stream.getSignature();
    }
    catch (CryptoException localCryptoException)
    {
      throw new RuntimeOperatorException("exception obtaining signature: " + localCryptoException.getMessage(), localCryptoException);
    }
  }
}

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

import java.io.OutputStream;
import java.security.SecureRandom;
import org.bouncycastle.asn1.x509.AlgorithmIdentifier;
import org.bouncycastle.crypto.CryptoException;
import org.bouncycastle.crypto.Signer;
import org.bouncycastle.crypto.params.AsymmetricKeyParameter;
import org.bouncycastle.crypto.params.ParametersWithRandom;
import org.bouncycastle.operator.ContentSigner;
import org.bouncycastle.operator.OperatorCreationException;
import org.bouncycastle.operator.RuntimeOperatorException;

public abstract class BcContentSignerBuilder
{
  private SecureRandom random;
  private AlgorithmIdentifier sigAlgId;
  private AlgorithmIdentifier digAlgId;
  
  public BcContentSignerBuilder(AlgorithmIdentifier paramAlgorithmIdentifier1, AlgorithmIdentifier paramAlgorithmIdentifier2)
  {
    sigAlgId = paramAlgorithmIdentifier1;
    digAlgId = paramAlgorithmIdentifier2;
  }
  
  public BcContentSignerBuilder setSecureRandom(SecureRandom paramSecureRandom)
  {
    random = paramSecureRandom;
    return this;
  }
  
  public ContentSigner build(AsymmetricKeyParameter paramAsymmetricKeyParameter)
    throws OperatorCreationException
  {
    final Signer localSigner = createSigner(sigAlgId, digAlgId);
    if (random != null) {
      localSigner.init(true, new ParametersWithRandom(paramAsymmetricKeyParameter, random));
    } else {
      localSigner.init(true, paramAsymmetricKeyParameter);
    }
    new ContentSigner()
    {
      private BcSignerOutputStream stream = new BcSignerOutputStream(localSigner);
      
      public AlgorithmIdentifier getAlgorithmIdentifier()
      {
        return sigAlgId;
      }
      
      public OutputStream getOutputStream()
      {
        return stream;
      }
      
      public byte[] getSignature()
      {
        try
        {
          return stream.getSignature();
        }
        ca
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