bcprov-jdk15-144

16:33:08.715 INFO  jd.cli.Main - Decompiling bcprov-jdk15-144.jar
package org.bouncycastle;

import java.io.PrintStream;

public class LICENSE
{
  public static String licenseText = "Copyright (c) 2000-2008 The Legion Of The Bouncy Castle (http://www.bouncycastle.org) " + System.getProperty("line.separator") + System.getProperty("line.separator") + "Permission is hereby granted, free of charge, to any person obtaining a copy of this software " + System.getProperty("line.separator") + "and associated documentation files (the \"Software\"), to deal in the Software without restriction, " + System.getProperty("line.separator") + "including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, " + System.getProperty("line.separator") + "and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so," + System.getProperty("line.separator") + "subject to the following conditions:" + System.getProperty("line.separator") + System.getProperty("line.separator") + "The above copyright notice and this permission notice shall be included in all copies or substantial" + System.getProperty("line.separator") + "portions of the Software." + System.getProperty("line.separator") + System.getProperty("line.separator") + "THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED," + System.getProperty("line.separator") + "INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR" + System.getProperty("line.separator") + "PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE" + System.getProperty("line.separator") + "LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR" + System.getProperty("line.separator") + "OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER" + System.getProperty("line.separator") + "DEALINGS IN THE SOFTWARE.";
  
  public static void main(String[] paramArrayOfString)
  {
    System.out.println(licenseText);
  }
}

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

import java.io.IOException;

public abstract interface ASN1ApplicationSpecificParser
  extends DEREncodable
{
  public abstract DEREncodable readObject()
    throws IOException;
}

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

public abstract interface ASN1Choice {}

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

import java.io.ByteArrayOutputStream;
import java.io.IOException;

public abstract class ASN1Encodable
  implements DEREncodable
{
  public static final String DER = "DER";
  public static final String BER = "BER";
  
  public byte[] getEncoded()
    throws IOException
  {
    ByteArrayOutputStream localByteArrayOutputStream = new ByteArrayOutputStream();
    ASN1OutputStream localASN1OutputStream = new ASN1OutputStream(localByteArrayOutputStream);
    localASN1OutputStream.writeObject(this);
    return localByteArrayOutputStream.toByteArray();
  }
  
  public byte[] getEncoded(String paramString)
    throws IOException
  {
    if (paramString.equals("DER"))
    {
      ByteArrayOutputStream localByteArrayOutputStream = new ByteArrayOutputStream();
      DEROutputStream localDEROutputStream = new DEROutputStream(localByteArrayOutputStream);
      localDEROutputStream.writeObject(this);
      return localByteArrayOutputStream.toByteArray();
    }
    return getEncoded();
  }
  
  public byte[] getDEREncoded()
  {
    try
    {
      return getEncoded("DER");
    }
    catch (IOException localIOException) {}
    return null;
  }
  
  public int hashCode()
  {
    return toASN1Object().hashCode();
  }
  
  public boolean equals(Object paramObject)
  {
    if (this == paramObject) {
      return true;
    }
    if (!(paramObject instanceof DEREncodable)) {
      return false;
    }
    DEREncodable localDEREncodable = (DEREncodable)paramObject;
    return toASN1Object().equals(localDEREncodable.getDERObject());
  }
  
  public DERObject getDERObject()
  {
    return toASN1Object();
  }
  
  public abstract DERObject toASN1Object();
}

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

public class ASN1EncodableVector
  extends DEREncodableVector
{}

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

import java.io.OutputStream;

public abstract class ASN1Generator
{
  protected OutputStream _out;
  
  public ASN1Generator(OutputStream paramOutputStream)
  {
    _out = paramOutputStream;
  }
  
  public abstract OutputStream getRawOutputStream();
}

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

import java.io.ByteArrayInputStream;
import java.io.EOFException;
import java.io.FilterInputStream;
import java.io.IOException;
import java.io.InputStream;
import org.bouncycastle.util.io.Streams;

