sunjce_provider

16:53:19.397 INFO  jd.cli.Main - Decompiling sunjce_provider.jar
package com.sun.crypto.provider;

import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectStreamException;
import java.security.InvalidKeyException;
import java.security.KeyRep;
import java.security.KeyRep.Type;
import java.util.Arrays;
import javax.crypto.SecretKey;

final class DESKey
  implements SecretKey
{
  static final long serialVersionUID = 7724971015953279128L;
  private byte[] key;
  
  DESKey(byte[] paramArrayOfByte)
    throws InvalidKeyException
  {
    this(paramArrayOfByte, 0);
  }
  
  DESKey(byte[] paramArrayOfByte, int paramInt)
    throws InvalidKeyException
  {
    if ((paramArrayOfByte == null) || (paramArrayOfByte.length - paramInt < 8)) {
      throw new InvalidKeyException("Wrong key size");
    }
    key = new byte[8];
    System.arraycopy(paramArrayOfByte, paramInt, key, 0, 8);
    DESKeyGenerator.a(key, 0);
  }
  
  public byte[] getEncoded()
  {
    return (byte[])key.clone();
  }
  
  public String getAlgorithm()
  {
    return "DES";
  }
  
  public String getFormat()
  {
    return "RAW";
  }
  
  public int hashCode()
  {
    int i = 0;
    for (int j = 1; j < key.length; j++) {
      i += key[j] * j;
    }
    return i ^= "des".hashCode();
  }
  
  public boolean equals(Object paramObject)
  {
    if (this == paramObject) {
      return true;
    }
    if (!(paramObject instanceof SecretKey)) {
      return false;
    }
    String str = ((SecretKey)paramObject).getAlgorithm();
    if (!str.equalsIgnoreCase("DES")) {
      return false;
    }
    byte[] arrayOfByte = ((SecretKey)paramObject).getEncoded();
    boolean bool = Arrays.equals(key, arrayOfByte);
    Arrays.fill(arrayOfByte, (byte)0);
    return bool;
  }
  
  private void readObject(ObjectInputStream paramObjectInputStream)
    throws IOException, ClassNotFoundException
  {
    paramObjectInputStream.defaultReadObject();
    key = ((byte[])key.clone());
  }
  
  private Object writeReplace()
    throws ObjectStreamException
  {
    return new KeyRep(KeyRep.Type.SECRET, getAlgorithm(), getFormat(), getEncoded());
  }
  
  protected void finalize()
    throws Throwable
  {
    try
    {
      if (key != null)
      {
        Arrays.fill(key, (byte)0);
        key = null;
      }
    }
    finally
    {
      super.finalize();
    }
  }
}

