sunmscapi

ernal error");
    }
    catch (KeyException localKeyException)
    {
      throw new ProviderException(localKeyException);
    }
    finally
    {
      bufOfs = 0;
    }
  }
  
  protected byte[] engineUpdate(byte[] paramArrayOfByte, int paramInt1, int paramInt2)
  {
    update(paramArrayOfByte, paramInt1, paramInt2);
    return B0;
  }
  
  protected int engineUpdate(byte[] paramArrayOfByte1, int paramInt1, int paramInt2, byte[] paramArrayOfByte2, int paramInt3)
  {
    update(paramArrayOfByte1, paramInt1, paramInt2);
    return 0;
  }
  
  protected byte[] engineDoFinal(byte[] paramArrayOfByte, int paramInt1, int paramInt2)
    throws BadPaddingException, IllegalBlockSizeException
  {
    update(paramArrayOfByte, paramInt1, paramInt2);
    return doFinal();
  }
  
  protected int engineDoFinal(byte[] paramArrayOfByte1, int paramInt1, int paramInt2, byte[] paramArrayOfByte2, int paramInt3)
    throws ShortBufferException, BadPaddingException, IllegalBlockSizeException
  {
    if (outputSize > paramArrayOfByte2.length - paramInt3) {
      throw new ShortBufferException("Need " + outputSize + " bytes for output");
    }
    update(paramArrayOfByte1, paramInt1, paramInt2);
    byte[] arrayOfByte = doFinal();
    int i = arrayOfByte.length;
    System.arraycopy(arrayOfByte, 0, paramArrayOfByte2, paramInt3, i);
    return i;
  }
  
  protected byte[] engineWrap(java.security.Key paramKey)
    throws InvalidKeyException, IllegalBlockSizeException
  {
    byte[] arrayOfByte = paramKey.getEncoded();
    if ((arrayOfByte == null) || (arrayOfByte.length == 0)) {
      throw new InvalidKeyException("Could not obtain encoded key");
    }
    if (arrayOfByte.length > buffer.length) {
      throw new InvalidKeyException("Key is too long for wrapping");
    }
    update(arrayOfByte, 0, arrayOfByte.length);
    try
    {
      return doFinal();
    }
    catch (BadPaddingException localBadPaddingException)
    {
      throw new InvalidKeyException("Wrapping failed", localBadPaddingException);
    }
  }
  
  protected java.security.Key engineUnwrap(byte[] paramArrayOfByte, String paramString, int paramInt)
    throws InvalidKeyException, NoSuchAlgorithmException
  {
    if (paramArrayOfByte.length > buffer.length) {
      throw new InvalidKeyException("Key is too long for unwrapping");
    }
    update(paramArrayOfByte, 0, paramArrayOfByte.length);
    try
    {
      byte[] arrayOfByte = doFinal();
      switch (paramInt)
      {
      case 1: 
        return constructPublicKey(arrayOfByte, paramString);
      case 2: 
        return constructPrivateKey(arrayOfByte, paramString);
      case 3: 
        return constructSecretKey(arrayOfByte, paramString);
      }
      throw new InvalidKeyException("Unknown key type " + paramInt);
    }
    catch (BadPaddingException localBadPaddingException)
    {
      throw new InvalidKeyException("Unwrapping failed", localBadPaddingException);
    }
    catch (IllegalBlockSizeException localIllegalBlockSizeException)
    {
      throw new InvalidKeyException("Unwrapping failed", localIllegalBlockSizeException);
    }
  }
  
  protected int engineGetKeySize(java.security.Key paramKey)
    throws InvalidKeyException
  {
    if ((paramKey instanceof Key)) {
      return ((Key)paramKey).bitLength();
    }
    if ((paramKey instanceof RSAKey)) {
      return ((RSAKey)paramKey).getModulus().bitLength();
    }
    throw new InvalidKeyException("Unsupported key type: " + paramKey);
  }
  
  private static PublicKey constructPublicKey(byte[] paramArrayOfByte, String paramString)
    throws InvalidKeyException, NoSuchAlgorithmException
  {
    try
    {
      KeyFactory localKeyFactory = KeyFactory.getInstance(paramString);
      X509EncodedKeySpec localX509EncodedKeySpec = new X509EncodedKeySpec(paramArrayOfByte);
      
      return localKeyFactory.generatePublic(localX509EncodedKeySpec);
    }
    catch (NoSuchAlgorithmException localNoSuchAlgorithmException)
    {
      throw new NoSuchAlgorithmException("No installed provider supports the " + paramString + " algorithm", localNoSuchAlgorithmException);
    }
    catch (InvalidKeySpecException localInvalidKeySpecException)
    {
      throw new InvalidKeyException("Cannot construct public key", localInvalidKeySpecException);
    }
  }
  
  private static PrivateKey constructPrivateKey(byte[] paramArrayOfByte, String paramString)
    throws InvalidKeyException, NoSuchAlgorithmException
  {
    try
    {
      KeyFactory localKeyFactory = KeyFactory.getInstance(paramString);
      PKCS8EncodedKeySpec localPKCS8EncodedKeySpec = new PKCS8EncodedKeySpec(paramArrayOfByte);
      
      return localKeyFactory.generatePrivate(localPKCS8EncodedKeySpec);
    }
    catch (NoSuchAlgorithmException localNoSuchAlgorithmException)
    {
      throw new NoSuchAlgorithmException("No installed provider supports the " + paramString + " algorithm", localNoSuchAlgorithmException);
    }
    catch (InvalidKeySpecException localInvalidKeySpecException)
    {
      throw new InvalidKeyException("Cannot construct private key", localInvalidKeySpecException);
    }
  }
  
  private static SecretKey constructSecretKey(byte[] paramArrayOfByte, String paramString)
  {
    return new SecretKeySpec(paramArrayOfByte, paramString);
  }
  
  private static native byte[] encryptDecrypt(byte[] paramArrayOfByte, int paramInt, long paramLong, boolean paramBoolean)
    throws KeyException;
}