public class ASN1InputStream
  extends FilterInputStream
  implements DERTags
{
  private final int limit;
  private final boolean lazyEvaluate;
  
  public ASN1InputStream(InputStream paramInputStream)
  {
    this(paramInputStream, Integer.MAX_VALUE);
  }
  
  public ASN1InputStream(byte[] paramArrayOfByte)
  {
    this(new ByteArrayInputStream(paramArrayOfByte), paramArrayOfByte.length);
  }
  
  public ASN1InputStream(byte[] paramArrayOfByte, boolean paramBoolean)
  {
    this(new ByteArrayInputStream(paramArrayOfByte), paramArrayOfByte.length, paramBoolean);
  }
  
  public ASN1InputStream(InputStream paramInputStream, int paramInt)
  {
    this(paramInputStream, paramInt, false);
  }
  
  public ASN1InputStream(InputStream paramInputStream, int paramInt, boolean paramBoolean)
  {
    super(paramInputStream);
    limit = paramInt;
    lazyEvaluate = paramBoolean;
  }
  
  protected int readLength()
    throws IOException
  {
    return readLength(this, limit);
  }
  
  protected void readFully(byte[] paramArrayOfByte)
    throws IOException
  {
    if (Streams.readFully(this, paramArrayOfByte) != paramArrayOfByte.length) {
      throw new EOFException("EOF encountered in middle of object");
    }
  }
  
  protected DERObject buildObject(int paramInt1, int paramInt2, int paramInt3)
    throws IOException
  {
    boolean bool = (paramInt1 & 0x20) != 0;
    DefiniteLengthInputStream localDefiniteLengthInputStream = new DefiniteLengthInputStream(this, paramInt3);
    if ((paramInt1 & 0x40) != 0) {
      return new DERApplicationSpecific(bool, paramInt2, localDefiniteLengthInputStream.toByteArray());
    }
    if ((paramInt1 & 0x80) != 0) {
      return new BERTaggedObjectParser(paramInt1, paramInt2, localDefiniteLengthInputStream).getDERObject();
    }
    if (bool)
    {
      switch (paramInt2)
      {
      case 4: 
        return new BERConstructedOctetString(buildDEREncodableVectorv);
      case 16: 
        if (lazyEvaluate) {
          return new LazyDERSequence(localDefiniteLengthInputStream.toByteArray());
        }
        return DERFactory.createSequence(buildDEREncodableVector(localDefiniteLengthInputStream));
      case 17: 
        return DERFactory.createSet(buildDEREncodableVector(localDefiniteLengthInputStream), false);
      }
      return new DERUnknownTag(true, paramInt2, localDefiniteLengthInputStream.toByteArray());
    }
    return createPrimitiveDERObject(paramInt2, localDefiniteLengthInputStream.toByteArray());
  }
  
  ASN1EncodableVector buildEncodableVector()
    throws IOException
  {
    ASN1EncodableVector localASN1EncodableVector = new ASN1EncodableVector();
    DERObject localDERObject;
    while ((localDERObject = readObject()) != null) {
      localASN1EncodableVector.add(localDERObject);
    }
    return localASN1EncodableVector;
  }
  
  ASN1EncodableVector buildDEREncodableVector(DefiniteLengthInputStream paramDefiniteLengthInputStream)
    throws IOException
  {
    return new ASN1InputStream(paramDefiniteLengthInputStream).buildEncodableVector();
  }
  
  public DERObject readObject()
    throws IOException
  {
    int i = read();
    if (i <= 0)
    {
      if (i == 0) {
        throw new IOException("unexpected end-of-contents marker");
      }
      return null;
    }
    int j = readTagNumber(this, i);
    int k = (i & 0x20) != 0 ? 1 : 0;
    int m = readLength();
    if (m < 0)
    {
      if (k == 0) {
        throw new IOException("indefinite length primitive encoding encountered");
      }
      IndefiniteLengthInputStream localIndefiniteLengthInputStream = new IndefiniteLengthInputStream(this);
      if ((i & 0x40) != 0)
      {
        localASN1StreamParser = new ASN1StreamParser(localIndefiniteLengthInputStream);
        return new BERApplicationSpecificParser(j, localASN1StreamParser).getDERObject();
      }
      if ((i & 0x80) != 0) {
        return new BERTaggedObjectParser(i, j, localIndefiniteLengthInputStream).getDERObject();
      }
      ASN1StreamParser localASN1StreamParser = new ASN1StreamParser(localIndefiniteLengthInputStream);
      switch (j)
      {
      case 4: 
        return new BEROctetStringParser(localASN1StreamParser).getDERObject();
      case 16: 
        return new BERSequenceParser(localASN1StreamParser).getDERObject();
      case 17: 
        return new BERSetParser(localASN1StreamParser).getDERObject();
      }
      throw new IOException("unknown BER object encountered");
    }
    return buildObject(i, j, m);
  }
  
  static int readTagNumber(InputStream paramInputStream, int paramInt)
    throws IOException
  {
    int i = paramInt & 0x1F;
    if (i == 31)
    {
      i = 0;
      int j = paramInputStream.read();
      if ((j & 0x7F) == 0) {
        throw new IOException("corrupted stream - invalid high tag number found");
      }
      while ((j >= 0) && ((j & 0x80) != 0))
      {
        i |= j & 0x7F;
        i <<= 7;
        j = paramInputStream.read();
      }
      if (j < 0) {
        throw new EOFException("EOF found inside tag value.");
      }
      i |= j & 0x7F;
    }
    return i;
  }
  
  static int readLength(InputStream paramInputStream, int paramInt)
    throws IOException
  {
    int i = paramInputStream.read();
    if (i < 0) {
      throw new EOFException("EOF found when length expected");
    }
    if (i == 128) {
      return -1;
    }
    if (i > 127)
    {
      int j = i & 0x7F;
      if (j > 4) {
        throw new IOException("DER length more than 4 bytes");
      }
      i = 0;
      for (int k = 0; k < j; k++)
      {
        int m = paramInputStream.read();
        if (m < 0) {
          throw new EOFException("EOF found reading length");
        }
        i = (i << 8) + m;
      }
      if (i < 0) {
        throw new IOException("corrupted stream - negative length found");
      }
      if (i >= paramInt) {
        throw new IOException("corrupted stream - out of bounds length found");
      }
    }
    return i;
  }
  
  static DERObject createPrimitiveDERObject(int paramInt, byte[] paramArrayOfByte)
  {
    switch (paramInt)
    {
    case 3: 
      int i = paramArrayOfByte[0];
      byte[] arrayOfByte = new byte[paramArrayOfByte.length - 1];
      System.arraycopy(paramArrayOfByte, 1, arrayOfByte, 0, paramArrayOfByte.length - 1);
      return new DERBitString(arrayOfByte, i);
    case 30: 
      return new DERBMPString(paramArrayOfByte);
    case 1: 
      return new DERBoolean(paramArrayOfByte);
    case 10: 
      return new DEREnumerated(paramArrayOfByte);
    case 24: 
      return new DERGeneralizedTime(paramArrayOfByte);
    case 27: 
      return new DERGeneralString(paramArrayOfByte);
    case 22: 
      return new DERIA5String(paramArrayOfByte);
    case 2: 
      return new DERInteger(paramArrayOfByte);
    case 5: 
      return DERNull.INSTANCE;
    case 18: 
      return new DERNumericString(paramArrayOfByte);
    case 6: 
      return new DERObjectIdentifier(paramArrayOfByte);
    case 4: 
      return new DEROctetString(paramArrayOfByte);
    case 19: 
      return new DERPrintableString(paramArrayOfByte);
    case 20: 
      return new DERT61String(paramArrayOfByte);
    case 28: 
      return new DERUniversalString(paramArrayOfByte);
    case 23: 
      return new DERUTCTime(paramArrayOfByte);
    case 12: 
      return new DERUTF8String(paramArrayOfByte);
    case 26: 
      return new DERVisibleString(paramArrayOfByte);
    }
    return new DERUnknownTag(false, paramInt, paramArrayOfByte);
  }
}

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

