bcprov-jdk15on-147

16:33:10.727 INFO  jd.cli.Main - Decompiling bcprov-jdk15on-147.jar
package org.bouncycastle;

import java.io.PrintStream;

public class LICENSE
{
  public static String licenseText = "Copyright (c) 2000-2012 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 ASN1Encodable, InMemoryRepresentable
{
  public abstract ASN1Encodable 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 class ASN1Boolean
  extends DERBoolean
{
  public ASN1Boolean(boolean paramBoolean)
  {
    super(paramBoolean);
  }
  
  ASN1Boolean(byte[] paramArrayOfByte)
  {
    super(paramArrayOfByte);
  }
}

/* Location:
 * Qualified Name:     org.bouncycastle.asn1.ASN1Boolean
 * 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;

public abstract interface ASN1Encodable
{
  public abstract ASN1Primitive toASN1Primitive();
}

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

import java.util.Vector;

public class ASN1EncodableVector
{
  Vector v = new Vector();
  
  public void add(ASN1Encodable paramASN1Encodable)
  {
    v.addElement(paramASN1Encodable);
  }
  
  public ASN1Encodable get(int paramInt)
  {
    return (ASN1Encodable)v.elementAt(paramInt);
  }
  
  public int size()
  {
    return v.size();
  }
}

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

public abstract interface ASN1Encoding
{
  public static final String DER = "DER";
  public static final String DL = "DL";
  public static final String BER = "BER";
}

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

import java.math.BigInteger;

public class ASN1Enumerated
  extends DEREnumerated
{
  ASN1Enumerated(byte[] paramArrayOfByte)
  {
    super(paramArrayOfByte);
  }
  
  public ASN1Enumerated(BigInteger paramBigInteger)
  {
    super(paramBigInteger);
  }
  
  public ASN1Enumerated(int paramInt)
  {
    super(paramInt);
  }
}

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

import java.io.IOException;

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

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

import java.util.Date;

public class ASN1GeneralizedTime
  extends DERGeneralizedTime
{
  ASN1GeneralizedTime(byte[] paramArrayOfByte)
  {
    super(paramArrayOfByte);
  }
  
  public ASN1GeneralizedTime(Date paramDate)
  {
    super(paramDate);
  }
  
  public ASN1GeneralizedTime(String paramString)
  {
    super(paramString);
  }
}

/* Location:
 * Qualified Name:     org.bouncycastle.asn1.ASN1GeneralizedTime
 * 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 BERTags
{
  private final int limit;
  private final boolean lazyEvaluate;
  private final byte[][] tmpBuffers;
  
  public ASN1InputStream(InputStream paramInputStream)
  {
    this(paramInputStream, StreamUtil.findLimit(paramInputStream));
  }
  
  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, boolean paramBoolean)
  {
    this(paramInputStream, StreamUtil.findLimit(paramInputStream), paramBoolean);
  }
  
  public ASN1InputStream(InputStream paramInputStream, int paramInt, boolean paramBoolean)
  {
    super(paramInputStream);
    limit = paramInt;
    lazyEvaluate = paramBoolean;
    tmpBuffers = new byte[11][];
  }
  
  int getLimit()
  {
    return limit;
  }
  
  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 ASN1Primitive 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 ASN1StreamParser(localDefiniteLengthInputStream).readTaggedObject(bool, paramInt2);
    }
    if (bool)
    {
      switch (paramInt2)
      {
      case 4: 
        ASN1EncodableVector localASN1EncodableVector = buildDEREncodableVector(localDefiniteLengthInputStream);
        ASN1OctetString[] arrayOfASN1OctetString = new ASN1OctetString[localASN1EncodableVector.size()];
        for (int i = 0; i != arrayOfASN1OctetString.length; i++) {
          arrayOfASN1OctetString[i] = ((ASN1OctetString)localASN1EncodableVector.get(i));
        }
        return new BEROctetString(arrayOfASN1OctetString);
      case 16: 
        if (lazyEvaluate) {
          return new LazyEncodedSequence(localDefiniteLengthInputStream.toByteArray());
        }
        return DERFactory.createSequence(buildDEREncodableVector(localDefiniteLengthInputStream));
      case 17: 
        return DERFactory.createSet(buildDEREncodableVector(localDefiniteLengthInputStream));
      case 8: 
        return new DERExternal(buildDEREncodableVector(localDefiniteLengthInputStream));
      }
      throw new IOException("unknown tag " + paramInt2 + " encountered");
    }
    return createPrimitiveDERObject(paramInt2, localDefiniteLengthInputStream, tmpBuffers);
  }
  
  ASN1EncodableVector buildEncodableVector()
    throws IOException
  {
    ASN1EncodableVector localASN1EncodableVector = new ASN1EncodableVector();
    ASN1Primitive localASN1Primitive;
    while ((localASN1Primitive = readObject()) != null) {
      localASN1EncodableVector.add(localASN1Primitive);
    }
    return localASN1EncodableVector;
  }
  
  ASN1EncodableVector buildDEREncodableVector(DefiniteLengthInputStream paramDefiniteLengthInputStream)
    throws IOException
  {
    return new ASN1InputStream(paramDefiniteLengthInputStream).buildEncodableVector();
  }
  
  public ASN1Primitive 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, limit);
      ASN1StreamParser localASN1StreamParser = new ASN1StreamParser(localIndefiniteLengthInputStream, limit);
      if ((i & 0x40) != 0) {
        return new BERApplicationSpecificParser(j, localASN1StreamParser).getLoadedObject();
      }
      if ((i & 0x80) != 0) {
        return new BERTaggedObjectParser(true, j, localASN1StreamParser).getLoadedObject();
      }
      switch (j)
      {
      case 4: 
        return new BEROctetStringParser(localASN1StreamParser).getLoadedObject();
      case 16: 
        return new BERSequenceParser(localASN1StreamParser).getLoadedObject();
      case 17: 
        return new BERSetParser(localASN1StreamParser).getLoadedObject();
      case 8: 
        return new DERExternalParser(localASN1StreamParser).getLoadedObject();
      }
      throw new IOException("unknown BER object encountered");
    }
    try
    {
      return buildObject(i, j, m);
    }
    catch (IllegalArgumentException localIllegalArgumentException)
    {
      throw new ASN1Exception("corrupted stream detected", localIllegalArgumentException);
    }
  }
  
  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: " + j);
      }
      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;
  }
  
  private static byte[] getBuffer(DefiniteLengthInputStream paramDefiniteLengthInputStream, byte[][] paramArrayOfByte)
    throws IOException
  {
    int i = paramDefiniteLengthInputStream.getRemaining();
    if (paramDefiniteLengthInputStream.getRemaining() < paramArrayOfByte.length)
    {
      byte[] arrayOfByte = paramArrayOfByte[i];
      if (arrayOfByte == null) {
        arrayOfByte = paramArrayOfByte[i] = new byte[i];
      }
      Streams.readFully(paramDefiniteLengthInputStream, arrayOfByte);
      return arrayOfByte;
    }
    return paramDefiniteLengthInputStream.toByteArray();
  }
  
  private static char[] getBMPCharBuffer(DefiniteLengthInputStream paramDefiniteLengthInputStream)
    throws IOException
  {
    int i = paramDefiniteLengthInputStream.getRemaining() / 2;
    char[] arrayOfChar = new char[i];
    int j = 0;
    while (j < i)
    {
      int k = paramDefiniteLengthInputStream.read();
      if (k < 0) {
        break;
      }
      int m = paramDefiniteLengthInputStream.read();
      if (m < 0) {
        break;
      }
      arrayOfChar[(j++)] = ((char)(k << 8 | m & 0xFF));
    }
    return arrayOfChar;
  }
  
  static ASN1Primitive createPrimitiveDERObject(int paramInt, DefiniteLengthInputStream paramDefiniteLengthInputStream, byte[][] paramArrayOfByte)
    throws IOException
  {
    switch (paramInt)
    {
    case 3: 
      return DERBitString.fromInputStream(paramDefiniteLengthInputStream.getRemaining(), paramDefiniteLengthInputStream);
    case 30: 
      return new DERBMPString(getBMPCharBuffer(paramDefiniteLengthInputStream));
    case 1: 
      return ASN1Boolean.fromOctetString(getBuffer(paramDefiniteLengthInputStream, paramArrayOfByte));
    case 10: 
      return ASN1Enumerated.fromOctetString(getBuffer(paramDefiniteLengthInputStream, paramArrayOfByte));
    case 24: 
      return new ASN1GeneralizedTime(paramDefiniteLengthInputStream.toByteArray());
    case 27: 
      return new DERGeneralString(paramDefiniteLengthInputStream.toByteArray());
    case 22: 
      return new DERIA5String(paramDefiniteLengthInputStream.toByteArray());
    case 2: 
      return new ASN1Integer(paramDefiniteLengthInputStream.toByteArray());
    case 5: 
      return DERNull.INSTANCE;
    case 18: 
      return new DERNumericString(paramDefiniteLengthInputStream.toByteArray());
    case 6: 
      return ASN1ObjectIdentifier.fromOctetString(getBuffer(paramDefiniteLengthInputStream, paramArrayOfByte));
    case 4: 
      return new DEROctetString(paramDefiniteLengthInputStream.toByteArray());
    case 19: 
      return new DERPrintableString(paramDefiniteLengthInputStream.toByteArray());
    case 20: 
      return new DERT61String(paramDefiniteLengthInputStream.toByteArray());
    case 28: 
      return new DERUniversalString(paramDefiniteLengthInputStream.toByteArray());
    case 23: 
      return new ASN1UTCTime(paramDefiniteLengthInputStream.toByteArray());
    case 12: 
      return new DERUTF8String(paramDefiniteLengthInputStream.toByteArray());
    case 26: 
      return new DERVisibleString(paramDefiniteLengthInputStream.toByteArray());
    }
    throw new IOException("unknown tag " + paramInt + " encountered");
  }
}

/* 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.math.BigInteger;

public class ASN1Integer
  extends DERInteger
{
  ASN1Integer(byte[] paramArrayOfByte)
  {
    super(paramArrayOfByte);
  }
  
  public ASN1Integer(BigInteger paramBigInteger)
  {
    super(paramBigInteger);
  }
  
  public ASN1Integer(int paramInt)
  {
    super(paramInt);
  }
}

/* Location:
 * Qualified Name:     org.bouncycastle.asn1.ASN1Integer
 * 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 ASN1Primitive
{
  public static ASN1Null getInstance(Object paramObject)
  {
    if ((paramObject instanceof ASN1Null)) {
      return (ASN1Null)paramObject;
    }
    if (paramObject != null) {
      try
      {
        return getInstance(ASN1Primitive.fromByteArray((byte[])paramObject));
      }
      catch (IOException localIOException)
      {
        throw new IllegalArgumentException("failed to construct NULL from byte[]: " + localIOException.getMessage());
      }
      catch (ClassCastException localClassCastException)
      {
        throw new IllegalArgumentException("unknown object in getInstance(): " + paramObject.getClass().getName());
      }
    }
    return null;
  }
  
  public int hashCode()
  {
    return -1;
  }
  
  boolean asn1Equals(ASN1Primitive paramASN1Primitive)
  {
    return (paramASN1Primitive instanceof ASN1Null);
  }
  
  abstract void encode(ASN1OutputStream paramASN1OutputStream)
    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.ByteArrayOutputStream;
import java.io.IOException;

public abstract class ASN1Object
  implements ASN1Encodable
{
  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
  {
    ByteArrayOutputStream localByteArrayOutputStream;
    Object localObject;
    if (paramString.equals("DER"))
    {
      localByteArrayOutputStream = new ByteArrayOutputStream();
      localObject = new DEROutputStream(localByteArrayOutputStream);
      ((DEROutputStream)localObject).writeObject(this);
      return localByteArrayOutputStream.toByteArray();
    }
    if (paramString.equals("DL"))
    {
      localByteArrayOutputStream = new ByteArrayOutputStream();
      localObject = new DLOutputStream(localByteArrayOutputStream);
      ((DLOutputStream)localObject).writeObject(this);
      return localByteArrayOutputStream.toByteArray();
    }
    return getEncoded();
  }
  
  public int hashCode()
  {
    return toASN1Primitive().hashCode();
  }
  
  public boolean equals(Object paramObject)
  {
    if (this == paramObject) {
      return true;
    }
    if (!(paramObject instanceof ASN1Encodable)) {
      return false;
    }
    ASN1Encodable localASN1Encodable = (ASN1Encodable)paramObject;
    return toASN1Primitive().equals(localASN1Encodable.toASN1Primitive());
  }
  
  /**
   * @deprecated
   */
  public ASN1Primitive toASN1Object()
  {
    return toASN1Primitive();
  }
  
  protected static boolean hasEncodedTagValue(Object paramObject, int paramInt)
  {
    return ((paramObject instanceof byte[])) && (((byte[])(byte[])paramObject)[0] == paramInt);
  }
  
  public abstract ASN1Primitive toASN1Primitive();
}

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

public class ASN1ObjectIdentifier
  extends DERObjectIdentifier
{
  public ASN1ObjectIdentifier(String paramString)
  {
    super(paramString);
  }
  
  ASN1ObjectIdentifier(byte[] paramArrayOfByte)
  {
    super(paramArrayOfByte);
  }
  
  public ASN1ObjectIdentifier branch(String paramString)
  {
    return new ASN1ObjectIdentifier(getId() + "." + paramString);
  }
  
  public boolean on(ASN1ObjectIdentifier paramASN1ObjectIdentifier)
  {
    String str1 = getId();
    String str2 = paramASN1ObjectIdentifier.getId();
    return (str1.length() > str2.length()) && (str1.charAt(str2.length()) == '.') && (str1.startsWith(str2));
  }
}

/* Location:
 * Qualified Name:     org.bouncycastle.asn1.ASN1ObjectIdentifier
 * 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 org.bouncycastle.util.Arrays;
import org.bouncycastle.util.encoders.Hex;

public abstract class ASN1OctetString
  extends ASN1Primitive
  implements ASN1OctetStringParser
{
  byte[] string;
  
  public static ASN1OctetString getInstance(ASN1TaggedObject paramASN1TaggedObject, boolean paramBoolean)
  {
    ASN1Primitive localASN1Primitive = paramASN1TaggedObject.getObject();
    if ((paramBoolean) || ((localASN1Primitive instanceof ASN1OctetString))) {
      return getInstance(localASN1Primitive);
    }
    return BEROctetString.fromSequence(ASN1Sequence.getInstance(localASN1Primitive));
  }
  
  public static ASN1OctetString getInstance(Object paramObject)
  {
    if ((paramObject == null) || ((paramObject instanceof ASN1OctetString))) {
      return (ASN1OctetString)paramObject;
    }
    if ((paramObject instanceof byte[])) {
      try
      {
        return getInstance(ASN1Primitive.fromByteArray((byte[])paramObject));
      }
      catch (IOException localIOException)
      {
        throw new IllegalArgumentException("failed to construct OCTET STRING from byte[]: " + localIOException.getMessage());
      }
    }
    if ((paramObject instanceof ASN1Encodable))
    {
      ASN1Primitive localASN1Primitive = ((ASN1Encodable)paramObject).toASN1Primitive();
      if ((localASN1Primitive instanceof ASN1OctetString)) {
        return (ASN1OctetString)localASN1Primitive;
      }
    }
    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 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(ASN1Primitive paramASN1Primitive)
  {
    if (!(paramASN1Primitive instanceof ASN1OctetString)) {
      return false;
    }
    ASN1OctetString localASN1OctetString = (ASN1OctetString)paramASN1Primitive;
    return Arrays.areEqual(string, string);
  }
  
  public ASN1Primitive getLoadedObject()
  {
    return toASN1Primitive();
  }
  
  ASN1Primitive toDERObject()
  {
    return new DEROctetString(string);
  }
  
  ASN1Primitive toDLObject()
  {
    return new DEROctetString(string);
  }
  
  abstract void encode(ASN1OutputStream paramASN1OutputStream)
    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 ASN1Encodable, InMemoryRepresentable
{
  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;

class ASN1OutputStream$ImplicitOutputStream
  extends ASN1OutputStream
{
  private boolean first = true;
  
  public ASN1OutputStream$ImplicitOutputStream(ASN1OutputStream paramASN1OutputStream, OutputStream paramOutputStream)
  {
    super(paramOutputStream);
  }
  
  public void write(int paramInt)
    throws IOException
  {
    if (first) {
      first = false;
    } else {
      super.write(paramInt);
    }
  }
}

/* Location:
 * Qualified Name:     org.bouncycastle.asn1.ASN1OutputStream.ImplicitOutputStream
 * 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
{
  private OutputStream os;
  
  public ASN1OutputStream(OutputStream paramOutputStream)
  {
    os = paramOutputStream;
  }
  
  void writeLength(int paramInt)
    throws IOException
  {
    if (paramInt > 127)
    {
      int i = 1;
      int j = paramInt;
      while (j >>>= 8 != 0) {
        i++;
      }
      write((byte)(i | 0x80));
      for (int k = (i - 1) * 8; k >= 0; k -= 8) {
        write((byte)(paramInt >> k));
      }
    }
    else
    {
      write((byte)paramInt);
    }
  }
  
  void write(int paramInt)
    throws IOException
  {
    os.write(paramInt);
  }
  
  void write(byte[] paramArrayOfByte)
    throws IOException
  {
    os.write(paramArrayOfByte);
  }
  
  void write(byte[] paramArrayOfByte, int paramInt1, int paramInt2)
    throws IOException
  {
    os.write(paramArrayOfByte, paramInt1, paramInt2);
  }
  
  void writeEncoded(int paramInt, byte[] paramArrayOfByte)
    throws IOException
  {
    write(paramInt);
    writeLength(paramArrayOfByte.length);
    write(paramArrayOfByte);
  }
  
  void writeTag(int paramInt1, int paramInt2)
    throws IOException
  {
    if (paramInt2 < 31)
    {
      write(paramInt1 | paramInt2);
    }
    else
    {
      write(paramInt1 | 0x1F);
      if (paramInt2 < 128)
      {
        write(paramInt2);
      }
      else
      {
        byte[] arrayOfByte = new byte[5];
        int i = arrayOfByte.length;
        arrayOfByte[(--i)] = ((byte)(paramInt2 & 0x7F));
        do
        {
          paramInt2 >>= 7;
          arrayOfByte[(--i)] = ((byte)(paramInt2 & 0x7F | 0x80));
        } while (paramInt2 > 127);
        write(arrayOfByte, i, arrayOfByte.length - i);
      }
    }
  }
  
  void writeEncoded(int paramInt1, int paramInt2, byte[] paramArrayOfByte)
    throws IOException
  {
    writeTag(paramInt1, paramInt2);
    writeLength(paramArrayOfByte.length);
    write(paramArrayOfByte);
  }
  
  protected void writeNull()
    throws IOException
  {
    os.write(5);
    os.write(0);
  }
  
  public void writeObject(ASN1Encodable paramASN1Encodable)
    throws IOException
  {
    if (paramASN1Encodable != null) {
      paramASN1Encodable.toASN1Primitive().encode(this);
    } else {
      throw new IOException("null object detected");
    }
  }
  
  void writeImplicitObject(ASN1Primitive paramASN1Primitive)
    throws IOException
  {
    if (paramASN1Primitive != null) {
      paramASN1Primitive.encode(new ImplicitOutputStream(os));
    } else {
      throw new IOException("null object detected");
    }
  }
  
  public void close()
    throws IOException
  {
    os.close();
  }
  
  public void flush()
    throws IOException
  {
    os.flush();
  }
  
  ASN1OutputStream getDERSubStream()
  {
    return new DEROutputStream(os);
  }
  
  ASN1OutputStream getDLSubStream()
  {
    return new DLOutputStream(os);
  }
  
  private class ImplicitOutputStream
    extends ASN1OutputStream
  {
    private boolean first = true;
    
    public ImplicitOutputStream(OutputStream paramOutputStream)
    {
      super();
    }
    
    public void write(int paramInt)
      throws IOException
    {
      if (first) {
        first = false;
      } else {
        super.write(paramInt);
      }
    }
  }
}

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

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

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

import java.io.IOException;

public abstract class ASN1Primitive
  extends ASN1Object
{
  public static ASN1Primitive fromByteArray(byte[] paramArrayOfByte)
    throws IOException
  {
    ASN1InputStream localASN1InputStream = new ASN1InputStream(paramArrayOfByte);
    try
    {
      return localASN1InputStream.readObject();
    }
    catch (ClassCastException localClassCastException)
    {
      throw new IOException("cannot recognise object in stream");
    }
  }
  
  public final boolean equals(Object paramObject)
  {
    if (this == paramObject) {
      return true;
    }
    return ((paramObject instanceof ASN1Encodable)) && (asn1Equals(((ASN1Encodable)paramObject).toASN1Primitive()));
  }
  
  public ASN1Primitive toASN1Primitive()
  {
    return this;
  }
  
  ASN1Primitive toDERObject()
  {
    return this;
  }
  
  ASN1Primitive toDLObject()
  {
    return this;
  }
  
  public abstract int hashCode();
  
  abstract boolean isConstructed();
  
  abstract int encodedLength()
    throws IOException;
  
  abstract void encode(ASN1OutputStream paramASN1OutputStream)
    throws IOException;
  
  abstract boolean asn1Equals(ASN1Primitive paramASN1Primitive);
}

/* Location:
 * Qualified Name:     org.bouncycastle.asn1.ASN1Primitive
 * 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 ASN1Encodable readObject()
    throws IOException
  {
    if (index == max) {
      return null;
    }
    ASN1Encodable localASN1Encodable = this$0.getObjectAt(index++);
    if ((localASN1Encodable instanceof ASN1Sequence)) {
      return ((ASN1Sequence)localASN1Encodable).parser();
    }
    if ((localASN1Encodable instanceof ASN1Set)) {
      return ((ASN1Set)localASN1Encodable).parser();
    }
    return localASN1Encodable;
  }
  
  public ASN1Primitive getLoadedObject()
  {
    return val$outer;
  }
  
  public ASN1Primitive toASN1Primitive()
  {
    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 ASN1Primitive
{
  protected Vector seq = new Vector();
  
  public static ASN1Sequence getInstance(Object paramObject)
  {
    if ((paramObject == null) || ((paramObject instanceof ASN1Sequence))) {
      return (ASN1Sequence)paramObject;
    }
    if ((paramObject instanceof ASN1SequenceParser)) {
      return getInstance(((ASN1SequenceParser)paramObject).toASN1Primitive());
    }
    if ((paramObject instanceof byte[])) {
      try
      {
        return getInstance(fromByteArray((byte[])paramObject));
      }
      catch (IOException localIOException)
      {
        throw new IllegalArgumentException("failed to construct sequence from byte[]: " + localIOException.getMessage());
      }
    }
    if ((paramObject instanceof ASN1Encodable))
    {
      ASN1Primitive localASN1Primitive = ((ASN1Encodable)paramObject).toASN1Primitive();
      if ((localASN1Primitive instanceof ASN1Sequence)) {
        return (ASN1Sequence)localASN1Primitive;
      }
    }
    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 getInstance(paramASN1TaggedObject.getObject().toASN1Primitive());
    }
    if (paramASN1TaggedObject.isExplicit())
    {
      if ((paramASN1TaggedObject instanceof BERTaggedObject)) {
        return new BERSequence(paramASN1TaggedObject.getObject());
      }
      return new DLSequence(paramASN1TaggedObject.getObject());
    }
    if ((paramASN1TaggedObject.getObject() instanceof ASN1Sequence)) {
      return (ASN1Sequence)paramASN1TaggedObject.getObject();
    }
    throw new IllegalArgumentException("unknown object in getInstance: " + paramASN1TaggedObject.getClass().getName());
  }
  
  protected ASN1Sequence() {}
  
  protected ASN1Sequence(ASN1Encodable paramASN1Encodable)
  {
    seq.addElement(paramASN1Encodable);
  }
  
  protected ASN1Sequence(ASN1EncodableVector paramASN1EncodableVector)
  {
    for (int i = 0; i != paramASN1EncodableVector.size(); i++) {
      seq.addElement(paramASN1EncodableVector.get(i));
    }
  }
  
  protected ASN1Sequence(ASN1Encodable[] paramArrayOfASN1Encodable)
  {
    for (int i = 0; i != paramArrayOfASN1Encodable.length; i++) {
      seq.addElement(paramArrayOfASN1Encodable[i]);
    }
  }
  
  public ASN1Encodable[] toArray()
  {
    ASN1Encodable[] arrayOfASN1Encodable = new ASN1Encodable[size()];
    for (int i = 0; i != size(); i++) {
      arrayOfASN1Encodable[i] = getObjectAt(i);
    }
    return arrayOfASN1Encodable;
  }
  
  public Enumeration getObjects()
  {
    return seq.elements();
  }
  
  public ASN1SequenceParser parser()
  {
    final ASN1Sequence localASN1Sequence = this;
    new ASN1SequenceParser()
    {
      private final int max = size();
      private int index;
      
      public ASN1Encodable readObject()
        throws IOException
      {
        if (index == max) {
          return null;
        }
        ASN1Encodable localASN1Encodable = getObjectAt(index++);
        if ((localASN1Encodable instanceof ASN1Sequence)) {
          return ((ASN1Sequence)localASN1Encodable).parser();
        }
        if ((localASN1Encodable instanceof ASN1Set)) {
          return ((ASN1Set)localASN1Encodable).parser();
        }
        return localASN1Encodable;
      }
      
      public ASN1Primitive getLoadedObject()
      {
        return localASN1Sequence;
      }
      
      public ASN1Primitive toASN1Primitive()
      {
        return localASN1Sequence;
      }
    };
  }
  
  public ASN1Encodable getObjectAt(int paramInt)
  {
    return (ASN1Encodable)seq.elementAt(paramInt);
  }
  
  public int size()
  {
    return seq.size();
  }
  
  public int hashCode()
  {
    Enumeration localEnumeration = getObjects();
    int i = size();
    while (localEnumeration.hasMoreElements())
    {
      ASN1Encodable localASN1Encodable = getNext(localEnumeration);
      i *= 17;
      i ^= localASN1Encodable.hashCode();
    }
    return i;
  }
  
  boolean asn1Equals(ASN1Primitive paramASN1Primitive)
  {
    if (!(paramASN1Primitive instanceof ASN1Sequence)) {
      return false;
    }
    ASN1Sequence localASN1Sequence = (ASN1Sequence)paramASN1Primitive;
    if (size() != localASN1Sequence.size()) {
      return false;
    }
    Enumeration localEnumeration1 = getObjects();
    Enumeration localEnumeration2 = localASN1Sequence.getObjects();
    while (localEnumeration1.hasMoreElements())
    {
      ASN1Encodable localASN1Encodable1 = getNext(localEnumeration1);
      ASN1Encodable localASN1Encodable2 = getNext(localEnumeration2);
      ASN1Primitive localASN1Primitive1 = localASN1Encodable1.toASN1Primitive();
      ASN1Primitive localASN1Primitive2 = localASN1Encodable2.toASN1Primitive();
      if ((localASN1Primitive1 != localASN1Primitive2) && (!localASN1Primitive1.equals(localASN1Primitive2))) {
        return false;
      }
    }
    return true;
  }
  
  private ASN1Encodable getNext(Enumeration paramEnumeration)
  {
    ASN1Encodable localASN1Encodable = (ASN1Encodable)paramEnumeration.nextElement();
    return localASN1Encodable;
  }
  
  ASN1Primitive toDERObject()
  {
    DERSequence localDERSequence = new DERSequence();
    seq = seq;
    return localDERSequence;
  }
  
  ASN1Primitive toDLObject()
  {
    DLSequence localDLSequence = new DLSequence();
    seq = seq;
    return localDLSequence;
  }
  
  boolean isConstructed()
  {
    return true;
  }
  
  abstract void encode(ASN1OutputStream paramASN1OutputStream)
    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 ASN1Encodable, InMemoryRepresentable
{
  public abstract ASN1Encodable 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 ASN1Encodable readObject()
    throws IOException
  {
    if (index == max) {
      return null;
    }
    ASN1Encodable localASN1Encodable = this$0.getObjectAt(index++);
    if ((localASN1Encodable instanceof ASN1Sequence)) {
      return ((ASN1Sequence)localASN1Encodable).parser();
    }
    if ((localASN1Encodable instanceof ASN1Set)) {
      return ((ASN1Set)localASN1Encodable).parser();
    }
    return localASN1Encodable;
  }
  
  public ASN1Primitive getLoadedObject()
  {
    return val$outer;
  }
  
  public ASN1Primitive toASN1Primitive()
  {
    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 ASN1Primitive
{
  private Vector set = new Vector();
  private boolean isSorted = false;
  
  public static ASN1Set getInstance(Object paramObject)
  {
    if ((paramObject == null) || ((paramObject instanceof ASN1Set))) {
      return (ASN1Set)paramObject;
    }
    if ((paramObject instanceof ASN1SetParser)) {
      return getInstance(((ASN1SetParser)paramObject).toASN1Primitive());
    }
    if ((paramObject instanceof byte[])) {
      try
      {
        return getInsta
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 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125

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