/* Location:
 * Qualified Name:     com.sun.crypto.provider.DESKey
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.sun.crypto.provider;

import java.security.InvalidAlgorithmParameterException;
import java.security.InvalidKeyException;
import java.security.InvalidParameterException;
import java.security.SecureRandom;
import java.security.spec.AlgorithmParameterSpec;
import javax.crypto.KeyGeneratorSpi;
import javax.crypto.SecretKey;
import javax.crypto.spec.DESKeySpec;

public final class DESKeyGenerator
  extends KeyGeneratorSpi
{
  private SecureRandom a = null;
  
  public DESKeyGenerator()
  {
    if (!SunJCE.b(getClass())) {
      throw new SecurityException("The SunJCE provider may have been tampered.");
    }
  }
  
  protected void engineInit(SecureRandom paramSecureRandom)
  {
    a = paramSecureRandom;
  }
  
  protected void engineInit(AlgorithmParameterSpec paramAlgorithmParameterSpec, SecureRandom paramSecureRandom)
    throws InvalidAlgorithmParameterException
  {
    throw new InvalidAlgorithmParameterException("DES key generation does not take any parameters");
  }
  
  protected void engineInit(int paramInt, SecureRandom paramSecureRandom)
  {
    if (paramInt != 56) {
      throw new InvalidParameterException("Wrong keysize: must be equal to 56");
    }
    engineInit(paramSecureRandom);
  }
  
  protected SecretKey engineGenerateKey()
  {
    DESKey localDESKey = null;
    if (a == null) {
      a = SunJCE.h;
    }
    try
    {
      byte[] arrayOfByte = new byte[8];
      do
      {
        a.nextBytes(arrayOfByte);
        a(arrayOfByte, 0);
      } while (DESKeySpec.isWeak(arrayOfByte, 0));
      localDESKey = new DESKey(arrayOfByte);
    }
    catch (InvalidKeyException localInvalidKeyException) {}
    return localDESKey;
  }
  
  static void a(byte[] paramArrayOfByte, int paramInt)
  {
    if (paramArrayOfByte == null) {
      return;
    }
    for (int i = 0; i < 8; i++)
    {
      int j = paramArrayOfByte[paramInt] & 0xFE;
      j |= Integer.bitCount(j) & 0x1 ^ 0x1;
      paramArrayOfByte[(paramInt++)] = ((byte)j);
    }
  }
}

/* Location:
 * Qualified Name:     com.sun.crypto.provider.DESKeyGenerator
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.sun.crypto.provider;

import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectStreamException;
import java.security.InvalidKeyException;
import java.security.KeyRep;
import java.security.KeyRep.Type;
import java.util.Arrays;
import javax.crypto.SecretKey;

final class DESedeKey
  implements SecretKey
{
  static final long serialVersionUID = 2463986565756745178L;
  private byte[] key;
  
  DESedeKey(byte[] paramArrayOfByte)
    throws InvalidKeyException
  {
    this(paramArrayOfByte, 0);
  }
  
  DESedeKey(byte[] paramArrayOfByte, int paramInt)
    throws InvalidKeyException
  {
    if ((paramArrayOfByte == null) || (paramArrayOfByte.length - paramInt < 24)) {
      throw new InvalidKeyException("Wrong key size");
    }
    key = new byte[24];
    System.arraycopy(paramArrayOfByte, paramInt, key, 0, 24);
    DESKeyGenerator.a(key, 0);
    DESKeyGenerator.a(key, 8);
    DESKeyGenerator.a(key, 16);
  }
  
  public byte[] getEncoded()
  {
    return (byte[])key.clone();
  }
  
  public String getAlgorithm()
  {
    return "DESede";
  }
  
  public String getFormat()
  {
    return "RAW";
  }
  
  public int hashCode()
  {
    int i = 0;
    for (int j = 1; j < key.length; j++) {
      i += key[j] * j;
    }
    return i ^= "desede".hashCode();
  }
  
  public boolean equals(Object paramObject)
  {
    if (this == paramObject) {
      return true;
    }
    if (!(paramObject instanceof SecretKey)) {
      return false;
    }
    String str = ((SecretKey)paramObject).getAlgorithm();
    if ((!str.equalsIgnoreCase("DESede")) && (!str.equalsIgnoreCase("TripleDES"))) {
      return false;
    }
    byte[] arrayOfByte = ((SecretKey)paramObject).getEncoded();
    boolean bool = Arrays.equals(key, arrayOfByte);
    Arrays.fill(arrayOfByte, (byte)0);
    return bool;
  }
  
  private void readObject(ObjectInputStream paramObjectInputStream)
    throws IOException, ClassNotFoundException
  {
    paramObjectInputStream.defaultReadObject();
    key = ((byte[])key.clone());
  }
  
  private Object writeReplace()
    throws ObjectStreamException
  {
    return new KeyRep(KeyRep.Type.SECRET, getAlgorithm(), getFormat(), getEncoded());
  }
  
  protected void finalize()
    throws Throwable
  {
    try
    {
      if (key != null)
      {
        Arrays.fill(key, (byte)0);
        key = null;
      }
    }
    finally
    {
      super.finalize();
    }
  }
}

/* Location:
 * Qualified Name:     com.sun.crypto.provider.DESedeKey
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.sun.crypto.provider;

import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.ObjectStreamException;
import java.io.Serializable;
import java.math.BigInteger;
import java.security.InvalidKeyException;
import java.security.KeyRep;
import java.security.KeyRep.Type;
import java.security.ProviderException;
import java.security.PublicKey;
import java.util.Arrays;
import javax.crypto.spec.DHParameterSpec;
import sun.security.util.Debug;
import sun.security.util.DerInputStream;
import sun.security.util.DerOutputStream;
import sun.security.util.DerValue;
import sun.security.util.ObjectIdentifier;

final class DHPublicKey
  implements PublicKey, javax.crypto.interfaces.DHPublicKey, Serializable
{
  static final long serialVersionUID = 7647557958927458271L;
  private BigInteger y;
  private byte[] key;
  private byte[] encodedKey;
  private BigInteger p;
  private BigInteger g;
  private int l;
  private int[] DH_data = { 1, 2, 840, 113549, 1, 3, 1 };
  
  DHPublicKey(BigInteger paramBigInteger1, BigInteger paramBigInteger2, BigInteger paramBigInteger3)
    throws InvalidKeyException
  {
    this(paramBigInteger1, paramBigInteger2, paramBigInteger3, 0);
  }
  
  DHPublicKey(BigInteger paramBigInteger1, BigInteger paramBigInteger2, BigInteger paramBigInteger3, int paramInt)
  {
    y = paramBigInteger1;
    p = paramBigInteger2;
    g = paramBigInteger3;
    l = paramInt;
    try
    {
      key = new DerValue((byte)2, y.toByteArray()).toByteArray();
      encodedKey = getEncoded();
    }
    catch (IOException localIOException)
    {
      throw new ProviderException("Cannot produce ASN.1 encoding", localIOException);
    }
  }
  
  DHPublicKey(byte[] paramArrayOfByte)
    throws InvalidKeyException
  {
    ByteArrayInputStream localByteArrayInputStream = new ByteArrayInputStream(paramArrayOfByte);
    try
    {
      DerValue localDerValue1 = new DerValue(localByteArrayInputStream);
      if (tag != 48) {
        throw new InvalidKeyException("Invalid key format");
      }
      DerValue localDerValue2 = data.getDerValue();
      if (tag != 48) {
        throw new InvalidKeyException("AlgId is not a SEQUENCE");
      }
      DerInputStream localDerInputStream = localDerValue2.toDerInputStream();
      ObjectIdentifier localObjectIdentifier = localDerInputStream.getOID();
      if (localObjectIdentifier == null) {
        throw new InvalidKeyException("Null OID");
      }
      if (localDerInputStream.available() == 0) {
        throw new InvalidKeyException("Parameters missing");
      }
      DerValue localDerValue3 = localDerInputStream.getDerValue();
      if (tag == 5) {
        throw new InvalidKeyException("Null parameters");
      }
      if (tag != 48) {
        throw new InvalidKeyException("Parameters not a SEQUENCE");
      }
      data.reset();
      p = data.getBigInteger();
      g = data.getBigInteger();
      if (data.available() != 0) {
        l = data.getInteger();
      }
      if (data.available() != 0) {
        throw new InvalidKeyException("Extra parameter data");
      }
      key = data.getBitString();
      parseKeyBits();
      if (data.available() != 0) {
        throw new InvalidKeyException("Excess key data");
      }
      encodedKey = ((byte[])paramArrayOfByte.clone());
    }
    catch (NumberFormatException localNumberFormatException)
    {
      throw new InvalidKeyException("Private-value length too big");
    }
    catch (IOException localIOException)
    {
      throw new InvalidKeyException("Error parsing key encoding: " + localIOException.toString());
    }
  }
  
  public String getFormat()
  {
    return "X.509";
  }
  
  public String getAlgorithm()
  {
    return "DH";
  }
  
  public synchronized byte[] getEncoded()
  {
    if (encodedKey == null) {
      try
      {
        DerOutputStream localDerOutputStream1 = new DerOutputStream();
        localDerOutputStream1.putOID(new ObjectIdentifier(DH_data));
        DerOutputStream localDerOutputStream2 = new DerOutputStream();
        localDerOutputStream2.putInteger(p);
        localDerOutputStream2.putInteger(g);
        if (l != 0) {
          localDerOutputStream2.putInteger(l);
        }
        DerValue localDerValue = new DerValue((byte)48, localDerOutputStream2.toByteArray());
        localDerOutputStream1.putDerValue(localDerValue);
        DerOutputStream localDerOutputStream3 = new DerOutputStream();
        localDerOutputStream3.write((byte)48, localDerOutputStream1);
        localDerOutputStream3.putBitString(key);
        DerOutputStream localDerOutputStream4 = new DerOutputStream();
        localDerOutputStream4.write((byte)48, localDerOutputStream3);
        encodedKey = localDerOutputStream4.toByteArray();
      }
      catch (IOException localIOException)
      {
        return null;
      }
    }
    return (byte[])encodedKey.clone();
  }
  
  public BigInteger getY()
  {
    return y;
  }
  
  public DHParameterSpec getParams()
  {
    if (l != 0) {
      return new DHParameterSpec(p, g, l);
    }
    return new DHParameterSpec(p, g);
  }
  
  public String toString()
  {
    String str = System.getProperty("line.separator");
    StringBuffer localStringBuffer = new StringBuffer("SunJCE Diffie-Hellman Public Key:" + str + "y:" + str + Debug.toHexString(y) + str + "p:" + str + Debug.toHexString(p) + str + "g:" + str + Debug.toHexString(g));
    if (l != 0) {
      localStringBuffer.append(str + "l:" + str + "    " + l);
    }
    return localStringBuffer.toString();
  }
  
  private void parseKeyBits()
    throws InvalidKeyException
  {
    try
    {
      DerInputStream localDerInputStream = new DerInputStream(key);
      y = localDerInputStream.getBigInteger();
    }
    catch (IOException localIOException)
    {
      throw new InvalidKeyException("Error parsing key encoding: " + localIOException.toString());
    }
  }
  
  public int hashCode()
  {
    int i = 0;
    byte[] arrayOfByte = getEncoded();
    for (int j = 1; j < arrayOfByte.length; j++) {
      i += arrayOfByte[j] * j;
    }
    return i;
  }
  
  public boolean equals(Object paramObject)
  {
    if (this == paramObject) {
      return true;
    }
    if (!(paramObject instanceof PublicKey)) {
      return false;
    }
    byte[] arrayOfByte1 = getEncoded();
    byte[] arrayOfByte2 = ((PublicKey)paramObject).getEncoded();
    return Arrays.equals(arrayOfByte1, arrayOfByte2);
  }
  
  private Object writeReplace()
    throws ObjectStreamException
  {
    return new KeyRep(KeyRep.Type.PUBLIC, getAlgorithm(), getFormat(), getEncoded());
  }
}

/* Location:
 * Qualified Name:     com.sun.crypto.provider.DHPublicKey
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.sun.crypto.provider;

import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.ObjectStreamException;
import java.io.Serializable;
import java.math.BigInteger;
import java.security.InvalidKeyException;
import java.security.KeyRep;
import java.security.KeyRep.Type;
import java.security.PrivateKey;
import java.security.ProviderException;
import java.util.Arrays;
import javax.crypto.spec.DHParameterSpec;
import sun.security.util.Debug;
import sun.security.util.DerInputStream;
import sun.security.util.DerOutputStream;
import sun.security.util.DerValue;
import sun.security.util.ObjectIdentifier;

final class DHPrivateKey
  implements PrivateKey, javax.crypto.interfaces.DHPrivateKey, Serializable
{
  static final long serialVersionUID = 7565477590005668886L;
  private static final BigInteger PKCS8_VERSION = BigInteger.ZERO;
  private BigInteger x;
  private byte[] key;
  private byte[] encodedKey;
  private BigInteger p;
  private BigInteger g;
  private int l;
  private int[] DH_data = { 1, 2, 840, 113549, 1, 3, 1 };
  
  DHPrivateKey(BigInteger paramBigInteger1, BigInteger paramBigInteger2, BigInteger paramBigInteger3)
    throws InvalidKeyException
  {
    this(paramBigInteger1, paramBigInteger2, paramBigInteger3, 0);
  }
  
  DHPrivateKey(BigInteger paramBigInteger1, BigInteger paramBigInteger2, BigInteger paramBigInteger3, int paramInt)
  {
    x = paramBigInteger1;
    p = paramBigInteger2;
    g = paramBigInteger3;
    l = paramInt;
    try
    {
      key = new DerValue((byte)2, x.toByteArray()).toByteArray();
      encodedKey = getEncoded();
    }
    catch (IOException localIOException)
    {
      throw new ProviderException("Cannot produce ASN.1 encoding", localIOException);
    }
  }
  
  DHPrivateKey(byte[] paramArrayOfByte)
    throws InvalidKeyException
  {
    ByteArrayInputStream localByteArrayInputStream = new ByteArrayInputStream(paramArrayOfByte);
    try
    {
      DerValue localDerValue1 = new DerValue(localByteArrayInputStream);
      if (tag != 48) {
        throw new InvalidKeyException("Key not a SEQUENCE");
      }
      localObject = data.getBigInteger();
      if (!((BigInteger)localObject).equals(PKCS8_VERSION)) {
        throw new IOException("version mismatch: (supported: " + PKCS8_VERSION + ", parsed: " + localObject);
      }
      DerValue localDerValue2 = data.getDerValue();
      if (tag != 48) {
        throw new InvalidKeyException("AlgId is not a SEQUENCE");
      }
      DerInputStream localDerInputStream = localDerValue2.toDerInputStream();
      ObjectIdentifier localObjectIdentifier = localDerInputStream.getOID();
      if (localObjectIdentifier == null) {
        throw new InvalidKeyException("Null OID");
      }
      if (localDerInputStream.available() == 0) {
        throw new InvalidKeyException("Parameters missing");
      }
      DerValue localDerValue3 = localDerInputStream.getDerValue();
      if (tag == 5) {
        throw new InvalidKeyException("Null parameters");
      }
      if (tag != 48) {
        throw new InvalidKeyException("Parameters not a SEQUENCE");
      }
      data.reset();
      p = data.getBigInteger();
      g = data.getBigInteger();
      if (data.available() != 0) {
        l = data.getInteger();
      }
      if (data.available() != 0) {
        throw new InvalidKeyException("Extra parameter data");
      }
      key = data.getOctetString();
      parseKeyBits();
      encodedKey = ((byte[])paramArrayOfByte.clone());
    }
    catch (NumberFormatException localNumberFormatException)
    {
      localObject = new InvalidKeyException("Private-value length too big");
      ((InvalidKeyException)localObject).initCause(localNumberFormatException);
      throw ((Throwable)localObject);
    }
    catch (IOException localIOException)
    {
      Object localObject = new InvalidKeyException("Error parsing key encoding: " + localIOException.getMessage());
      ((InvalidKeyException)localObject).initCause(localIOException);
      throw ((Throwable)localObject);
    }
  }
  
  public String getFormat()
  {
    return "PKCS#8";
  }
  
  public String getAlgorithm()
  {
    return "DH";
  }
  
  public synchronized byte[] getEncoded()
  {
    if (encodedKey == null) {
      try
      {
        DerOutputStream localDerOutputStream1 = new DerOutputStream();
        localDerOutputStream1.putInteger(PKCS8_VERSION);
        DerOutputStream localDerOutputStream2 = new DerOutputStream();
        localDerOutputStream2.putOID(new ObjectIdentifier(DH_data));
        DerOutputStream localDerOutputStream3 = new DerOutputStream();
        localDerOutputStream3.putInteger(p);
        localDerOutputStream3.putInteger(g);
        if (l != 0) {
          localDerOutputStream3.putInteger(l);
        }
        DerValue localDerValue = new DerValue((byte)48, localDerOutputStream3.toByteArray());
        localDerOutputStream2.putDerValue(localDerValue);
        localDerOutputStream1.write((byte)48, localDerOutputStream2);
        localDerOutputStream1.putOctetString(key);
        DerOutputStream localDerOutputStream4 = new DerOutputStream();
        localDerOutputStream4.write((byte)48, localDerOutputStream1);
        encodedKey = localDerOutputStream4.toByteArray();
      }
      catch (IOException localIOException)
      {
        return null;
      }
    }
    return (byte[])encodedKey.clone();
  }
  
  public BigInteger getX()
  {
    return x;
  }
  
  public DHParameterSpec getParams()
  {
    if (l != 0) {
      return new DHParameterSpec(p, g, l);
    }
    return new DHParameterSpec(p, g);
  }
  
  public String toString()
  {
    String str = System.getProperty("line.separator");
    StringBuffer localStringBuffer = new StringBuffer("SunJCE Diffie-Hellman Private Key:" + str + "x:" + str + Debug.toHexString(x) + str + "p:" + str + Debug.toHexString(p) + str + "g:" + str + Debug.toHexString(g));
    if (l != 0) {
      localStringBuffer.append(str + "l:" + str + "    " + l);
    }
    return localStringBuffer.toString();
  }
  
  private void parseKeyBits()
    throws InvalidKeyException
  {
    try
    {
      DerInputStream localDerInputStream = new DerInputStream(key);
      x = localDerInputStream.getBigInteger();
    }
    catch (IOException localIOException)
    {
      InvalidKeyException localInvalidKeyException = new InvalidKeyException("Error parsing key encoding: " + localIOException.getMessage());
      localInvalidKeyException.initCause(localIOException);
      throw localInvalidKeyException;
    }
  }
  
  public int hashCode()
  {
    int i = 0;
    byte[] arrayOfByte = getEncoded();
    for (int j = 1; j < arrayOfByte.length; j++) {
      i += arrayOfByte[j] * j;
    }
    return i;
  }
  
  public boolean equals(Object paramObject)
  {
    if (this == paramObject) {
      return true;
    }
    if (!(paramObject instanceof PrivateKey)) {
      return false;
    }
    byte[] arrayOfByte1 = getEncoded();
    byte[] arrayOfByte2 = ((PrivateKey)paramObject).getEncoded();
    return Arrays.equals(arrayOfByte1, arrayOfByte2);
  }
  
  private Object writeReplace()
    throws ObjectStreamException
  {
    return new KeyRep(KeyRep.Type.PRIVATE, getAlgorithm(), getFormat(), getEncoded());
  }
}

/* Location:
 * Qualified Name:     com.sun.crypto.provider.DHPrivateKey
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.sun.crypto.provider;

import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectStreamException;
import java.security.KeyRep;
import java.security.KeyRep.Type;
import java.security.spec.InvalidKeySpecException;
import java.util.Arrays;
import javax.crypto.SecretKey;
import javax.crypto.spec.PBEKeySpec;

final class PBEKey
  implements SecretKey
{
  static final long serialVersionUID = -2234768909660948176L;
  private byte[] key;
  private String type;
  
  PBEKey(PBEKeySpec paramPBEKeySpec, String paramString)
    throws InvalidKeySpecException
  {
    char[] arrayOfChar = paramPBEKeySpec.getPassword();
    if (arrayOfChar == null) {
      arrayOfChar = new char[0];
    }
    for (int i = 0; i < arrayOfChar.length; i++) {
      if ((arrayOfChar[i] < ' ') || (arrayOfChar[i] > '~')) {
        throw new InvalidKeySpecException("Password is not ASCII");
      }
    }
    key = new byte[arrayOfChar.length];
    for (i = 0; i < arrayOfChar.length; i++) {
      key[i] = ((byte)(arrayOfChar[i] & 0x7F));
    }
    Arrays.fill(arrayOfChar, ' ');
    type = paramString;
  }
  
  public byte[] getEncoded()
  {
    return (byte[])key.clone();
  }
  
  public String getAlgorithm()
  {
    return type;
  }
  
  public String getFormat()
  {
    return "RAW";
  }
  
  public int hashCode()
  {
    int i = 0;
    for (int j = 1; j < key.length; j++) {
      i += key[j] * j;
    }
    return i ^= getAlgorithm().toLowerCase().hashCode();
  }
  
  public boolean equals(Object paramObject)
  {
    if (paramObject == this) {
      return true;
    }
    if (!(paramObject instanceof SecretKey)) {
      return false;
    }
    SecretKey localSecretKey = (SecretKey)paramObject;
    if (!localSecretKey.getAlgorithm().equalsIgnoreCase(type)) {
      return false;
    }
    byte[] arrayOfByte = localSecretKey.getEncoded();
    boolean bool = Arrays.equals(key, arrayOfByte);
    Arrays.fill(arrayOfByte, (byte)0);
    return bool;
  }
  
  private void readObject(ObjectInputStream paramObjectInputStream)
    throws IOException, ClassNotFoundException
  {
    paramObjectInputStream.defaultReadObject();
    key = ((byte[])key.clone());
  }
  
  private Object writeReplace()
    throws ObjectStreamException
  {
    return new KeyRep(KeyRep.Type.SECRET, getAlgorithm(), getFormat(), getEncoded());
  }
  
  protected void finalize()
    throws Throwable
  {
    try
    {
      if (key != null)
      {
        Arrays.fill(key, (byte)0);
        key = null;
      }
    }
    finally
    {
      super.finalize();
    }
  }
}

/* Location:
 * Qualified Name:     com.sun.crypto.provider.PBEKey
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.sun.crypto.provider;

import java.nio.ByteBuffer;
import java.security.DigestException;
import java.security.InvalidAlgorithmParameterException;
import java.security.InvalidKeyException;
import java.security.Key;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.security.ProviderException;
import java.security.spec.AlgorithmParameterSpec;
import javax.crypto.MacSpi;
import javax.crypto.SecretKey;

final class SslMacCore
{
  private final MessageDigest md;
  private final byte[] pad1;
  private final byte[] pad2;
  private boolean first;
  private byte[] secret;
  
  SslMacCore(String paramString, byte[] paramArrayOfByte1, byte[] paramArrayOfByte2)
    throws NoSuchAlgorithmException
  {
    md = MessageDigest.getInstance(paramString);
    pad1 = paramArrayOfByte1;
    pad2 = paramArrayOfByte2;
    first = true;
  }
  
  int getDigestLength()
  {
    return md.getDigestLength();
  }
  
  void init(Key paramKey, AlgorithmParameterSpec paramAlgorithmParameterSpec)
    throws InvalidKeyException, InvalidAlgorithmParameterException
  {
    if (paramAlgorithmParameterSpec != null) {
      throw new InvalidAlgorithmParameterException("SslMac does not use parameters");
    }
    if (!(paramKey instanceof SecretKey)) {
      throw new InvalidKeyException("Secret key expected");
    }
    secret = paramKey.getEncoded();
    if ((secret == null) || (secret.length == 0)) {
      throw new InvalidKeyException("Missing key data");
    }
    reset();
  }
  
  void update(byte paramByte)
  {
    if (first == true)
    {
      md.update(secret);
      md.update(pad1);
      first = false;
    }
    md.update(paramByte);
  }
  
  void update(byte[] paramArrayOfByte, int paramInt1, int paramInt2)
  {
    if (first == true)
    {
      md.update(secret);
      md.update(pad1);
      first = false;
    }
    md.update(paramArrayOfByte, paramInt1, paramInt2);
  }
  
  void update(ByteBuffer paramByteBuffer)
  {
    if (first == true)
    {
      md.update(secret);
      md.update(pad1);
      first = false;
    }
    md.update(paramByteBuffer);
  }
  
  byte[] doFinal()
  {
    if (first == true)
    {
      md.update(secret);
      md.update(pad1);
    }
    else
    {
      first = true;
    }
    try
    {
      byte[] arrayOfByte = md.digest();
      md.update(secret);
      md.update(pad2);
      md.update(arrayOfByte);
      md.digest(arrayOfByte, 0, arrayOfByte.length);
      return arrayOfByte;
    }
    catch (DigestException localDigestException)
    {
      throw new ProviderException(localDigestException);
    }
  }
  
  void reset()
  {
    if (!first)
    {
      md.reset();
      first = true;
    }
  }
  
  public static final class SslMacSHA1
    extends MacSpi
  {
    private final SslMacCore core = new SslMacCore("SHA", shaPad1, shaPad2);
    static final byte[] shaPad1 = TlsPrfGenerator.genPad(, 40);
    static final byte[] shaPad2 = TlsPrfGenerator.genPad((byte)92, 40);
    
    public SslMacSHA1()
      throws NoSuchAlgorithmException
    {}
    
    protected int engineGetMacLength()
    {
      return core.getDigestLength();
    }
    
    protected void engineInit(Key paramKey, AlgorithmParameterSpec paramAlgorithmParameterSpec)
      throws InvalidKeyException, InvalidAlgorithmParameterException
    {
      core.init(paramKey, paramAlgorithmParameterSpec);
    }
    
    protected void engineUpdate(byte paramByte)
    {
      core.update(paramByte);
    }
    
    protected void engineUpdate(byte[] paramArrayOfByte, int paramInt1, int paramInt2)
    {
      core.update(paramArrayOfByte, paramInt1, paramInt2);
    }
    
    protected void engineUpdate(ByteBuffer paramByteBuffer)
    {
      core.update(paramByteBuffer);
    }
    
    protected byte[] engineDoFinal()
    {
      return core.doFinal();
    }
    
    protected void engineReset()
    {
      core.reset();
    }
    
    static
    {
      SunJCE.a(SslMacSHA1.class);
    }
  }
  
  public static final class SslMacMD5
    extends MacSpi
  {
    private final SslMacCore core = new SslMacCore("MD5", md5Pad1, md5Pad2);
    static final byte[] md5Pad1 = TlsPrfGenerator.genPad(, 48);
    static final byte[] md5Pad2 = TlsPrfGenerator.genPad((byte)92, 48);
    
    public SslMacMD5()
      throws NoSuchAlgorithmException
    {}
    
    protected int engineGetMacLength()
    {
      return core.getDigestLength();
    }
    
    protected void engineInit(Key paramKey, AlgorithmParameterSpec paramAlgorithmParameterSpec)
      throws InvalidKeyException, InvalidAlgorithmParameterException
    {
      core.init(paramKey, paramAlgorithmParameterSpec);
    }
    
    protected void engineUpdate(byte paramByte)
    {
      core.update(paramByte);
    }
    
    protected void engineUpdate(byte[] paramArrayOfByte, int paramInt1, int paramInt2)
    {
      core.update(paramArrayOfByte, paramInt1, paramInt2);
    }
    
    protected void engineUpdate(ByteBuffer paramByteBuffer)
    {
      core.update(paramByteBuffer);
    }
    
    protected byte[] engineDoFinal()
    {
      return core.doFinal();
    }
    
    protected void engineReset()
    {
      core.reset();
    }
    
    static
    {
      SunJCE.a(SslMacMD5.class);
    }
  }
}

/* Location:
 * Qualified Name:     com.sun.crypto.provider.SslMacCore
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.sun.crypto.provider;

import java.nio.ByteBuffer;
import java.security.InvalidAlgorithmParameterException;
import java.security.InvalidKeyException;
import java.security.Key;
import java.security.NoSuchAlgorithmException;
import java.security.spec.AlgorithmParameterSpec;
import javax.crypto.MacSpi;

public final class SslMacCore$SslMacMD5
  extends MacSpi
{
  private final SslMacCore core = new SslMacCore("MD5", md5Pad1, md5Pad2);
  static final byte[] md5Pad1 = TlsPrfGenerator.genPad(, 48);
  static final byte[] md5Pad2 = TlsPrfGenerator.genPad((byte)92, 48);
  
  public SslMacCore$SslMacMD5()
    throws NoSuchAlgorithmException
  {}
  
  protected int engineGetMacLength()
  {
    return core.getDigestLength();
  }
  
  protected void engineInit(Key paramKey, AlgorithmParameterSpec paramAlgorithmParameterSpec)
    throws InvalidKeyException, InvalidAlgorithmParameterException
  {
    core.init(paramKey, paramAlgorithmParameterSpec);
  }
  
  protected void engineUpdate(byte paramByte)
  {
    core.update(paramByte);
  }
  
  protected void engineUpdate(byte[] paramArrayOfByte, int paramInt1, int paramInt2)
  {
    core.update(paramArrayOfByte, paramInt1, paramInt2);
  }
  
  protected void engineUpdate(ByteBuffer paramByteBuffer)
  {
    core.update(paramByteBuffer);
  }
  
  protected byte[] engineDoFinal()
  {
    return core.doFinal();
  }
  
  protected void engineReset()
  {
    core.reset();
  }
  
  static
  {
    SunJCE.a(SslMacMD5.class);
  }
}

/* Location:
 * Qualified Name:     com.sun.crypto.provider.SslMacCore.SslMacMD5
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.sun.crypto.provider;

import java.io.UnsupportedEncodingException;
import java.security.DigestException;
import java.security.GeneralSecurityException;
import java.security.InvalidAlgorithmParameterException;
import java.security.InvalidParameterException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.security.ProviderException;
import java.security.SecureRandom;
import java.security.spec.AlgorithmParameterSpec;
import java.util.Arrays;
import javax.crypto.KeyGeneratorSpi;
import javax.crypto.SecretKey;
import javax.crypto.spec.SecretKeySpec;
import sun.security.internal.spec.TlsPrfParameterSpec;

public final class TlsPrfGenerator
  extends KeyGeneratorSpi
{
  private static final byte[] B0 = new byte[0];
  static final byte[] LABEL_MASTER_SECRET = { 109, 97, 115, 116, 101, 114, 32, 115, 101, 99, 114, 101, 116 };
  static final byte[] LABEL_KEY_EXPANSION = { 107, 101, 121, 32, 101, 120, 112, 97, 110, 115, 105, 111, 110 };
  static final byte[] LABEL_CLIENT_WRITE_KEY = { 99, 108, 105, 101, 110, 116, 32, 119, 114, 105, 116, 101, 32, 107, 101, 121 };
  static final byte[] LABEL_SERVER_WRITE_KEY = { 115, 101, 114, 118, 101, 114, 32, 119, 114, 105, 116, 101, 32, 107, 101, 121 };
  static final byte[] LABEL_IV_BLOCK = { 73, 86, 32, 98, 108, 111, 99, 107 };
  private static final byte[] HMAC_ipad = genPad((byte)54, 64);
  private static final byte[] HMAC_opad = genPad((byte)92, 64);
  static final byte[][] SSL3_CONST = genConst();
  private static final String MSG = "TlsPrfGenerator must be initialized using a TlsPrfParameterSpec";
  private TlsPrfParameterSpec spec;
  
  static byte[] genPad(byte paramByte, int paramInt)
  {
    byte[] arrayOfByte = new byte[paramInt];
    Arrays.fill(arrayOfByte, paramByte);
    return arrayOfByte;
  }
  
  static byte[] concat(byte[] paramArrayOfByte1, byte[] paramArrayOfByte2)
  {
    int i = paramArrayOfByte1.length;
    int j = paramArrayOfByte2.length;
    byte[] arrayOfByte = new byte[i + j];
    System.arraycopy(paramArrayOfByte1, 0, arrayOfByte, 0, i);
    System.arraycopy(paramArrayOfByte2, 0, arrayOfByte, i, j);
    return arrayOfByte;
  }
  
  private static byte[][] genConst()
  {
    int i = 10;
    byte[][] arrayOfByte = new byte[i][];
    for (int j = 0; j < i; j++)
    {
      byte[] arrayOfByte1 = new byte[j + 1];
      Arrays.fill(arrayOfByte1, (byte)(65 + j));
      arrayOfByte[j] = arrayOfByte1;
    }
    return arrayOfByte;
  }
  
  public TlsPrfGenerator()
  {
    SunJCE.a(getClass());
  }
  
  protected void engineInit(SecureRandom paramSecureRandom)
  {
    throw new InvalidParameterException("TlsPrfGenerator must be initialized using a TlsPrfParameterSpec");
  }
  
  protected void engineInit(AlgorithmParameterSpec paramAlgorithmParameterSpec, SecureRandom paramSecureRandom)
    throws InvalidAlgorithmParameterException
  {
    if (!(paramAlgorithmParameterSpec instanceof TlsPrfParameterSpec)) {
      throw new InvalidAlgorithmParameterException("TlsPrfGenerator must be initialized using a TlsPrfParameterSpec");
    }
    spec = ((TlsPrfParameterSpec)paramAlgorithmParameterSpec);
    SecretKey localSecretKey = spec.getSecret();
    if ((localSecretKey != null) && (!"RAW".equals(localSecretKey.getFormat()))) {
      throw new InvalidAlgorithmParameterException("Key encoding format must be RAW");
    }
  }
  
  protected void engineInit(int paramInt, SecureRandom paramSecureRandom)
  {
    throw new InvalidParameterException("TlsPrfGenerator must be initialized using a TlsPrfParameterSpec");
  }
  
  protected SecretKey engineGenerateKey()
  {
    if (spec == null) {
      throw new IllegalStateException("TlsPrfGenerator must be initialized");
    }
    SecretKey localSecretKey = spec.getSecret();
    byte[] arrayOfByte1 = localSecretKey == null ? null : localSecretKey.getEncoded();
    try
    {
      byte[] arrayOfByte2 = spec.getLabel().getBytes("UTF8");
      int i = spec.getOutputLength();
      byte[] arrayOfByte3 = doPRF(arrayOfByte1, arrayOfByte2, spec.getSeed(), i);
      return new SecretKeySpec(arrayOfByte3, "TlsPrf");
    }
    catch (GeneralSecurityException localGeneralSecurityException)
    {
      throw new ProviderException("Could not generate PRF", localGeneralSecurityException);
    }
    catch (UnsupportedEncodingException localUnsupportedEncodingException)
    {
      throw new ProviderException("Could not generate PRF", localUnsupportedEncodingException);
    }
  }
  
  static final byte[] doPRF(byte[] paramArrayOfByte1, byte[] paramArrayOfByte2, byte[] paramArrayOfByte3, int paramInt)
    throws NoSuchAlgorithmException, DigestException
  {
    MessageDigest localMessageDigest1 = MessageDigest.getInstance("MD5");
    MessageDigest localMessageDigest2 = MessageDigest.getInstance("SHA1");
    return doPRF(paramArrayOfByte1, paramArrayOfByte2, paramArrayOfByte3, paramInt, localMessageDigest1, localMessageDigest2);
  }
  
  static final byte[] doPRF(byte[] paramArrayOfByte1, byte[] paramArrayOfByte2, byte[] paramArrayOfByte3, int paramInt, MessageDigest paramMessageDigest1, MessageDigest paramMessageDigest2)
    throws DigestException
  {
    if (paramArrayOfByte1 == null) {
      paramArrayOfByte1 = B0;
    }
    int i = paramArrayOfByte1.length >> 1;
    int j = i + (paramArrayOfByte1.length & 0x1);
    byte[] arrayOfByte = new byte[paramInt];
    expand(paramMessageDigest1, 16, paramArrayOfByte1, 0, j, paramArrayOfByte2, paramArrayOfByte3, arrayOfByte);
    expand(paramMessageDigest2, 20, paramArrayOfByte1, i, j, paramArrayOfByte2, paramArrayOfByte3, arrayOfByte);
    return arrayOfByte;
  }
  
  private static final void expand(MessageDigest paramMessageDigest, int paramInt1, byte[] paramArrayOfByte1, int paramInt2, int paramInt3, byte[] paramArrayOfByte2, byte[] paramArrayOfByte3, byte[] paramArrayOfByte4)
    throws DigestException
  {
    byte[] arrayOfByte1 = (byte[])HMAC_ipad.clone();
    byte[] arrayOfByte2 = (byte[])HMAC_opad.clone();
    for (int i = 0; i < paramInt3; i++)
    {
      int tmp36_34 = i;
      byte[] tmp36_32 = arrayOfByte1;
      tmp36_32[tmp36_34] = ((byte)(tmp36_32[tmp36_34] ^ paramArrayOfByte1[(i + paramInt2)]));
      int tmp51_49 = i;
      byte[] tmp51_47 = arrayOfByte2;
      tmp51_47[tmp51_49] = ((byte)(tmp51_47[tmp51_49] ^ paramArrayOfByte1[(i + paramInt2)]));
    }
    byte[] arrayOfByte3 = new byte[paramInt1];
    byte[] arrayOfByte4 = null;
    int j = paramArrayOfByte4.length;
    int k = 0;
    while (j > 0)
    {
      paramMessageDigest.update(arrayOfByte1);
      if (arrayOfByte4 == null)
      {
        paramMessageDigest.update(paramArrayOfByte2);
        paramMessageDigest.update(paramArrayOfByte3);
      }
      else
      {
        paramMessageDigest.update(arrayOfByte4);
      }
      paramMessageDigest.digest(arrayOfByte3, 0, paramInt1);
      paramMessageDigest.update(arrayOfByte2);
      paramMessageDigest.update(arrayOfByte3);
      if (arrayOfByte4 == null) {
        arrayOfByte4 = new byte[paramInt1];
      }
      paramMessageDigest.digest(arrayOfByte4, 0, paramInt1);
      paramMessageDigest.update(arrayOfByte1);
      paramMessageDigest.update(arrayOfByte4);
      paramMessageDigest.update(paramArrayOfByte2);
      paramMessageDigest.update(paramArrayOfByte3);
      paramMessageDigest.digest(arrayOfByte3, 0, paramInt1);
      paramMessageDigest.update(arrayOfByte2);
      paramMessageDigest.update(arrayOfByte3);
      paramMessageDigest.digest(arrayOfByte3, 0, paramInt1);
      int m = Math.min(paramInt1, j);
      for (int n = 0; n < m; n++)
      {
        int tmp240_237 = (k++);
        byte[] tmp240_233 = paramArrayOfByte4;
        tmp240_233[tmp240_237] = ((byte)(tmp240_233[tmp240_237] ^ arrayOfByte3[n]));
      }
      j -= m;
    }
  }
}

/* Location:
 * Qualified Name:     com.sun.crypto.provider.TlsPrfGenerator
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.sun.crypto.provider;

import java.io.ByteArrayInputStream;
import java.net.URL;
import java.security.AccessController;
import java.security.CodeSource;
import java.security.PrivilegedAction;
import java.security.ProtectionDomain;
import java.security.Provider;
import java.security.SecureRandom;
import java.security.cert.CertificateFactory;
import java.security.cert.X509Certificate;

public final class SunJCE
  extends Provider
{
  private static final long serialVersionUID = 6812507587804302833L;
  private static final String a = "SunJCE Provider (implements RSA, DES, Triple DES, AES, Blowfish, ARCFOUR, RC2, PBE, Diffie-Hellman, HMAC)";
  private static final String b = "1.2.840.113549.1.12.1.6";
  private static final String c = "1.2.840.113549.1.12.1.3";
  private static final String d = "1.2.840.113549.1.5.3";
  private static final String e = "1.2.840.113549.1.5.12";
  private static final String f = "1.2.840.113549.1.3.1";
  static final boolean g = false;
  static final SecureRandom h = new SecureRandom();
  private static boolean i = false;
  
  public SunJCE()
1 2 3 4 5 6 7 8 9 10 11 12 13 14

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