import java.io.IOException;

public abstract class ASN1Null
  extends ASN1Object
{
  public int hashCode()
  {
    return -1;
  }
  
  boolean asn1Equals(DERObject paramDERObject)
  {
    return (paramDERObject instanceof ASN1Null);
  }
  
  abstract void encode(DEROutputStream paramDEROutputStream)
    throws IOException;
  
  public String toString()
  {
    return "NULL";
  }
}

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

import java.io.IOException;

public abstract class ASN1Object
  extends DERObject
{
  public static ASN1Object fromByteArray(byte[] paramArrayOfByte)
    throws IOException
  {
    ASN1InputStream localASN1InputStream = new ASN1InputStream(paramArrayOfByte);
    return (ASN1Object)localASN1InputStream.readObject();
  }
  
  public final boolean equals(Object paramObject)
  {
    if (this == paramObject) {
      return true;
    }
    return ((paramObject instanceof DEREncodable)) && (asn1Equals(((DEREncodable)paramObject).getDERObject()));
  }
  
  public abstract int hashCode();
  
  abstract void encode(DEROutputStream paramDEROutputStream)
    throws IOException;
  
  abstract boolean asn1Equals(DERObject paramDERObject);
}

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

import java.io.InputStream;

/**
 * @deprecated
 */
public class ASN1ObjectParser
{
  ASN1StreamParser _aIn;
  
  protected ASN1ObjectParser(int paramInt1, int paramInt2, InputStream paramInputStream)
  {
    _aIn = new ASN1StreamParser(paramInputStream);
  }
}

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

import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Enumeration;
import java.util.Vector;
import org.bouncycastle.util.Arrays;
import org.bouncycastle.util.encoders.Hex;