/* Location:
 * Qualified Name:     sun.security.mscapi.RSACipher
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package sun.security.mscapi;

class RSAKeyPair
{
  private final RSAPrivateKey privateKey;
  private final RSAPublicKey publicKey;
  
  RSAKeyPair(long paramLong1, long paramLong2, int paramInt)
  {
    privateKey = new RSAPrivateKey(paramLong1, paramLong2, paramInt);
    publicKey = new RSAPublicKey(paramLong1, paramLong2, paramInt);
  }
  
  public RSAPrivateKey getPrivate()
  {
    return privateKey;
  }
  
  public RSAPublicKey getPublic()
  {
    return publicKey;
  }
}

/* Location:
 * Qualified Name:     sun.security.mscapi.RSAKeyPair
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package sun.security.mscapi;

import java.security.InvalidAlgorithmParameterException;
import java.security.InvalidKeyException;
import java.security.InvalidParameterException;
import java.security.KeyException;
import java.security.KeyPair;
import java.security.KeyPairGeneratorSpi;
import java.security.ProviderException;
import java.security.SecureRandom;
import java.security.spec.AlgorithmParameterSpec;
import java.security.spec.RSAKeyGenParameterSpec;
import java.util.UUID;
import sun.security.rsa.RSAKeyFactory;

public final class RSAKeyPairGenerator
  extends KeyPairGeneratorSpi
{
  static final int KEY_SIZE_MIN = 512;
  static final int KEY_SIZE_MAX = 16384;
  private static final int KEY_SIZE_DEFAULT = 1024;
  private int keySize;
  
  public RSAKeyPairGenerator()
  {
    initialize(1024, null);
  }
  
  public void initialize(int paramInt, SecureRandom paramSecureRandom)
  {
    try
    {
      RSAKeyFactory.checkKeyLengths(paramInt, null, 512, 16384);
    }
    catch (InvalidKeyException localInvalidKeyException)
    {
      throw new InvalidParameterException(localInvalidKeyException.getMessage());
    }
    keySize = paramInt;
  }
  
  public void initialize(AlgorithmParameterSpec paramAlgorithmParameterSpec, SecureRandom paramSecureRandom)
    throws InvalidAlgorithmParameterException
  {
    int i;
    if (paramAlgorithmParameterSpec == null)
    {
      i = 1024;
    }
    else if ((paramAlgorithmParameterSpec instanceof RSAKeyGenParameterSpec))
    {
      if (((RSAKeyGenParameterSpec)paramAlgorithmParameterSpec).getPublicExponent() != null) {
        throw new InvalidAlgorithmParameterException("Exponent parameter is not supported");
      }
      i = ((RSAKeyGenParameterSpec)paramAlgorithmParameterSpec).getKeysize();
    }
    else
    {
      throw new InvalidAlgorithmParameterException("Params must be an instance of RSAKeyGenParameterSpec");
    }
    try
    {
      RSAKeyFactory.checkKeyLengths(i, null, 512, 16384);
    }
    catch (InvalidKeyException localInvalidKeyException)
    {
      throw new InvalidAlgorithmParameterException("Invalid Key sizes", localInvalidKeyException);
    }
    keySize = i;
  }
  
  public KeyPair generateKeyPair()
  {
    try
    {
      RSAKeyPair localRSAKeyPair = generateRSAKeyPair(keySize, "{" + UUID.randomUUID().toString() + "}");
      
      return new KeyPair(localRSAKeyPair.getPublic(), localRSAKeyPair.getPrivate());
    }
    catch (KeyException localKeyException)
    {
      throw new ProviderException(localKeyException);
    }
  }
  
  private static native RSAKeyPair generateRSAKeyPair(int paramInt, String paramString)
    throws KeyException;
}

/* Location:
 * Qualified Name:     sun.security.mscapi.RSAKeyPairGenerator
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package sun.security.mscapi;

import java.io.IOException;
import java.io.NotSerializableException;
import java.io.ObjectOutputStream;
import java.security.PrivateKey;

class RSAPrivateKey
  extends Key
  implements PrivateKey
{
  RSAPrivateKey(long paramLong1, long paramLong2, int paramInt)
  {
    super(paramLong1, paramLong2, paramInt);
  }
  
  public String getAlgorithm()
  {
    return "RSA";
  }
  
  public String toString()
  {
    return "RSAPrivateKey [size=" + keyLength + " bits, type=" + getKeyType(hCryptKey) + ", container=" + getContainerName(hCryptProv) + "]";
  }
  
  private void writeObject(ObjectOutputStream paramObjectOutputStream)
    throws IOException
  {
    throw new NotSerializableException();
  }
}

/* Location:
 * Qualified Name:     sun.security.mscapi.RSAPrivateKey
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package sun.security.mscapi;

import java.io.ObjectStreamException;
import java.math.BigInteger;
import java.security.KeyException;
import java.security.KeyRep;
import java.security.KeyRep.Type;
import java.security.ProviderException;
import sun.security.rsa.RSAPublicKeyImpl;

class RSAPublicKey
  extends Key
  implements java.security.interfaces.RSAPublicKey
{
  private byte[] publicKeyBlob = null;
  private byte[] encoding = null;
  private BigInteger modulus = null;
  private BigInteger exponent = null;
  
  RSAPublicKey(long paramLong1, long paramLong2, int paramInt)
  {
    super(paramLong1, paramLong2, paramInt);
  }
  
  public String getAlgorithm()
  {
    return "RSA";
  }
  
  public String toString()
  {
    StringBuffer localStringBuffer = new StringBuffer();
    
    localStringBuffer.append("RSAPublicKey [size=").append(keyLength).append(" bits, type=").append(getKeyType(hCryptKey)).append(", container=").append(getContainerName(hCryptProv)).append("]\n  modulus: ").append(getModulus()).append("\n  public exponent: ").append(getPublicExponent());
    
    return localStringBuffer.toString();
  }
  
  public BigInteger getPublicExponent()
  {
    if (exponent == null) {
      try
      {
        publicKeyBlob = getPublicKeyBlob(hCryptKey);
        exponent = new BigInteger(1, getExponent(publicKeyBlob));
      }
      catch (KeyException localKeyException)
      {
        throw new ProviderException(localKeyException);
      }
    }
    return exponent;
  }
  
  public BigInteger getModulus()
  {
    if (modulus == null) {
      try
      {
        publicKeyBlob = getPublicKeyBlob(hCryptKey);
        modulus = new BigInteger(1, getModulus(publicKeyBlob));
      }
      catch (KeyException localKeyException)
      {
        throw new ProviderException(localKeyException);
      }
    }
    return modulus;
  }
  
  public String getFormat()
  {
    return "X.509";
  }
  
  public byte[] getEncoded()
  {
    if (encoding == null) {
      try
      {
        encoding = new RSAPublicKeyImpl(getModulus(), getPublicExponent()).getEncoded();
      }
      catch (KeyException localKeyException) {}
    }
    return encoding;
  }
  
  protected Object writeReplace()
    throws ObjectStreamException
  {
    return new KeyRep(KeyRep.Type.PUBLIC, getAlgorithm(), getFormat(), getEncoded());
  }
  
  private native byte[] getPublicKeyBlob(long paramLong)
    throws KeyException;
  
  private native byte[] getExponent(byte[] paramArrayOfByte)
    throws KeyException;
  
  private native byte[] getModulus(byte[] paramArrayOfByte)
    throws KeyException;
}

/* Location:
 * Qualified Name:     sun.security.mscapi.RSAPublicKey
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package sun.security.mscapi;

public final class RSASignature$MD2
  extends RSASignature
{
  public RSASignature$MD2()
  {
    super("MD2");
  }
}

/* Location:
 * Qualified Name:     sun.security.mscapi.RSASignature.MD2
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package sun.security.mscapi;

public final class RSASignature$MD5
  extends RSASignature
{
  public RSASignature$MD5()
  {
    super("MD5");
  }
}

/* Location:
 * Qualified Name:     sun.security.mscapi.RSASignature.MD5
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package sun.security.mscapi;

import java.nio.ByteBuffer;
import java.security.SignatureException;

public final class RSASignature$Raw
  extends RSASignature
{
  private static final int RAW_RSA_MAX = 64;
  private final byte[] precomputedDigest;
  private int offset = 0;
  
  public RSASignature$Raw()
  {
    precomputedDigest = new byte[64];
  }
  
  protected void engineUpdate(byte paramByte)
    throws SignatureException
  {
    if (offset >= precomputedDigest.length)
    {
      offset = 65;
      return;
    }
    precomputedDigest[(offset++)] = paramByte;
  }
  
  protected void engineUpdate(byte[] paramArrayOfByte, int paramInt1, int paramInt2)
    throws SignatureException
  {
    if (offset + paramInt2 > precomputedDigest.length)
    {
      offset = 65;
      return;
    }
    System.arraycopy(paramArrayOfByte, paramInt1, precomputedDigest, offset, paramInt2);
    offset += paramInt2;
  }
  
  protected void engineUpdate(ByteBuffer paramByteBuffer)
  {
    int i = paramByteBuffer.remaining();
    if (i <= 0) {
      return;
    }
    if (offset + i > precomputedDigest.length)
    {
      offset = 65;
      return;
    }
    paramByteBuffer.get(precomputedDigest, offset, i);
    offset += i;
  }
  
  protected void resetDigest()
  {
    offset = 0;
  }
  
  protected byte[] getDigestValue()
    throws SignatureException
  {
    if (offset > 64) {
      throw new SignatureException("Message digest is too long");
    }
    if (offset == 20) {
      setDigestName("SHA1");
    } else if (offset == 36) {
      setDigestName("SHA1+MD5");
    } else if (offset == 32) {
      setDigestName("SHA-256");
    } else if (offset == 48) {
      setDigestName("SHA-384");
    } else if (offset == 64) {
      setDigestName("SHA-512");
    } else if (offset == 16) {
      setDigestName("MD5");
    } else {
      throw new SignatureException("Message digest length is not supported");
    }
    byte[] arrayOfByte = new byte[offset];
    System.arraycopy(precomputedDigest, 0, arrayOfByte, 0, offset);
    offset = 0;
    
    return arrayOfByte;
  }
}

/* Location:
 * Qualified Name:     sun.security.mscapi.RSASignature.Raw
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package sun.security.mscapi;

public final class RSASignature$SHA1
  extends RSASignature
{
  public RSASignature$SHA1()
  {
    super("SHA1");
  }
}

/* Location:
 * Qualified Name:     sun.security.mscapi.RSASignature.SHA1
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package sun.security.mscapi;

public final class RSASignature$SHA256
  extends RSASignature
{
  public RSASignature$SHA256()
  {
    super("SHA-256");
  }
}

/* Location:
 * Qualified Name:     sun.security.mscapi.RSASignature.SHA256
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package sun.security.mscapi;

public final class RSASignature$SHA384
  extends RSASignature
{
  public RSASignature$SHA384()
  {
    super("SHA-384");
  }
}

/* Location:
 * Qualified Name:     sun.security.mscapi.RSASignature.SHA384
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package sun.security.mscapi;

public final class RSASignature$SHA512
  extends RSASignature
{
  public RSASignature$SHA512()
  {
    super("SHA-512");
  }
}

/* Location:
 * Qualified Name:     sun.security.mscapi.RSASignature.SHA512
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package sun.security.mscapi;

import java.math.BigInteger;
import java.nio.ByteBuffer;
import java.security.InvalidKeyException;
import java.security.InvalidParameterException;
import java.security.KeyStoreException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.security.PrivateKey;
import java.security.ProviderException;
import java.security.PublicKey;
import java.security.SignatureException;
import java.security.SignatureSpi;
import sun.security.rsa.RSAKeyFactory;

abstract class RSASignature
  extends SignatureSpi
{
  private final MessageDigest messageDigest;
  private String messageDigestAlgorithm;
  private boolean needsReset;
  private Key privateKey = null;
  private Key publicKey = null;
  
  RSASignature()
  {
    messageDigest = null;
    messageDigestAlgorithm = null;
  }
  
  RSASignature(String paramString)
  {
    try
    {
      messageDigest = MessageDigest.getInstance(paramString);
      
      messageDigestAlgorithm = messageDigest.getAlgorithm();
    }
    catch (NoSuchAlgorithmException localNoSuchAlgorithmException)
    {
      throw new ProviderException(localNoSuchAlgorithmException);
    }
    needsReset = false;
  }
  
  public static final class Raw
    extends RSASignature
  {
    private static final int RAW_RSA_MAX = 64;
    private final byte[] precomputedDigest;
    private int offset = 0;
    
    public Raw()
    {
      precomputedDigest = new byte[64];
    }
    
    protected void engineUpdate(byte paramByte)
      throws SignatureException
    {
      if (offset >= precomputedDigest.length)
      {
        offset = 65;
        return;
      }
      precomputedDigest[(offset++)] = paramByte;
    }
    
    protected void engineUpdate(byte[] paramArrayOfByte, int paramInt1, int paramInt2)
      throws SignatureException
    {
      if (offset + paramInt2 > precomputedDigest.length)
      {
        offset = 65;
        return;
      }
      System.arraycopy(paramArrayOfByte, paramInt1, precomputedDigest, offset, paramInt2);
      offset += paramInt2;
    }
    
    protected void engineUpdate(ByteBuffer paramByteBuffer)
    {
      int i = paramByteBuffer.remaining();
      if (i <= 0) {
        return;
      }
      if (offset + i > precomputedDigest.length)
      {
        offset = 65;
        return;
      }
      paramByteBuffer.get(precomputedDigest, offset, i);
      offset += i;
    }
    
    protected void resetDigest()
    {
      offset = 0;
    }
    
    protected byte[] getDigestValue()
      throws SignatureException
    {
      if (offset > 64) {
        throw new SignatureException("Message digest is too long");
      }
      if (offset == 20) {
        setDigestName("SHA1");
      } else if (offset == 36) {
        setDigestName("SHA1+MD5");
      } else if (offset == 32) {
        setDigestName("SHA-256");
      } else if (offset == 48) {
        setDigestName("SHA-384");
      } else if (offset == 64) {
        setDigestName("SHA-512");
      } else if (offset == 16) {
        setDigestName("MD5");
      } else {
        throw new SignatureException("Message digest length is not supported");
      }
      byte[] arrayOfByte = new byte[offset];
      System.arraycopy(precomputedDigest, 0, arrayOfByte, 0, offset);
      offset = 0;
      
      return arrayOfByte;
    }
  }
  
  public static final class SHA1
    extends RSASignature
  {
    public SHA1()
    {
      super();
    }
  }
  
  public static final class SHA256
    extends RSASignature
  {
    public SHA256()
    {
      super();
    }
  }
  
  public static final class SHA384
    extends RSASignature
  {
    public SHA384()
    {
      super();
    }
  }
  
  public static final class SHA512
    extends RSASignature
  {
    public SHA512()
    {
      super();
    }
  }
  
  public static final class MD5
    extends RSASignature
  {
    public MD5()
    {
      super();
    }
  }
  
  public static final class MD2
    extends RSASignature
  {
    public MD2()
    {
      super();
    }
  }
  
  protected void engineInitVerify(PublicKey paramPublicKey)
    throws InvalidKeyException
  {
    if (!(paramPublicKey instanceof java.security.interfaces.RSAPublicKey)) {
      throw new InvalidKeyException("Key type not supported");
    }
    java.security.interfaces.RSAPublicKey localRSAPublicKey = (java.security.interfaces.RSAPublicKey)paramPublicKey;
    if (!(paramPublicKey instanceof RSAPublicKey))
    {
      BigInteger localBigInteger1 = localRSAPublicKey.getModulus();
      BigInteger localBigInteger2 = localRSAPublicKey.getPublicExponent();
      
      RSAKeyFactory.checkKeyLengths(localBigInteger1.bitLength() + 7 & 0xFFFFFFF8, localBigInteger2, -1, 16384);
      
      byte[] arrayOfByte1 = localBigInteger1.toByteArray();
      byte[] arrayOfByte2 = localBigInteger2.toByteArray();
      
      int i = arrayOfByte1[0] == 0 ? (arrayOfByte1.length - 1) * 8 : arrayOfByte1.length * 8;
      
      byte[] arrayOfByte3 = generatePublicKeyBlob(i, arrayOfByte1, arrayOfByte2);
      try
      {
        publicKey = importPublicKey(arrayOfByte3, i);
      }
      catch (KeyStoreException localKeyStoreException)
      {
        throw new InvalidKeyException(localKeyStoreException);
      }
    }
    else
    {
      publicKey = ((RSAPublicKey)paramPublicKey);
    }
    privateKey = null;
    resetDigest();
  }
  
  protected void engineInitSign(PrivateKey paramPrivateKey)
    throws InvalidKeyException
  {
    if (!(paramPrivateKey instanceof RSAPrivateKey)) {
      throw new InvalidKeyException("Key type not supported");
    }
    privateKey = ((RSAPrivateKey)paramPrivateKey);
    
    RSAKeyFactory.checkKeyLengths(privateKey.bitLength() + 7 & 0xFFFFFFF8, null, 512, 16384);
    
    publicKey = null;
    resetDigest();
  }
  
  protected void resetDigest()
  {
    if (needsReset)
    {
      messageDigest.reset();
      needsReset = false;
    }
  }
  
  protected byte[] getDigestValue()
    throws SignatureException
  {
    needsReset = false;
    return messageDigest.digest();
  }
  
  protected void setDigestName(String paramString)
  {
    messageDigestAlgorithm = paramString;
  }
  
  protected void engineUpdate(byte paramByte)
    throws SignatureException
  {
    messageDigest.update(paramByte);
    needsReset = true;
  }
  
  protected void engineUpdate(byte[] paramArrayOfByte, int paramInt1, int paramInt2)
    throws SignatureException
  {
    messageDigest.update(paramArrayOfByte, paramInt1, paramInt2);
    needsReset = true;
  }
  
  protected void engineUpdate(ByteBuffer paramByteBuffer)
  {
    messageDigest.update(paramByteBuffer);
    needsReset = true;
  }
  
  protected byte[] engineSign()
    throws SignatureException
  {
    byte[] arrayOfByte1 = getDigestValue();
    
    boolean bool = this instanceof Raw;
    
    byte[] arrayOfByte2 = signHash(bool, arrayOfByte1, arrayOfByte1.length, messageDigestAlgorithm, privateKey.getHCryptProvider(), privateKey.getHCryptKey());
    
    return convertEndianArray(arrayOfByte2);
  }
  
  private byte[] convertEndianArray(byte[] paramArrayOfByte)
  {
    if ((paramArrayOfByte == null) || (paramArrayOfByte.length == 0)) {
      return paramArrayOfByte;
    }
    byte[] arrayOfByte = new byte[paramArrayOfByte.length];
    for (int i = 0; i < paramArrayOfByte.length; i++) {
      arrayOfByte[i] = paramArrayOfByte[(paramArrayOfByte.length - i - 1)];
    }
    return arrayOfByte;
  }
  
  private static native byte[] signHash(boolean paramBoolean, byte[] paramArrayOfByte, int paramInt, String paramString, long paramLong1, long paramLong2)
    throws SignatureException;
  
  private static native boolean verifySignedHash(byte[] paramArrayOfByte1, int paramInt1, String paramString, byte[] paramArrayOfByte2, int paramInt2, long paramLong1, long paramLong2)
    throws SignatureException;
  
  protected boolean engineVerify(byte[] paramArrayOfByte)
    throws SignatureException
  {
    byte[] arrayOfByte = getDigestValue();
    
    return verifySignedHash(arrayOfByte, arrayOfByte.length, messageDigestAlgorithm, convertEndianArray(paramArrayOfByte), paramArrayOfByte.length, publicKey.getHCryptProvider(), publicKey.getHCryptKey());
  }
  
  /**
   * @deprecated
   */
  protected void engineSetParameter(String paramString, Object paramObject)
    throws InvalidParameterException
  {
    throw new InvalidParameterException("Parameter not supported");
  }
  
  /**
   * @deprecated
   */
  protected Object engineGetParameter(String paramString)
    throws InvalidParameterException
  {
    throw new InvalidParameterException("Parameter not supported");
  }
  
  static native byte[] generatePublicKeyBlob(int paramInt, byte[] paramArrayOfByte1, byte[] paramArrayOfByte2)
    throws InvalidKeyException;
  
  static native RSAPublicKey importPublicKey(byte[] paramArrayOfByte, int paramInt)
    throws KeyStoreException;
}