public abstract class ASN1OctetString
  extends ASN1Object
  implements ASN1OctetStringParser
{
  byte[] string;
  
  public static ASN1OctetString getInstance(ASN1TaggedObject paramASN1TaggedObject, boolean paramBoolean)
  {
    return getInstance(paramASN1TaggedObject.getObject());
  }
  
  public static ASN1OctetString getInstance(Object paramObject)
  {
    if ((paramObject == null) || ((paramObject instanceof ASN1OctetString))) {
      return (ASN1OctetString)paramObject;
    }
    if ((paramObject instanceof ASN1TaggedObject)) {
      return getInstance(((ASN1TaggedObject)paramObject).getObject());
    }
    if ((paramObject instanceof ASN1Sequence))
    {
      Vector localVector = new Vector();
      Enumeration localEnumeration = ((ASN1Sequence)paramObject).getObjects();
      while (localEnumeration.hasMoreElements()) {
        localVector.addElement(localEnumeration.nextElement());
      }
      return new BERConstructedOctetString(localVector);
    }
    throw new IllegalArgumentException("illegal object in getInstance: " + paramObject.getClass().getName());
  }
  
  public ASN1OctetString(byte[] paramArrayOfByte)
  {
    if (paramArrayOfByte == null) {
      throw new NullPointerException("string cannot be null");
    }
    string = paramArrayOfByte;
  }
  
  public ASN1OctetString(DEREncodable paramDEREncodable)
  {
    try
    {
      string = paramDEREncodable.getDERObject().getEncoded("DER");
    }
    catch (IOException localIOException)
    {
      throw new IllegalArgumentException("Error processing object : " + localIOException.toString());
    }
  }
  
  public InputStream getOctetStream()
  {
    return new ByteArrayInputStream(string);
  }
  
  public ASN1OctetStringParser parser()
  {
    return this;
  }
  
  public byte[] getOctets()
  {
    return string;
  }
  
  public int hashCode()
  {
    return Arrays.hashCode(getOctets());
  }
  
  boolean asn1Equals(DERObject paramDERObject)
  {
    if (!(paramDERObject instanceof ASN1OctetString)) {
      return false;
    }
    ASN1OctetString localASN1OctetString = (ASN1OctetString)paramDERObject;
    return Arrays.areEqual(string, string);
  }
  
  abstract void encode(DEROutputStream paramDEROutputStream)
    throws IOException;
  
  public String toString()
  {
    return "#" + new String(Hex.encode(string));
  }
}

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

import java.io.InputStream;

public abstract interface ASN1OctetStringParser
  extends DEREncodable
{
  public abstract InputStream getOctetStream();
}

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

import java.io.IOException;
import java.io.OutputStream;

public class ASN1OutputStream
  extends DEROutputStream
{
  public ASN1OutputStream(OutputStream paramOutputStream)
  {
    super(paramOutputStream);
  }
  
  public void writeObject(Object paramObject)
    throws IOException
  {
    if (paramObject == null) {
      writeNull();
    } else if ((paramObject instanceof DERObject)) {
      ((DERObject)paramObject).encode(this);
    } else if ((paramObject instanceof DEREncodable)) {
      ((DEREncodable)paramObject).getDERObject().encode(this);
    } else {
      throw new IOException("object not ASN1Encodable");
    }
  }
}

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

import java.io.IOException;

class ASN1Sequence$1
  implements ASN1SequenceParser
{
  private final int max = this$0.size();
  private int index;
  
  ASN1Sequence$1(ASN1Sequence paramASN1Sequence1, ASN1Sequence paramASN1Sequence2) {}
  
  public DEREncodable readObject()
    throws IOException
  {
    if (index == max) {
      return null;
    }
    DEREncodable localDEREncodable = this$0.getObjectAt(index++);
    if ((localDEREncodable instanceof ASN1Sequence)) {
      return ((ASN1Sequence)localDEREncodable).parser();
    }
    if ((localDEREncodable instanceof ASN1Set)) {
      return ((ASN1Set)localDEREncodable).parser();
    }
    return localDEREncodable;
  }
  
  public DERObject getDERObject()
  {
    return val$outer;
  }
}

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

import java.io.IOException;
import java.util.Enumeration;
import java.util.Vector;

public abstract class ASN1Sequence
  extends ASN1Object
{
  private Vector seq = new Vector();
  
  public static ASN1Sequence getInstance(Object paramObject)
  {
    if ((paramObject == null) || ((paramObject instanceof ASN1Sequence))) {
      return (ASN1Sequence)paramObject;
    }
    throw new IllegalArgumentException("unknown object in getInstance: " + paramObject.getClass().getName());
  }
  
  public static ASN1Sequence getInstance(ASN1TaggedObject paramASN1TaggedObject, boolean paramBoolean)
  {
    if (paramBoolean)
    {
      if (!paramASN1TaggedObject.isExplicit()) {
        throw new IllegalArgumentException("object implicit - explicit expected.");
      }
      return (ASN1Sequence)paramASN1TaggedObject.getObject();
    }
    if (paramASN1TaggedObject.isExplicit())
    {
      if ((paramASN1TaggedObject instanceof BERTaggedObject)) {
        return new BERSequence(paramASN1TaggedObject.getObject());
      }
      return new DERSequence(paramASN1TaggedObject.getObject());
    }
    if ((paramASN1TaggedObject.getObject() instanceof ASN1Sequence)) {
      return (ASN1Sequence)paramASN1TaggedObject.getObject();
    }
    throw new IllegalArgumentException("unknown object in getInstance: " + paramASN1TaggedObject.getClass().getName());
  }
  
  public Enumeration getObjects()
  {
    return seq.elements();
  }
  
  public ASN1SequenceParser parser()
  {
    final ASN1Sequence localASN1Sequence = this;
    new ASN1SequenceParser()
    {
      private final int max = size();
      private int index;
      
      public DEREncodable readObject()
        throws IOException
      {
        if (index == max) {
          return null;
        }
        DEREncodable localDEREncodable = getObjectAt(index++);
        if ((localDEREncodable instanceof ASN1Sequence)) {
          return ((ASN1Sequence)localDEREncodable).parser();
        }
        if ((localDEREncodable instanceof ASN1Set)) {
          return ((ASN1Set)localDEREncodable).parser();
        }
        return localDEREncodable;
      }
      
      public DERObject getDERObject()
      {
        return localASN1Sequence;
      }
    };
  }
  
  public DEREncodable getObjectAt(int paramInt)
  {
    return (DEREncodable)seq.elementAt(paramInt);
  }
  
  public int size()
  {
    return seq.size();
  }
  
  public int hashCode()
  {
    Enumeration localEnumeration = getObjects();
    int i = size();
    while (localEnumeration.hasMoreElements())
    {
      Object localObject = localEnumeration.nextElement();
      i *= 17;
      if (localObject != null) {
        i ^= localObject.hashCode();
      }
    }
    return i;
  }
  
  boolean asn1Equals(DERObject paramDERObject)
  {
    if (!(paramDERObject instanceof ASN1Sequence)) {
      return false;
    }
    ASN1Sequence localASN1Sequence = (ASN1Sequence)paramDERObject;
    if (size() != localASN1Sequence.size()) {
      return false;
    }
    Enumeration localEnumeration1 = getObjects();
    Enumeration localEnumeration2 = localASN1Sequence.getObjects();
    while (localEnumeration1.hasMoreElements())
    {
      DERObject localDERObject1 = ((DEREncodable)localEnumeration1.nextElement()).getDERObject();
      DERObject localDERObject2 = ((DEREncodable)localEnumeration2.nextElement()).getDERObject();
      if ((localDERObject1 != localDERObject2) && ((localDERObject1 == null) || (!localDERObject1.equals(localDERObject2)))) {
        return false;
      }
    }
    return true;
  }
  
  protected void addObject(DEREncodable paramDEREncodable)
  {
    seq.addElement(paramDEREncodable);
  }
  
  abstract void encode(DEROutputStream paramDEROutputStream)
    throws IOException;
  
  public String toString()
  {
    return seq.toString();
  }
}

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

import java.io.IOException;

public abstract interface ASN1SequenceParser
  extends DEREncodable
{
  public abstract DEREncodable readObject()
    throws IOException;
}

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

import java.io.IOException;

class ASN1Set$1
  implements ASN1SetParser
{
  private final int max = this$0.size();
  private int index;
  
  ASN1Set$1(ASN1Set paramASN1Set1, ASN1Set paramASN1Set2) {}
  
  public DEREncodable readObject()
    throws IOException
  {
    if (index == max) {
      return null;
    }
    DEREncodable localDEREncodable = this$0.getObjectAt(index++);
    if ((localDEREncodable instanceof ASN1Sequence)) {
      return ((ASN1Sequence)localDEREncodable).parser();
    }
    if ((localDEREncodable instanceof ASN1Set)) {
      return ((ASN1Set)localDEREncodable).parser();
    }
    return localDEREncodable;
  }
  
  public DERObject getDERObject()
  {
    return val$outer;
  }
}

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

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.Enumeration;
import java.util.Vector;