/* Location:
 * Qualified Name:     sun.security.mscapi.RSASignature
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package sun.security.mscapi;

import java.security.PrivilegedAction;

final class SunMSCAPI$1
  implements PrivilegedAction<Void>
{
  public Void run()
  {
    System.loadLibrary("sunmscapi");
    return null;
  }
}

/* Location:
 * Qualified Name:     sun.security.mscapi.SunMSCAPI.1
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package sun.security.mscapi;

import java.security.AccessController;
import java.security.PrivilegedAction;
import java.security.Provider;
import java.security.ProviderException;
import java.util.HashMap;
import java.util.Map;
import sun.security.action.PutAllAction;

public final class SunMSCAPI
  extends Provider
{
  private static final long serialVersionUID = 8622598936488630849L;
  private static final String INFO = "Sun's Microsoft Crypto API provider";
  private static volatile boolean integrityVerified;
  
  static
  {
    AccessController.doPrivileged(new PrivilegedAction()
    {
      public Void run()
      {
        System.loadLibrary("sunmscapi");
        return null;
      }
    });
  }
  
  public SunMSCAPI()
  {
    super("SunMSCAPI", 1.6D, "Sun's Microsoft Crypto API provider");
    
    HashMap localHashMap = System.getSecurityManager() == null ? this : new HashMap();
    
    localHashMap.put("SecureRandom.Windows-PRNG", "sun.security.mscapi.PRNG");
    
    localHashMap.put("KeyStore.Windows-MY", "sun.security.mscapi.KeyStore$MY");
    localHashMap.put("KeyStore.Windows-ROOT", "sun.security.mscapi.KeyStore$ROOT");
    
    localHashMap.put("Signature.NONEwithRSA", "sun.security.mscapi.RSASignature$Raw");
    
    localHashMap.put("Signature.SHA1withRSA", "sun.security.mscapi.RSASignature$SHA1");
    
    localHashMap.put("Signature.SHA256withRSA", "sun.security.mscapi.RSASignature$SHA256");
    
    localHashMap.put("Signature.SHA384withRSA", "sun.security.mscapi.RSASignature$SHA384");
    
    localHashMap.put("Signature.SHA512withRSA", "sun.security.mscapi.RSASignature$SHA512");
    
    localHashMap.put("Signature.MD5withRSA", "sun.security.mscapi.RSASignature$MD5");
    
    localHashMap.put("Signature.MD2withRSA", "sun.security.mscapi.RSASignature$MD2");
    
    localHashMap.put("Signature.NONEwithRSA SupportedKeyClasses", "sun.security.mscapi.Key");
    
    localHashMap.put("Signature.SHA1withRSA SupportedKeyClasses", "sun.security.mscapi.Key");
    
    localHashMap.put("Signature.SHA256withRSA SupportedKeyClasses", "sun.security.mscapi.Key");
    
    localHashMap.put("Signature.SHA384withRSA SupportedKeyClasses", "sun.security.mscapi.Key");
    
    localHashMap.put("Signature.SHA512withRSA SupportedKeyClasses", "sun.security.mscapi.Key");
    
    localHashMap.put("Signature.MD5withRSA SupportedKeyClasses", "sun.security.mscapi.Key");
    
    localHashMap.put("Signature.MD2withRSA SupportedKeyClasses", "sun.security.mscapi.Key");
    
    localHashMap.put("KeyPairGenerator.RSA", "sun.security.mscapi.RSAKeyPairGenerator");
    
    localHashMap.put("KeyPairGenerator.RSA KeySize", "1024");
    
    localHashMap.put("Cipher.RSA", "sun.security.mscapi.RSACipher");
    localHashMap.put("Cipher.RSA/ECB/PKCS1Padding", "sun.security.mscapi.RSACipher");
    localHashMap.put("Cipher.RSA SupportedModes", "ECB");
    localHashMap.put("Cipher.RSA SupportedPaddings", "PKCS1PADDING");
    localHashMap.put("Cipher.RSA SupportedKeyClasses", "sun.security.mscapi.Key");
    if (localHashMap != this) {
      AccessController.doPrivileged(new PutAllAction(this, localHashMap));
    }
  }
  
  static void verifySelfIntegrity(Class paramClass)
  {
    if (integrityVerified) {
      return;
    }
    doVerifySelfIntegrity(paramClass);
  }
  
  private static synchronized void doVerifySelfIntegrity(Class paramClass)
  {
    integrityVerified = JarVerifierImpl.doVerification(paramClass, "-----BEGIN CERTIFICATE-----\nMIICnTCCAlugAwIBAgICAh8wCwYHKoZIzjgEAwUAMIGQMQswCQYDVQQGEwJVUzELMAkGA1UECBMCQ0ExEjAQBgNVBAcTCVBhbG8gQWx0bzEdMBsGA1UEChMUU3VuIE1pY3Jvc3lzdGVtcyBJbmMxIzAhBgNVBAsTGkphdmEgU29mdHdhcmUgQ29kZSBTaWduaW5nMRwwGgYDVQQDExNKQ0UgQ29kZSBTaWduaW5nIENBMB4XDTA1MTEyMzIyNDk0MVoXDTEwMTEyNzIyNDk0MVowYzEdMBsGA1UEChMUU3VuIE1pY3Jvc3lzdGVtcyBJbmMxIzAhBgNVBAsTGkphdmEgU29mdHdhcmUgQ29kZSBTaWduaW5nMR0wGwYDVQQDExRTdW4gTWljcm9zeXN0ZW1zIEluYzCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA16bKo6tC3OHFDNfPXLKXMCMtIyeubNnsEtlvrH34HhfF+ZmpSliLCvQ15ms705vy4XgZUbZ3mgSOlLRMAGRo6596ePhc+0Z6yeKhbb3LZ8iz97ZIptkHGOshj9cfcSRPYmorUug9OsybMdIfQXazxT9mZJ9Yx5IDw6xak7kVbpUCAwEAAaOBiDCBhTARBglghkgBhvhCAQEEBAMCBBAwDgYDVR0PAQH/BAQDAgXgMB0GA1UdDgQWBBRI319jCbhc9DWJVltXgfrMybHNjzAfBgNVHSMEGDAWgBRl4vSGydNO8JFOWKJq9dh4WprBpjAgBgNVHREEGTAXgRV5dS1jaGluZy5wZW5nQHN1bi5jb20wCwYHKoZIzjgEAwUAAy8AMCwCFFBFmED9s3OoN9rbXfQV3+brJPW/AhQr+Wq1MlubAvnfjrlqeksh0QaDAQ==\n-----END CERTIFICATE-----");
    if (!integrityVerified) {
      throw new ProviderException("The SunMSCAPI provider may have been tampered with.");
    }
  }
}

/* Location:
 * Qualified Name:     sun.security.mscapi.SunMSCAPI
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
1 2

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