public abstract class ASN1Set
  extends ASN1Object
{
  protected Vector set = new Vector();
  
  public static ASN1Set getInstance(Object paramObject)
  {
    if ((paramObject == null) || ((paramObject instanceof ASN1Set))) {
      return (ASN1Set)paramObject;
    }
    throw new IllegalArgumentException("unknown object in getInstance: " + paramObject.getClass().getName());
  }
  
  public static ASN1Set getInstance(ASN1TaggedObject paramASN1TaggedObject, boolean paramBoolean)
  {
    if (paramBoolean)
    {
      if (!paramASN1TaggedObject.isExplicit()) {
        throw new IllegalArgumentException("object implicit - explicit expected.");
      }
      return (ASN1Set)paramASN1TaggedObject.getObject();
    }
    if (paramASN1TaggedObject.isExplicit())
    {
      localObject = new DERSet(paramASN1TaggedObject.getObject());
      return (ASN1Set)localObject;
    }
    if ((paramASN1TaggedObject.getObject() instanceof ASN1Set)) {
      return (ASN1Set)paramASN1TaggedObject.getObject();
    }
    Object localObject = new ASN1EncodableVector();
    if ((paramASN1TaggedObject.getObject() instanceof ASN1Sequence))
    {
      ASN1Sequence localASN1Sequence = (ASN1Sequence)paramASN1TaggedObject.getObject();
      Enumeration localEnumeration = localASN1Sequence.getObjects();
      while (localEnumeration.hasMoreElements()) {
        ((ASN1EncodableVector)localObject).add((DEREncodable)localEnumeration.nextElement());
      }
      return new DERSet((DEREncodableVector)localObject, false);
    }
    throw new IllegalArgumentException("unknown object in getInstance: " + paramASN1TaggedObject.getClass().getName());
  }
  
  public Enumeration getObjects()
  {
    return set.elements();
  }
  
  public DEREncodable getObjectAt(int paramInt)
  {
    return (DEREncodable)set.elementAt(paramInt);
  }
  
  public int size()
  {
    return set.size();
  }
  
  public ASN1SetParser parser()
  {
    final ASN1Set localASN1Set = this;
    new ASN1SetParser()
    {
      private final int max = size();
      private int index;
      
      public DEREncodable readObject()
        throws IOException
      {
        if (index == max) {
          return null;
        }
        DEREncodable localDEREncodable = getObjectAt(index++);
        if ((localDEREncodable instanceof ASN1Sequence)) {
          return ((ASN1Sequence)localDEREncodable).parser();
        }
        if ((localDEREncodable instanceof ASN1Set)) {
          return ((ASN1Set)localDEREncodable).parser();
        }
        return localDEREncodable;
      }
      
      public DERObject getDERObject()
      {
        return localASN1Set;
      }
    };
  }
  
  public int hashCode()
  {
    Enumeration localEnumeration = getObjects();
    int i = size();
    while (localEnumeration.hasMoreElements())
    {
      Object localObject = localEnumeration.nextElement();
      i *= 17;
      if (localObject != null) {
        i ^= localObject.hashCode();
      }
    }
    return i;
  }
  
  boolean asn1Equals(DERObject paramDERObject)
  {
    if (!(paramDERObject instanceof ASN1Set)) {
      return false;
    }
    ASN1Set localASN1Set = (ASN1Set)paramDERObject;
    if (size() != localASN1Set.size()) {
      return false;
    }
    Enumeration localEnumeration1 = getObjects();
    Enumeration localEnumeration2 = localASN1Set.getObjects();
    while (localEnumeration1.hasMoreElements())
    {
      DERObject localDERObject1 = ((DEREncodable)localEnumeration1.nextElement()).getDERObject();
      DERObject localDERObject2 = ((DEREncodable)localEnumeration2.nextElement()).getDERObject();
      if ((localDERObject1 != localDERObject2) && ((localDERObject1 == null) || (!localDERObject1.equals(localDERObject2)))) {
        return false;
      }
    }
    return true;
  }
  
  private boolean lessThanOrEqual(byte[] paramArrayOfByte1, byte[] paramArrayOfByte2)
  {
    int j;
    int k;
    if (paramArrayOfByte1.length <= paramArrayOfByte2.length)
    {
      for (i = 0; i != paramArrayOfByte1.length; i++)
      {
        j = paramArrayOfByte1[i] & 0xFF;
        k = paramArrayOfByte2[i] & 0xFF;
        if (k > j) {
          return true;
        }
        if (j > k) {
          return false;
        }
      }
      return true;
    }
    for (int i = 0; i != paramArrayOfByte2.length; i++)
    {
      j = paramArrayOfByte1[i] & 0xFF;
      k = paramArrayOfByte2[i] & 0xFF;
      if (k > j) {
        return true;
      }
      if (j > k) {
        return false;
      }
    }
    return false;
  }
  
  private byte[] getEncoded(DEREncodable paramDEREncodable)
  {
    ByteArrayOutputStream localByteArrayOutputStream = new ByteArrayOutputStream();
    ASN1OutputStream localASN1OutputStream = new ASN1OutputStream(localByteArrayOutputStream);
    try
    {
      localASN1OutputStream.writeObject(paramDEREncodable);
    }
    catch (IOException localIOException)
    {
      throw new IllegalArgumentException("cannot encode object added to SET");
    }
    return localByteArrayOutputStream.toByteArray();
  }
  
  protected void sort()
  {
    if (set.size() > 1)
    {
      int i = 1;
      int m;
      for (int j = set.size() - 1; i != 0; j = m)
      {
        int k = 0;
        m = 0;
        Object localObject1 = getEncoded((DEREncodable)set.elementAt(0));
        i = 0;
        while (k != j)
        {
          byte[] arrayOfByte = getEncoded((DEREncodable)set.elementAt(k + 1));
          if (lessThanOrEqual((byte[])localObject1, arrayOfByte))
          {
            localObject1 = arrayOfByte;
          }
          else
          {
            Object localObject2 = set.elementAt(k);
            set.setElementAt(set.elementAt(k + 1), k);
            set.setElementAt(localObject2, k + 1);
            i = 1;
            m = k;
          }
          k++;
        }
      }
    }
  }
  
  protected void addObject(DEREncodable paramDEREncodable)
  {
    set.addElement(paramDEREncodable);
  }
  
  abstract void encode(DEROutputStream paramDEROutputStream)
    throws IOException;
  
  public String toString()
  {
    return set.toString();
  }
}

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

import java.io.IOException;

public abstract interface ASN1SetParser
  extends DEREncodable
{
  public abstract DEREncodable readObject()
    throws IOException;
}

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

import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;

public class ASN1StreamParser
{
  private final InputStream _in;
  private final int _limit;
  
  public ASN1StreamParser(InputStream paramInputStream)
  {
    this(paramInputStream, Integer.MAX_VALUE);
  }
  
  public ASN1StreamParser(InputStream paramInputStream, int paramInt)
  {
    _in = paramInputStream;
    _limit = paramInt;
  }
  
  public ASN1StreamParser(byte[] paramArrayOfByte)
  {
    this(new ByteArrayInputStream(paramArrayOfByte), paramArrayOfByte.length);
  }
  
  public DEREncodable readObject()
    throws IOException
  {
    int i = _in.read();
    if (i == -1) {
      return null;
    }
    set00Check(false);
    int j = ASN1InputStream.readTagNumber(_in, i);
    boolean bool = (i & 0x20) != 0;
    int k = ASN1InputStream.readLength(_in, _limit);
    if (k < 0)
    {
      if (!bool) {
        throw new IOException("indefinite length primitive encoding encountered");
      }
      localObject = new IndefiniteLengthInputStream(_in);
      if ((i & 0x40) != 0)
      {
        localASN1StreamParser = new ASN1StreamParser((InputStream)localObject);
        return new BERApplicationSpecificParser(j, localASN1StreamParser);
      }
      if ((i & 0x80) != 0) {
        return new BERTaggedObjectParser(i, j, (InputStream)localObject);
      }
      ASN1StreamParser localASN1StreamParser = new ASN1StreamParser((InputStream)localObject);
      switch (j)
      {
      case 4: 
        return new BEROctetStringParser(localASN1StreamParser);
      case 16: 
        return new BERSequenceParser(localASN1StreamParser);
      case 17: 
        return new BERSetParser(localASN1StreamParser);
      }
      throw new IOException("unknown BER object encountered");
    }
    Object localObject = new DefiniteLengthInputStream(_in, k);
    if ((i & 0x40) != 0) {
      return new DERApplicationSpecific(bool, j, ((DefiniteLengthInputStream)localObject).toByteArray());
    }
    if ((i & 0x80) != 0) {
      return new BERTaggedObjectParser(i, j, (InputStream)localObject);
    }
    if (bool)
    {
      switch (j)
      {
      case 4: 
        return new BEROctetStringParser(new ASN1StreamParser((InputStream)localObject));
      case 16: 
        return new DERSequenceParser(new ASN1StreamParser((InputStream)localObject));
      case 17: 
        return new DERSetParser(new ASN1StreamParser((InputStream)localObject));
      }
      return new DERUnknownTag(true, j, ((DefiniteLengthInputStream)localObject).toByteArray());
    }
    switch (j)
    {
    case 4: 
      return new DEROctetStringParser((DefiniteLengthInputStream)localObject);
    }
    return ASN1InputStream.createPrimitiveDERObject(j, ((DefiniteLengthInputStream)localObject).toByteArray());
  }
  
  private void set00Check(boolean paramBoolean)
  {
    if ((_in instanceof IndefiniteLengthInputStream)) {
      ((IndefiniteLengthInputStream)_in).setEofOn00(paramBoolean);
    }
  }
  
  ASN1EncodableVector readVector()
    throws IOException
  {
    ASN1EncodableVector localASN1EncodableVector = new ASN1EncodableVector();
    DEREncodable localDEREncodable;
    while ((localDEREncodable = readObject()) != null) {
      localASN1EncodableVector.add(localDEREncodable.getDERObject());
    }
    return localASN1EncodableVector;
  }
}

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

import java.io.IOException;

public abstract class ASN1TaggedObject
  extends ASN1Object
  implements ASN1TaggedObjectParser
{
  int tagNo;
  boolean empty = false;
  boolean explicit = true;
  DEREncodable obj = null;
  
  public static ASN1TaggedObject getInstance(ASN1TaggedObject paramASN1TaggedObject, boolean paramBoolean)
  {
    if (paramBoolean) {
      return (ASN1TaggedObject)paramASN1TaggedObject.getObject();
    }
    throw new IllegalArgumentException("implicitly tagged tagged object");
  }
  
  public static ASN1TaggedObject getInstance(Object paramObject)
  {
    if ((paramObject == null) || ((paramObject instanceof ASN1TaggedObject))) {
      return (ASN1TaggedObject)paramObject;
    }
    throw new IllegalArgumentException("unknown object in getInstance: " + paramObject.getClass().getName());
  }
  
  public ASN1TaggedObject(int paramInt, DEREncodable paramDEREncodable)
  {
    explicit = true;
    tagNo = paramInt;
    obj = paramDEREncodable;
  }
  
  public ASN1TaggedObject(boolean paramBoolean, int paramInt, DEREncodable paramDEREncodable)
  {
    if ((paramDEREncodable instanceof ASN1Choice)) {
      explicit = true;
    } else {
      explicit = paramBoolean;
    }
    tagNo = paramInt;
    obj = paramDEREncodable;
  }
  
  boolean asn1Equals(DERObject paramDERObject)
  {
    if (!(paramDERObject instanceof ASN1TaggedObject)) {
      return false;
    }
    ASN1TaggedObject localASN1TaggedObject = (ASN1TaggedObject)paramDERObject;
    if ((tagNo != tagNo) || (empty != empty) || (explicit != explicit)) {
      return false;
    }
    if (obj == null)
    {
      if (obj != null) {
        return false;
      }
    }
    else if (!obj.getDERObject().equals(obj.getDERObject())) {
      return false;
    }
    return true;
  }
  
  public int hashCode()
  {
    int i = tagNo;
    if (obj != null) {
      i ^= obj.hashCode();
    }
    return i;
  }
  
  public int getTagNo()
  {
    return tagNo;
  }
  
  public boolean isExplicit()
  {
    return explicit;
  }
  
  public boolean isEmpty()
  {
    return empty;
  }
  
  public DERObject getObject()
  {
    if (obj != null) {
      return obj.getDERObject();
    }
    return null;
  }
  
  public DEREncodable getObjectParser(int paramInt, boolean paramBoolean)
  {
    switch (paramInt)
    {
    case 17: 
      return ASN1Set.getInstance(this, paramBoolean).parser();
    case 16: 
      return ASN1Sequence.getInstance(this, paramBoolean).parser();
    case 4: 
      return ASN1OctetString.getInstance(this, paramBoolean).parser();
    }
    if (paramBoolean) {
      return getObject();
    }
    throw new RuntimeException("implicit tagging not implemented for tag: " + paramInt);
  }
  
  abstract void encode(DEROutputStream paramDEROutputStream)
    throws IOException;
  
  public String toString()
  {
    return "[" + tagNo + "]" + obj;
  }
}

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

import java.io.IOException;

public abstract interface ASN1TaggedObjectParser
  extends DEREncodable
{
  public abstract int getTagNo();
  
  public abstract DEREncodable getObjectParser(int paramInt, boolean paramBoolean)
    throws IOException;
}

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

public class BERApplicationSpecific
  extends DERApplicationSpecific
{
  public BERApplicationSpecific(int paramInt, ASN1EncodableVector paramASN1EncodableVector)
  {
    super(paramInt, paramASN1EncodableVector);
  }
}

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

import java.io.IOException;

public class BERApplicationSpecificParser
  implements ASN1ApplicationSpecificParser
{
  private final int tag;
  private final ASN1StreamParser parser;
  
  BERApplicationSpecificParser(int paramInt, ASN1StreamParser paramASN1StreamParser)
  {
    tag = paramInt;
    parser = paramASN1StreamParser;
  }
  
  public DEREncodable readObject()
    throws IOException
  {
    return parser.readObject();
  }
  
  public DERObject getDERObject()
  {
    try
    {
      return new BERApplicationSpecific(tag, parser.readVector());
    }
    catch (IOException localIOException)
    {
      throw new IllegalStateException(localIOException.getMessage());
    }
  }
}

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

import java.io.ByteArrayOut
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 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104

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