diff options
author | David Hook <dgh@cryptoworkshop.com> | 2014-03-21 06:25:24 +0400 |
---|---|---|
committer | David Hook <dgh@cryptoworkshop.com> | 2014-03-21 06:25:24 +0400 |
commit | c36089c37a0656df8b63ceebf5d52161238694d7 (patch) | |
tree | 36151679085d4108697a357b2d9838cd7a58e6f8 | |
parent | 9407ff16b8cf860d59e4493af60b43996d13703c (diff) |
refactoring of ASN1 primitive classes.
147 files changed, 1081 insertions, 1126 deletions
diff --git a/core/src/main/java/org/bouncycastle/asn1/ASN1Enumerated.java b/core/src/main/java/org/bouncycastle/asn1/ASN1Enumerated.java index d93fd912..09a518f6 100644 --- a/core/src/main/java/org/bouncycastle/asn1/ASN1Enumerated.java +++ b/core/src/main/java/org/bouncycastle/asn1/ASN1Enumerated.java @@ -1,22 +1,162 @@ package org.bouncycastle.asn1; +import java.io.IOException; import java.math.BigInteger; +import org.bouncycastle.util.Arrays; + public class ASN1Enumerated - extends DEREnumerated + extends ASN1Primitive { - ASN1Enumerated(byte[] bytes) + byte[] bytes; + + /** + * return an integer from the passed in object + * + * @exception IllegalArgumentException if the object cannot be converted. + */ + public static ASN1Enumerated getInstance( + Object obj) + { + if (obj == null || obj instanceof ASN1Enumerated) + { + return (ASN1Enumerated)obj; + } + + if (obj instanceof byte[]) + { + try + { + return (ASN1Enumerated)fromByteArray((byte[])obj); + } + catch (Exception e) + { + throw new IllegalArgumentException("encoding error in getInstance: " + e.toString()); + } + } + + throw new IllegalArgumentException("illegal object in getInstance: " + obj.getClass().getName()); + } + + /** + * return an Enumerated from a tagged object. + * + * @param obj the tagged object holding the object we want + * @param explicit true if the object is meant to be explicitly + * tagged false otherwise. + * @exception IllegalArgumentException if the tagged object cannot + * be converted. + */ + public static ASN1Enumerated getInstance( + ASN1TaggedObject obj, + boolean explicit) + { + ASN1Primitive o = obj.getObject(); + + if (explicit || o instanceof ASN1Enumerated) + { + return getInstance(o); + } + else + { + return fromOctetString(((ASN1OctetString)o).getOctets()); + } + } + + /** + * @deprecated use ASN1Enumerated + */ + public ASN1Enumerated( + int value) + { + bytes = BigInteger.valueOf(value).toByteArray(); + } + + /** + * @deprecated use ASN1Enumerated + */ + public ASN1Enumerated( + BigInteger value) + { + bytes = value.toByteArray(); + } + + /** + * @deprecated use ASN1Enumerated + */ + public ASN1Enumerated( + byte[] bytes) + { + this.bytes = bytes; + } + + public BigInteger getValue() { - super(bytes); + return new BigInteger(bytes); } - public ASN1Enumerated(BigInteger value) + boolean isConstructed() { - super(value); + return false; } - public ASN1Enumerated(int value) + int encodedLength() { - super(value); + return 1 + StreamUtil.calculateBodyLength(bytes.length) + bytes.length; + } + + void encode( + ASN1OutputStream out) + throws IOException + { + out.writeEncoded(BERTags.ENUMERATED, bytes); + } + + boolean asn1Equals( + ASN1Primitive o) + { + if (!(o instanceof ASN1Enumerated)) + { + return false; + } + + ASN1Enumerated other = (ASN1Enumerated)o; + + return Arrays.areEqual(this.bytes, other.bytes); + } + + public int hashCode() + { + return Arrays.hashCode(bytes); + } + + private static ASN1Enumerated[] cache = new ASN1Enumerated[12]; + + static ASN1Enumerated fromOctetString(byte[] enc) + { + if (enc.length > 1) + { + return new ASN1Enumerated(Arrays.clone(enc)); + } + + if (enc.length == 0) + { + throw new IllegalArgumentException("ENUMERATED has zero length"); + } + int value = enc[0] & 0xff; + + if (value >= cache.length) + { + return new ASN1Enumerated(Arrays.clone(enc)); + } + + ASN1Enumerated possibleMatch = cache[value]; + + if (possibleMatch == null) + { + possibleMatch = cache[value] = new ASN1Enumerated(Arrays.clone(enc)); + } + + return possibleMatch; } } diff --git a/core/src/main/java/org/bouncycastle/asn1/ASN1Integer.java b/core/src/main/java/org/bouncycastle/asn1/ASN1Integer.java index 18e89c6d..b951e745 100644 --- a/core/src/main/java/org/bouncycastle/asn1/ASN1Integer.java +++ b/core/src/main/java/org/bouncycastle/asn1/ASN1Integer.java @@ -1,34 +1,150 @@ package org.bouncycastle.asn1; +import java.io.IOException; import java.math.BigInteger; import org.bouncycastle.util.Arrays; public class ASN1Integer - extends DERInteger + extends ASN1Primitive { - ASN1Integer(byte[] bytes, boolean clone) + byte[] bytes; + + /** + * return an integer from the passed in object + * + * @throws IllegalArgumentException if the object cannot be converted. + */ + public static ASN1Integer getInstance( + Object obj) { - super(clone ? Arrays.clone(bytes) : bytes); + if (obj == null || obj instanceof ASN1Integer) + { + return (ASN1Integer)obj; + } + + if (obj instanceof byte[]) + { + try + { + return (ASN1Integer)fromByteArray((byte[])obj); + } + catch (Exception e) + { + throw new IllegalArgumentException("encoding error in getInstance: " + e.toString()); + } + } + + throw new IllegalArgumentException("illegal object in getInstance: " + obj.getClass().getName()); } /** - * Constructor from a byte array containing a signed representation of the number. + * return an Integer from a tagged object. * - * @param bytes a byte array containing the signed number.A copy is made of the byte array. + * @param obj the tagged object holding the object we want + * @param explicit true if the object is meant to be explicitly + * tagged false otherwise. + * @throws IllegalArgumentException if the tagged object cannot + * be converted. */ - public ASN1Integer(byte[] bytes) + public static ASN1Integer getInstance( + ASN1TaggedObject obj, + boolean explicit) + { + ASN1Primitive o = obj.getObject(); + + if (explicit || o instanceof ASN1Integer) + { + return getInstance(o); + } + else + { + return new ASN1Integer(ASN1OctetString.getInstance(obj.getObject()).getOctets()); + } + } + + public ASN1Integer( + long value) + { + bytes = BigInteger.valueOf(value).toByteArray(); + } + + public ASN1Integer( + BigInteger value) + { + bytes = value.toByteArray(); + } + + public ASN1Integer( + byte[] bytes) { this(bytes, true); } - public ASN1Integer(BigInteger value) + ASN1Integer(byte[] bytes, boolean clone) + { + this.bytes = (clone) ? Arrays.clone(bytes) : bytes; + } + + public BigInteger getValue() + { + return new BigInteger(bytes); + } + + /** + * in some cases positive values get crammed into a space, + * that's not quite big enough... + */ + public BigInteger getPositiveValue() + { + return new BigInteger(1, bytes); + } + + boolean isConstructed() { - super(value); + return false; } - public ASN1Integer(long value) + int encodedLength() { - super(value); + return 1 + StreamUtil.calculateBodyLength(bytes.length) + bytes.length; } + + void encode( + ASN1OutputStream out) + throws IOException + { + out.writeEncoded(BERTags.INTEGER, bytes); + } + + public int hashCode() + { + int value = 0; + + for (int i = 0; i != bytes.length; i++) + { + value ^= (bytes[i] & 0xff) << (i % 4); + } + + return value; + } + + boolean asn1Equals( + ASN1Primitive o) + { + if (!(o instanceof ASN1Integer)) + { + return false; + } + + ASN1Integer other = (ASN1Integer)o; + + return Arrays.areEqual(bytes, other.bytes); + } + + public String toString() + { + return getValue().toString(); + } + } diff --git a/core/src/main/java/org/bouncycastle/asn1/DEREnumerated.java b/core/src/main/java/org/bouncycastle/asn1/DEREnumerated.java index 9b1ef55c..879a01ca 100644 --- a/core/src/main/java/org/bouncycastle/asn1/DEREnumerated.java +++ b/core/src/main/java/org/bouncycastle/asn1/DEREnumerated.java @@ -1,170 +1,25 @@ package org.bouncycastle.asn1; -import java.io.IOException; import java.math.BigInteger; -import org.bouncycastle.util.Arrays; - /** - * Use ASN1Enumerated instead of this. + * @deprecated Use ASN1Enumerated instead of this. */ public class DEREnumerated - extends ASN1Primitive + extends ASN1Enumerated { - byte[] bytes; - - /** - * return an integer from the passed in object - * - * @exception IllegalArgumentException if the object cannot be converted. - */ - public static ASN1Enumerated getInstance( - Object obj) - { - if (obj == null || obj instanceof ASN1Enumerated) - { - return (ASN1Enumerated)obj; - } - - if (obj instanceof DEREnumerated) - { - return new ASN1Enumerated(((DEREnumerated)obj).getValue()); - } - - if (obj instanceof byte[]) - { - try - { - return (ASN1Enumerated)fromByteArray((byte[])obj); - } - catch (Exception e) - { - throw new IllegalArgumentException("encoding error in getInstance: " + e.toString()); - } - } - - throw new IllegalArgumentException("illegal object in getInstance: " + obj.getClass().getName()); - } - - /** - * return an Enumerated from a tagged object. - * - * @param obj the tagged object holding the object we want - * @param explicit true if the object is meant to be explicitly - * tagged false otherwise. - * @exception IllegalArgumentException if the tagged object cannot - * be converted. - */ - public static ASN1Enumerated getInstance( - ASN1TaggedObject obj, - boolean explicit) - { - ASN1Primitive o = obj.getObject(); - - if (explicit || o instanceof DEREnumerated) - { - return getInstance(o); - } - else - { - return fromOctetString(((ASN1OctetString)o).getOctets()); - } - } - - /** - * @deprecated use ASN1Enumerated - */ - public DEREnumerated( - int value) - { - bytes = BigInteger.valueOf(value).toByteArray(); - } - - /** - * @deprecated use ASN1Enumerated - */ - public DEREnumerated( - BigInteger value) - { - bytes = value.toByteArray(); - } - - /** - * @deprecated use ASN1Enumerated - */ - public DEREnumerated( - byte[] bytes) - { - this.bytes = bytes; - } - - public BigInteger getValue() - { - return new BigInteger(bytes); - } - - boolean isConstructed() - { - return false; - } - - int encodedLength() - { - return 1 + StreamUtil.calculateBodyLength(bytes.length) + bytes.length; - } - - void encode( - ASN1OutputStream out) - throws IOException + DEREnumerated(byte[] bytes) { - out.writeEncoded(BERTags.ENUMERATED, bytes); + super(bytes); } - - boolean asn1Equals( - ASN1Primitive o) - { - if (!(o instanceof DEREnumerated)) - { - return false; - } - - DEREnumerated other = (DEREnumerated)o; - return Arrays.areEqual(this.bytes, other.bytes); - } - - public int hashCode() + public DEREnumerated(BigInteger value) { - return Arrays.hashCode(bytes); + super(value); } - private static ASN1Enumerated[] cache = new ASN1Enumerated[12]; - - static ASN1Enumerated fromOctetString(byte[] enc) + public DEREnumerated(int value) { - if (enc.length > 1) - { - return new ASN1Enumerated(Arrays.clone(enc)); - } - - if (enc.length == 0) - { - throw new IllegalArgumentException("ENUMERATED has zero length"); - } - int value = enc[0] & 0xff; - - if (value >= cache.length) - { - return new ASN1Enumerated(Arrays.clone(enc)); - } - - ASN1Enumerated possibleMatch = cache[value]; - - if (possibleMatch == null) - { - possibleMatch = cache[value] = new ASN1Enumerated(Arrays.clone(enc)); - } - - return possibleMatch; + super(value); } } diff --git a/core/src/main/java/org/bouncycastle/asn1/DERInteger.java b/core/src/main/java/org/bouncycastle/asn1/DERInteger.java index 57cc84a7..d2e850f3 100644 --- a/core/src/main/java/org/bouncycastle/asn1/DERInteger.java +++ b/core/src/main/java/org/bouncycastle/asn1/DERInteger.java @@ -1,160 +1,30 @@ package org.bouncycastle.asn1; -import java.io.IOException; import java.math.BigInteger; -import org.bouncycastle.util.Arrays; - /** - * Use ASN1Integer instead of this, + * @deprecated Use ASN1Integer instead of this, */ public class DERInteger - extends ASN1Primitive + extends ASN1Integer { - byte[] bytes; - - /** - * return an integer from the passed in object - * - * @exception IllegalArgumentException if the object cannot be converted. - */ - public static ASN1Integer getInstance( - Object obj) - { - if (obj == null || obj instanceof ASN1Integer) - { - return (ASN1Integer)obj; - } - if (obj instanceof DERInteger) - { - return new ASN1Integer((((DERInteger)obj).getValue())); - } - - if (obj instanceof byte[]) - { - try - { - return (ASN1Integer)fromByteArray((byte[])obj); - } - catch (Exception e) - { - throw new IllegalArgumentException("encoding error in getInstance: " + e.toString()); - } - } - - throw new IllegalArgumentException("illegal object in getInstance: " + obj.getClass().getName()); - } - /** - * return an Integer from a tagged object. + * Constructor from a byte array containing a signed representation of the number. * - * @param obj the tagged object holding the object we want - * @param explicit true if the object is meant to be explicitly - * tagged false otherwise. - * @exception IllegalArgumentException if the tagged object cannot - * be converted. - */ - public static ASN1Integer getInstance( - ASN1TaggedObject obj, - boolean explicit) - { - ASN1Primitive o = obj.getObject(); - - if (explicit || o instanceof DERInteger) - { - return getInstance(o); - } - else - { - return new ASN1Integer(ASN1OctetString.getInstance(obj.getObject()).getOctets()); - } - } - - /** - * @deprecated use ASN1Integer constructor - */ - public DERInteger( - long value) - { - bytes = BigInteger.valueOf(value).toByteArray(); - } - - /** - * @deprecated use ASN1Integer constructor + * @param bytes a byte array containing the signed number.A copy is made of the byte array. */ - public DERInteger( - BigInteger value) + public DERInteger(byte[] bytes) { - bytes = value.toByteArray(); + super(bytes, true); } - /** - * @deprecated use ASN1Integer constructor - */ - public DERInteger( - byte[] bytes) + public DERInteger(BigInteger value) { - this.bytes = bytes; - } - - public BigInteger getValue() - { - return new BigInteger(bytes); - } - - /** - * in some cases positive values get crammed into a space, - * that's not quite big enough... - */ - public BigInteger getPositiveValue() - { - return new BigInteger(1, bytes); - } - - boolean isConstructed() - { - return false; - } - - int encodedLength() - { - return 1 + StreamUtil.calculateBodyLength(bytes.length) + bytes.length; - } - - void encode( - ASN1OutputStream out) - throws IOException - { - out.writeEncoded(BERTags.INTEGER, bytes); - } - - public int hashCode() - { - int value = 0; - - for (int i = 0; i != bytes.length; i++) - { - value ^= (bytes[i] & 0xff) << (i % 4); - } - - return value; - } - - boolean asn1Equals( - ASN1Primitive o) - { - if (!(o instanceof DERInteger)) - { - return false; - } - - DERInteger other = (DERInteger)o; - - return Arrays.areEqual(bytes, other.bytes); + super(value); } - public String toString() + public DERInteger(long value) { - return getValue().toString(); + super(value); } } diff --git a/core/src/main/java/org/bouncycastle/asn1/cms/Attribute.java b/core/src/main/java/org/bouncycastle/asn1/cms/Attribute.java index 066cf693..8c487433 100644 --- a/core/src/main/java/org/bouncycastle/asn1/cms/Attribute.java +++ b/core/src/main/java/org/bouncycastle/asn1/cms/Attribute.java @@ -7,7 +7,6 @@ import org.bouncycastle.asn1.ASN1ObjectIdentifier; import org.bouncycastle.asn1.ASN1Primitive; import org.bouncycastle.asn1.ASN1Sequence; import org.bouncycastle.asn1.ASN1Set; -import org.bouncycastle.asn1.DERObjectIdentifier; import org.bouncycastle.asn1.DERSequence; /** @@ -73,17 +72,6 @@ public class Attribute attrValues = (ASN1Set)seq.getObjectAt(1); } - /** - * @deprecated use ASN1ObjectIdentifier - */ - public Attribute( - DERObjectIdentifier attrType, - ASN1Set attrValues) - { - this.attrType = new ASN1ObjectIdentifier(attrType.getId()); - this.attrValues = attrValues; - } - public Attribute( ASN1ObjectIdentifier attrType, ASN1Set attrValues) diff --git a/core/src/main/java/org/bouncycastle/asn1/cms/AttributeTable.java b/core/src/main/java/org/bouncycastle/asn1/cms/AttributeTable.java index 02b6cc1e..3b8e0bed 100644 --- a/core/src/main/java/org/bouncycastle/asn1/cms/AttributeTable.java +++ b/core/src/main/java/org/bouncycastle/asn1/cms/AttributeTable.java @@ -8,7 +8,6 @@ import org.bouncycastle.asn1.ASN1Encodable; import org.bouncycastle.asn1.ASN1EncodableVector; import org.bouncycastle.asn1.ASN1ObjectIdentifier; import org.bouncycastle.asn1.ASN1Set; -import org.bouncycastle.asn1.DERObjectIdentifier; import org.bouncycastle.asn1.DERSet; /** @@ -91,14 +90,6 @@ public class AttributeTable } /** - * @deprecated use ASN1ObjectIdentifier - */ - public Attribute get(DERObjectIdentifier oid) - { - return get(new ASN1ObjectIdentifier(oid.getId())); - } - - /** * Return the first attribute matching the OBJECT IDENTIFIER oid. * * @param oid type of attribute required. @@ -117,14 +108,6 @@ public class AttributeTable return (Attribute)value; } - /** - * @deprecated use ASN1ObjectIdentifier - */ - public ASN1EncodableVector getAll(DERObjectIdentifier oid) - { - return getAll(new ASN1ObjectIdentifier(oid.getId())); - } - /** * Return all the attributes matching the OBJECT IDENTIFIER oid. The vector will be * empty if there are no attributes of the required type present. diff --git a/core/src/main/java/org/bouncycastle/asn1/ess/ContentHints.java b/core/src/main/java/org/bouncycastle/asn1/ess/ContentHints.java index 93d9d0c8..462d9685 100644 --- a/core/src/main/java/org/bouncycastle/asn1/ess/ContentHints.java +++ b/core/src/main/java/org/bouncycastle/asn1/ess/ContentHints.java @@ -6,7 +6,6 @@ import org.bouncycastle.asn1.ASN1Object; import org.bouncycastle.asn1.ASN1ObjectIdentifier; import org.bouncycastle.asn1.ASN1Primitive; import org.bouncycastle.asn1.ASN1Sequence; -import org.bouncycastle.asn1.DERObjectIdentifier; import org.bouncycastle.asn1.DERSequence; import org.bouncycastle.asn1.DERUTF8String; @@ -47,25 +46,6 @@ public class ContentHints } } - /** - * @deprecated use ASN1ObjectIdentifier - */ - public ContentHints( - DERObjectIdentifier contentType) - { - this(new ASN1ObjectIdentifier(contentType.getId())); - } - - /** - * @deprecated use ASN1ObjectIdentifier - */ - public ContentHints( - DERObjectIdentifier contentType, - DERUTF8String contentDescription) - { - this(new ASN1ObjectIdentifier(contentType.getId()), contentDescription); - } - public ContentHints( ASN1ObjectIdentifier contentType) { diff --git a/core/src/main/java/org/bouncycastle/asn1/isismtt/x509/NamingAuthority.java b/core/src/main/java/org/bouncycastle/asn1/isismtt/x509/NamingAuthority.java index 237f5e55..ca472e67 100644 --- a/core/src/main/java/org/bouncycastle/asn1/isismtt/x509/NamingAuthority.java +++ b/core/src/main/java/org/bouncycastle/asn1/isismtt/x509/NamingAuthority.java @@ -11,7 +11,6 @@ import org.bouncycastle.asn1.ASN1Sequence; import org.bouncycastle.asn1.ASN1String; import org.bouncycastle.asn1.ASN1TaggedObject; import org.bouncycastle.asn1.DERIA5String; -import org.bouncycastle.asn1.DERObjectIdentifier; import org.bouncycastle.asn1.DERSequence; import org.bouncycastle.asn1.isismtt.ISISMTTObjectIdentifiers; import org.bouncycastle.asn1.x500.DirectoryString; @@ -173,24 +172,6 @@ public class NamingAuthority return namingAuthorityUrl; } - /** - * Constructor from given details. - * <p/> - * All parameters can be combined. - * - * @param namingAuthorityId ObjectIdentifier for naming authority. - * @param namingAuthorityUrl URL for naming authority. - * @param namingAuthorityText Textual representation of naming authority. - * @deprecated use ASN1ObjectIdentifier method - */ - public NamingAuthority(DERObjectIdentifier namingAuthorityId, - String namingAuthorityUrl, DirectoryString namingAuthorityText) - { - this.namingAuthorityId = new ASN1ObjectIdentifier(namingAuthorityId.getId()); - this.namingAuthorityUrl = namingAuthorityUrl; - this.namingAuthorityText = namingAuthorityText; - } - /** * Constructor from given details. * <p/> diff --git a/core/src/main/java/org/bouncycastle/asn1/oiw/ElGamalParameter.java b/core/src/main/java/org/bouncycastle/asn1/oiw/ElGamalParameter.java index c6a2965b..d654d032 100644 --- a/core/src/main/java/org/bouncycastle/asn1/oiw/ElGamalParameter.java +++ b/core/src/main/java/org/bouncycastle/asn1/oiw/ElGamalParameter.java @@ -23,7 +23,7 @@ public class ElGamalParameter this.g = new ASN1Integer(g); } - public ElGamalParameter( + private ElGamalParameter( ASN1Sequence seq) { Enumeration e = seq.getObjects(); @@ -32,6 +32,20 @@ public class ElGamalParameter g = (ASN1Integer)e.nextElement(); } + public static ElGamalParameter getInstance(Object o) + { + if (o instanceof ElGamalParameter) + { + return (ElGamalParameter)o; + } + else if (o != null) + { + return new ElGamalParameter(ASN1Sequence.getInstance(o)); + } + + return null; + } + public BigInteger getP() { return p.getPositiveValue(); diff --git a/core/src/main/java/org/bouncycastle/asn1/util/ASN1Dump.java b/core/src/main/java/org/bouncycastle/asn1/util/ASN1Dump.java index 4560f647..8221e182 100644 --- a/core/src/main/java/org/bouncycastle/asn1/util/ASN1Dump.java +++ b/core/src/main/java/org/bouncycastle/asn1/util/ASN1Dump.java @@ -3,7 +3,9 @@ package org.bouncycastle.asn1.util; import java.io.IOException; import java.util.Enumeration; +import org.bouncycastle.asn1.ASN1Boolean; import org.bouncycastle.asn1.ASN1Encodable; +import org.bouncycastle.asn1.ASN1Enumerated; import org.bouncycastle.asn1.ASN1Integer; import org.bouncycastle.asn1.ASN1ObjectIdentifier; import org.bouncycastle.asn1.ASN1OctetString; @@ -12,7 +14,6 @@ import org.bouncycastle.asn1.ASN1Sequence; import org.bouncycastle.asn1.ASN1Set; import org.bouncycastle.asn1.ASN1TaggedObject; import org.bouncycastle.asn1.BERApplicationSpecific; -import org.bouncycastle.asn1.BERConstructedOctetString; import org.bouncycastle.asn1.BEROctetString; import org.bouncycastle.asn1.BERSequence; import org.bouncycastle.asn1.BERSet; @@ -21,8 +22,6 @@ import org.bouncycastle.asn1.BERTags; import org.bouncycastle.asn1.DERApplicationSpecific; import org.bouncycastle.asn1.DERBMPString; import org.bouncycastle.asn1.DERBitString; -import org.bouncycastle.asn1.DERBoolean; -import org.bouncycastle.asn1.DEREnumerated; import org.bouncycastle.asn1.DERExternal; import org.bouncycastle.asn1.DERGeneralizedTime; import org.bouncycastle.asn1.DERIA5String; @@ -193,9 +192,9 @@ public class ASN1Dump { buf.append(indent + "ObjectIdentifier(" + ((ASN1ObjectIdentifier)obj).getId() + ")" + nl); } - else if (obj instanceof DERBoolean) + else if (obj instanceof ASN1Boolean) { - buf.append(indent + "Boolean(" + ((DERBoolean)obj).isTrue() + ")" + nl); + buf.append(indent + "Boolean(" + ((ASN1Boolean)obj).isTrue() + ")" + nl); } else if (obj instanceof ASN1Integer) { @@ -254,9 +253,9 @@ public class ASN1Dump { buf.append(outputApplicationSpecific("DER", indent, verbose, obj, nl)); } - else if (obj instanceof DEREnumerated) + else if (obj instanceof ASN1Enumerated) { - DEREnumerated en = (DEREnumerated) obj; + ASN1Enumerated en = (ASN1Enumerated) obj; buf.append(indent + "DER Enumerated(" + en.getValue() + ")" + nl); } else if (obj instanceof DERExternal) diff --git a/core/src/main/java/org/bouncycastle/asn1/x509/AlgorithmIdentifier.java b/core/src/main/java/org/bouncycastle/asn1/x509/AlgorithmIdentifier.java index d250bf1e..bb90030c 100644 --- a/core/src/main/java/org/bouncycastle/asn1/x509/AlgorithmIdentifier.java +++ b/core/src/main/java/org/bouncycastle/asn1/x509/AlgorithmIdentifier.java @@ -8,7 +8,6 @@ import org.bouncycastle.asn1.ASN1Primitive; import org.bouncycastle.asn1.ASN1Sequence; import org.bouncycastle.asn1.ASN1TaggedObject; import org.bouncycastle.asn1.DERNull; -import org.bouncycastle.asn1.DERObjectIdentifier; import org.bouncycastle.asn1.DERSequence; public class AlgorithmIdentifier @@ -64,30 +63,6 @@ public class AlgorithmIdentifier this.objectId = new ASN1ObjectIdentifier(objectId); } - /** - * @deprecated use ASN1ObjectIdentifier - * @param objectId - */ - public AlgorithmIdentifier( - DERObjectIdentifier objectId) - { - this.objectId = new ASN1ObjectIdentifier(objectId.getId()); - } - - /** - * @deprecated use ASN1ObjectIdentifier - * @param objectId - * @param parameters - */ - public AlgorithmIdentifier( - DERObjectIdentifier objectId, - ASN1Encodable parameters) - { - parametersDefined = true; - this.objectId = new ASN1ObjectIdentifier(objectId.getId()); - this.parameters = parameters; - } - public AlgorithmIdentifier( ASN1ObjectIdentifier objectId, ASN1Encodable parameters) diff --git a/core/src/main/java/org/bouncycastle/asn1/x509/BasicConstraints.java b/core/src/main/java/org/bouncycastle/asn1/x509/BasicConstraints.java index 4a16bd4b..ba5ecf1f 100644 --- a/core/src/main/java/org/bouncycastle/asn1/x509/BasicConstraints.java +++ b/core/src/main/java/org/bouncycastle/asn1/x509/BasicConstraints.java @@ -9,7 +9,6 @@ import org.bouncycastle.asn1.ASN1Object; import org.bouncycastle.asn1.ASN1Primitive; import org.bouncycastle.asn1.ASN1Sequence; import org.bouncycastle.asn1.ASN1TaggedObject; -import org.bouncycastle.asn1.DERBoolean; import org.bouncycastle.asn1.DERSequence; public class BasicConstraints @@ -59,9 +58,9 @@ public class BasicConstraints } else { - if (seq.getObjectAt(0) instanceof DERBoolean) + if (seq.getObjectAt(0) instanceof ASN1Boolean) { - this.cA = DERBoolean.getInstance(seq.getObjectAt(0)); + this.cA = ASN1Boolean.getInstance(seq.getObjectAt(0)); } else { diff --git a/core/src/main/java/org/bouncycastle/asn1/x509/X509Extension.java b/core/src/main/java/org/bouncycastle/asn1/x509/X509Extension.java index f29284d5..93530571 100644 --- a/core/src/main/java/org/bouncycastle/asn1/x509/X509Extension.java +++ b/core/src/main/java/org/bouncycastle/asn1/x509/X509Extension.java @@ -2,11 +2,11 @@ package org.bouncycastle.asn1.x509; import java.io.IOException; +import org.bouncycastle.asn1.ASN1Boolean; import org.bouncycastle.asn1.ASN1Encodable; import org.bouncycastle.asn1.ASN1ObjectIdentifier; import org.bouncycastle.asn1.ASN1OctetString; import org.bouncycastle.asn1.ASN1Primitive; -import org.bouncycastle.asn1.DERBoolean; /** * an object for the elements in the X.509 V3 extension block. @@ -173,7 +173,7 @@ public class X509Extension ASN1OctetString value; public X509Extension( - DERBoolean critical, + ASN1Boolean critical, ASN1OctetString value) { this.critical = critical.isTrue(); diff --git a/core/src/main/java/org/bouncycastle/asn1/x509/X509Extensions.java b/core/src/main/java/org/bouncycastle/asn1/x509/X509Extensions.java index c72e3cc0..5b9ea9e1 100644 --- a/core/src/main/java/org/bouncycastle/asn1/x509/X509Extensions.java +++ b/core/src/main/java/org/bouncycastle/asn1/x509/X509Extensions.java @@ -4,6 +4,7 @@ import java.util.Enumeration; import java.util.Hashtable; import java.util.Vector; +import org.bouncycastle.asn1.ASN1Boolean; import org.bouncycastle.asn1.ASN1EncodableVector; import org.bouncycastle.asn1.ASN1Object; import org.bouncycastle.asn1.ASN1ObjectIdentifier; @@ -11,8 +12,6 @@ import org.bouncycastle.asn1.ASN1OctetString; import org.bouncycastle.asn1.ASN1Primitive; import org.bouncycastle.asn1.ASN1Sequence; import org.bouncycastle.asn1.ASN1TaggedObject; -import org.bouncycastle.asn1.DERBoolean; -import org.bouncycastle.asn1.DERObjectIdentifier; import org.bouncycastle.asn1.DERSequence; /** @@ -259,7 +258,7 @@ public class X509Extensions if (s.size() == 3) { - extensions.put(s.getObjectAt(0), new X509Extension(DERBoolean.getInstance(s.getObjectAt(1)), ASN1OctetString.getInstance(s.getObjectAt(2)))); + extensions.put(s.getObjectAt(0), new X509Extension(ASN1Boolean.getInstance(s.getObjectAt(1)), ASN1OctetString.getInstance(s.getObjectAt(2)))); } else if (s.size() == 2) { @@ -369,17 +368,6 @@ public class X509Extensions * @return the extension if it's present, null otherwise. */ public X509Extension getExtension( - DERObjectIdentifier oid) - { - return (X509Extension)extensions.get(oid); - } - - /** - * @deprecated - * @param oid - * @return - */ - public X509Extension getExtension( ASN1ObjectIdentifier oid) { return (X509Extension)extensions.get(oid); @@ -410,7 +398,7 @@ public class X509Extensions if (ext.isCritical()) { - v.add(DERBoolean.TRUE); + v.add(ASN1Boolean.TRUE); } v.add(ext.getValue()); diff --git a/core/src/main/java/org/bouncycastle/asn1/x509/X509ExtensionsGenerator.java b/core/src/main/java/org/bouncycastle/asn1/x509/X509ExtensionsGenerator.java index 468d1b96..589d512f 100644 --- a/core/src/main/java/org/bouncycastle/asn1/x509/X509ExtensionsGenerator.java +++ b/core/src/main/java/org/bouncycastle/asn1/x509/X509ExtensionsGenerator.java @@ -7,7 +7,6 @@ import java.util.Vector; import org.bouncycastle.asn1.ASN1Encodable; import org.bouncycastle.asn1.ASN1Encoding; import org.bouncycastle.asn1.ASN1ObjectIdentifier; -import org.bouncycastle.asn1.DERObjectIdentifier; import org.bouncycastle.asn1.DEROctetString; /** @@ -29,28 +28,6 @@ public class X509ExtensionsGenerator } /** - * @deprecated use ASN1ObjectIdentifier - */ - public void addExtension( - DERObjectIdentifier oid, - boolean critical, - ASN1Encodable value) - { - addExtension(new ASN1ObjectIdentifier(oid.getId()), critical, value); - } - - /** - * @deprecated use ASN1ObjectIdentifier - */ - public void addExtension( - DERObjectIdentifier oid, - boolean critical, - byte[] value) - { - addExtension(new ASN1ObjectIdentifier(oid.getId()), critical, value); - } - - /** * Add an extension with the given oid and the passed in value to be included * in the OCTET STRING associated with the extension. * diff --git a/core/src/main/java/org/bouncycastle/asn1/x9/DHDomainParameters.java b/core/src/main/java/org/bouncycastle/asn1/x9/DHDomainParameters.java index 6a97a48e..509111ad 100644 --- a/core/src/main/java/org/bouncycastle/asn1/x9/DHDomainParameters.java +++ b/core/src/main/java/org/bouncycastle/asn1/x9/DHDomainParameters.java @@ -1,5 +1,6 @@ package org.bouncycastle.asn1.x9; +import java.math.BigInteger; import java.util.Enumeration; import org.bouncycastle.asn1.ASN1Encodable; @@ -38,6 +39,29 @@ public class DHDomainParameters + obj.getClass().getName()); } + public DHDomainParameters(BigInteger p, BigInteger g, BigInteger q, BigInteger j, + DHValidationParms validationParms) + { + if (p == null) + { + throw new IllegalArgumentException("'p' cannot be null"); + } + if (g == null) + { + throw new IllegalArgumentException("'g' cannot be null"); + } + if (q == null) + { + throw new IllegalArgumentException("'q' cannot be null"); + } + + this.p = new ASN1Integer(p); + this.g = new ASN1Integer(g); + this.q = new ASN1Integer(q); + this.j = new ASN1Integer(j); + this.validationParms = validationParms; + } + public DHDomainParameters(ASN1Integer p, ASN1Integer g, ASN1Integer q, ASN1Integer j, DHValidationParms validationParms) { diff --git a/core/src/main/java/org/bouncycastle/crypto/agreement/kdf/DHKEKGenerator.java b/core/src/main/java/org/bouncycastle/crypto/agreement/kdf/DHKEKGenerator.java index 947bc5c4..55d8ba51 100644 --- a/core/src/main/java/org/bouncycastle/crypto/agreement/kdf/DHKEKGenerator.java +++ b/core/src/main/java/org/bouncycastle/crypto/agreement/kdf/DHKEKGenerator.java @@ -4,7 +4,7 @@ import java.io.IOException; import org.bouncycastle.asn1.ASN1EncodableVector; import org.bouncycastle.asn1.ASN1Encoding; -import org.bouncycastle.asn1.DERObjectIdentifier; +import org.bouncycastle.asn1.ASN1ObjectIdentifier; import org.bouncycastle.asn1.DEROctetString; import org.bouncycastle.asn1.DERSequence; import org.bouncycastle.asn1.DERTaggedObject; @@ -22,7 +22,7 @@ public class DHKEKGenerator { private final Digest digest; - private DERObjectIdentifier algorithm; + private ASN1ObjectIdentifier algorithm; private int keySize; private byte[] z; private byte[] partyAInfo; diff --git a/core/src/main/java/org/bouncycastle/crypto/signers/DSADigestSigner.java b/core/src/main/java/org/bouncycastle/crypto/signers/DSADigestSigner.java index 2e4c48d3..684eb9c0 100644 --- a/core/src/main/java/org/bouncycastle/crypto/signers/DSADigestSigner.java +++ b/core/src/main/java/org/bouncycastle/crypto/signers/DSADigestSigner.java @@ -5,9 +5,9 @@ import java.math.BigInteger; import org.bouncycastle.asn1.ASN1EncodableVector; import org.bouncycastle.asn1.ASN1Encoding; +import org.bouncycastle.asn1.ASN1Integer; import org.bouncycastle.asn1.ASN1Primitive; import org.bouncycastle.asn1.ASN1Sequence; -import org.bouncycastle.asn1.DERInteger; import org.bouncycastle.asn1.DERSequence; import org.bouncycastle.crypto.CipherParameters; import org.bouncycastle.crypto.DSA; @@ -142,8 +142,8 @@ public class DSADigestSigner throws IOException { ASN1EncodableVector v = new ASN1EncodableVector(); - v.add(new DERInteger(r)); - v.add(new DERInteger(s)); + v.add(new ASN1Integer(r)); + v.add(new ASN1Integer(s)); return new DERSequence(v).getEncoded(ASN1Encoding.DER); } @@ -156,8 +156,8 @@ public class DSADigestSigner return new BigInteger[] { - ((DERInteger)s.getObjectAt(0)).getValue(), - ((DERInteger)s.getObjectAt(1)).getValue() + ((ASN1Integer)s.getObjectAt(0)).getValue(), + ((ASN1Integer)s.getObjectAt(1)).getValue() }; } } diff --git a/core/src/main/java/org/bouncycastle/crypto/util/PrivateKeyFactory.java b/core/src/main/java/org/bouncycastle/crypto/util/PrivateKeyFactory.java index 9e342ff9..92684ecc 100644 --- a/core/src/main/java/org/bouncycastle/crypto/util/PrivateKeyFactory.java +++ b/core/src/main/java/org/bouncycastle/crypto/util/PrivateKeyFactory.java @@ -9,7 +9,6 @@ import org.bouncycastle.asn1.ASN1InputStream; import org.bouncycastle.asn1.ASN1Integer; import org.bouncycastle.asn1.ASN1ObjectIdentifier; import org.bouncycastle.asn1.ASN1Primitive; -import org.bouncycastle.asn1.ASN1Sequence; import org.bouncycastle.asn1.oiw.ElGamalParameter; import org.bouncycastle.asn1.oiw.OIWObjectIdentifiers; import org.bouncycastle.asn1.pkcs.DHParameter; @@ -101,7 +100,7 @@ public class PrivateKeyFactory } else if (algId.getAlgorithm().equals(OIWObjectIdentifiers.elGamalAlgorithm)) { - ElGamalParameter params = new ElGamalParameter((ASN1Sequence)algId.getParameters()); + ElGamalParameter params = ElGamalParameter.getInstance(algId.getParameters()); ASN1Integer derX = (ASN1Integer)keyInfo.parsePrivateKey(); return new ElGamalPrivateKeyParameters(derX.getValue(), new ElGamalParameters( diff --git a/core/src/main/java/org/bouncycastle/crypto/util/PublicKeyFactory.java b/core/src/main/java/org/bouncycastle/crypto/util/PublicKeyFactory.java index b52d9bc0..cb130954 100644 --- a/core/src/main/java/org/bouncycastle/crypto/util/PublicKeyFactory.java +++ b/core/src/main/java/org/bouncycastle/crypto/util/PublicKeyFactory.java @@ -10,7 +10,6 @@ import org.bouncycastle.asn1.ASN1Integer; import org.bouncycastle.asn1.ASN1ObjectIdentifier; import org.bouncycastle.asn1.ASN1OctetString; import org.bouncycastle.asn1.ASN1Primitive; -import org.bouncycastle.asn1.ASN1Sequence; import org.bouncycastle.asn1.DEROctetString; import org.bouncycastle.asn1.oiw.ElGamalParameter; import org.bouncycastle.asn1.oiw.OIWObjectIdentifiers; @@ -136,7 +135,7 @@ public class PublicKeyFactory } else if (algId.getAlgorithm().equals(OIWObjectIdentifiers.elGamalAlgorithm)) { - ElGamalParameter params = new ElGamalParameter((ASN1Sequence)algId.getParameters()); + ElGamalParameter params = ElGamalParameter.getInstance(algId.getParameters()); ASN1Integer derY = (ASN1Integer)keyInfo.parsePublicKey(); return new ElGamalPublicKeyParameters(derY.getValue(), new ElGamalParameters( diff --git a/core/src/main/jdk1.1/java/security/cert/X509CRLSelector.java b/core/src/main/jdk1.1/java/security/cert/X509CRLSelector.java index 8da7bbe6..5917765c 100644 --- a/core/src/main/jdk1.1/java/security/cert/X509CRLSelector.java +++ b/core/src/main/jdk1.1/java/security/cert/X509CRLSelector.java @@ -16,7 +16,7 @@ import org.bouncycastle.asn1.ASN1InputStream; import org.bouncycastle.asn1.ASN1Object; import org.bouncycastle.asn1.ASN1OctetString; import org.bouncycastle.asn1.ASN1Sequence; -import org.bouncycastle.asn1.DERInteger; +import org.bouncycastle.asn1.ASN1Integer; import org.bouncycastle.asn1.x509.X509Extensions; import org.bouncycastle.asn1.x509.X509Name; import org.bouncycastle.jce.PrincipalUtil; @@ -562,7 +562,7 @@ public class X509CRLSelector implements CRLSelector ((ASN1OctetString)derInputStream.readObject()) .getOctets()); derInputStream = new ASN1InputStream(inStream); - BigInteger crlNumber = ((DERInteger)derInputStream.readObject()) + BigInteger crlNumber = ((ASN1Integer)derInputStream.readObject()) .getPositiveValue(); if (minCRL != null && minCRL.compareTo(crlNumber) > 0) { diff --git a/core/src/test/java/org/bouncycastle/asn1/test/ASN1SequenceParserTest.java b/core/src/test/java/org/bouncycastle/asn1/test/ASN1SequenceParserTest.java index bbfc65db..e0cd1af2 100644 --- a/core/src/test/java/org/bouncycastle/asn1/test/ASN1SequenceParserTest.java +++ b/core/src/test/java/org/bouncycastle/asn1/test/ASN1SequenceParserTest.java @@ -1,22 +1,22 @@ package org.bouncycastle.asn1.test; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.math.BigInteger; +import java.util.Arrays; + import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; +import org.bouncycastle.asn1.ASN1Integer; import org.bouncycastle.asn1.ASN1Null; +import org.bouncycastle.asn1.ASN1ObjectIdentifier; import org.bouncycastle.asn1.ASN1SequenceParser; import org.bouncycastle.asn1.ASN1StreamParser; import org.bouncycastle.asn1.BERSequenceGenerator; -import org.bouncycastle.asn1.DERInteger; -import org.bouncycastle.asn1.DERObjectIdentifier; import org.bouncycastle.asn1.DERSequenceGenerator; import org.bouncycastle.util.encoders.Hex; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.math.BigInteger; -import java.util.Arrays; - public class ASN1SequenceParserTest extends TestCase { @@ -40,9 +40,9 @@ public class ASN1SequenceParserTest ByteArrayOutputStream bOut = new ByteArrayOutputStream(); DERSequenceGenerator seqGen = new DERSequenceGenerator(bOut); - seqGen.addObject(new DERInteger(BigInteger.valueOf(0))); + seqGen.addObject(new ASN1Integer(BigInteger.valueOf(0))); - seqGen.addObject(new DERObjectIdentifier("1.1")); + seqGen.addObject(new ASN1ObjectIdentifier("1.1")); seqGen.close(); @@ -55,13 +55,13 @@ public class ASN1SequenceParserTest ByteArrayOutputStream bOut = new ByteArrayOutputStream(); DERSequenceGenerator seqGen1 = new DERSequenceGenerator(bOut); - seqGen1.addObject(new DERInteger(BigInteger.valueOf(0))); + seqGen1.addObject(new ASN1Integer(BigInteger.valueOf(0))); - seqGen1.addObject(new DERObjectIdentifier("1.1")); + seqGen1.addObject(new ASN1ObjectIdentifier("1.1")); DERSequenceGenerator seqGen2 = new DERSequenceGenerator(seqGen1.getRawOutputStream()); - seqGen2.addObject(new DERInteger(BigInteger.valueOf(1))); + seqGen2.addObject(new ASN1Integer(BigInteger.valueOf(1))); seqGen2.close(); @@ -76,9 +76,9 @@ public class ASN1SequenceParserTest ByteArrayOutputStream bOut = new ByteArrayOutputStream(); DERSequenceGenerator seqGen = new DERSequenceGenerator(bOut, 1, true); - seqGen.addObject(new DERInteger(BigInteger.valueOf(0))); + seqGen.addObject(new ASN1Integer(BigInteger.valueOf(0))); - seqGen.addObject(new DERObjectIdentifier("1.1")); + seqGen.addObject(new ASN1ObjectIdentifier("1.1")); seqGen.close(); @@ -91,9 +91,9 @@ public class ASN1SequenceParserTest ByteArrayOutputStream bOut = new ByteArrayOutputStream(); DERSequenceGenerator seqGen = new DERSequenceGenerator(bOut, 1, false); - seqGen.addObject(new DERInteger(BigInteger.valueOf(0))); + seqGen.addObject(new ASN1Integer(BigInteger.valueOf(0))); - seqGen.addObject(new DERObjectIdentifier("1.1")); + seqGen.addObject(new ASN1ObjectIdentifier("1.1")); seqGen.close(); @@ -106,13 +106,13 @@ public class ASN1SequenceParserTest ByteArrayOutputStream bOut = new ByteArrayOutputStream(); DERSequenceGenerator seqGen1 = new DERSequenceGenerator(bOut); - seqGen1.addObject(new DERInteger(BigInteger.valueOf(0))); + seqGen1.addObject(new ASN1Integer(BigInteger.valueOf(0))); - seqGen1.addObject(new DERObjectIdentifier("1.1")); + seqGen1.addObject(new ASN1ObjectIdentifier("1.1")); DERSequenceGenerator seqGen2 = new DERSequenceGenerator(seqGen1.getRawOutputStream(), 1, true); - seqGen2.addObject(new DERInteger(BigInteger.valueOf(1))); + seqGen2.addObject(new ASN1Integer(BigInteger.valueOf(1))); seqGen2.close(); @@ -127,13 +127,13 @@ public class ASN1SequenceParserTest ByteArrayOutputStream bOut = new ByteArrayOutputStream(); DERSequenceGenerator seqGen1 = new DERSequenceGenerator(bOut); - seqGen1.addObject(new DERInteger(BigInteger.valueOf(0))); + seqGen1.addObject(new ASN1Integer(BigInteger.valueOf(0))); - seqGen1.addObject(new DERObjectIdentifier("1.1")); + seqGen1.addObject(new ASN1ObjectIdentifier("1.1")); DERSequenceGenerator seqGen2 = new DERSequenceGenerator(seqGen1.getRawOutputStream(), 1, false); - seqGen2.addObject(new DERInteger(BigInteger.valueOf(1))); + seqGen2.addObject(new ASN1Integer(BigInteger.valueOf(1))); seqGen2.close(); @@ -148,9 +148,9 @@ public class ASN1SequenceParserTest ByteArrayOutputStream bOut = new ByteArrayOutputStream(); BERSequenceGenerator seqGen = new BERSequenceGenerator(bOut); - seqGen.addObject(new DERInteger(BigInteger.valueOf(0))); + seqGen.addObject(new ASN1Integer(BigInteger.valueOf(0))); - seqGen.addObject(new DERObjectIdentifier("1.1")); + seqGen.addObject(new ASN1ObjectIdentifier("1.1")); seqGen.close(); @@ -163,13 +163,13 @@ public class ASN1SequenceParserTest ByteArrayOutputStream bOut = new ByteArrayOutputStream(); BERSequenceGenerator seqGen1 = new BERSequenceGenerator(bOut); - seqGen1.addObject(new DERInteger(BigInteger.valueOf(0))); + seqGen1.addObject(new ASN1Integer(BigInteger.valueOf(0))); - seqGen1.addObject(new DERObjectIdentifier("1.1")); + seqGen1.addObject(new ASN1ObjectIdentifier("1.1")); DERSequenceGenerator seqGen2 = new DERSequenceGenerator(seqGen1.getRawOutputStream()); - seqGen2.addObject(new DERInteger(BigInteger.valueOf(1))); + seqGen2.addObject(new ASN1Integer(BigInteger.valueOf(1))); seqGen2.close(); @@ -184,13 +184,13 @@ public class ASN1SequenceParserTest ByteArrayOutputStream bOut = new ByteArrayOutputStream(); BERSequenceGenerator seqGen1 = new BERSequenceGenerator(bOut); - seqGen1.addObject(new DERInteger(BigInteger.valueOf(0))); + seqGen1.addObject(new ASN1Integer(BigInteger.valueOf(0))); - seqGen1.addObject(new DERObjectIdentifier("1.1")); + seqGen1.addObject(new ASN1ObjectIdentifier("1.1")); BERSequenceGenerator seqGen2 = new BERSequenceGenerator(seqGen1.getRawOutputStream()); - seqGen2.addObject(new DERInteger(BigInteger.valueOf(1))); + seqGen2.addObject(new ASN1Integer(BigInteger.valueOf(1))); seqGen2.close(); @@ -215,10 +215,10 @@ public class ASN1SequenceParserTest switch (count) { case 0: - assertTrue(o instanceof DERInteger); + assertTrue(o instanceof ASN1Integer); break; case 1: - assertTrue(o instanceof DERObjectIdentifier); + assertTrue(o instanceof ASN1ObjectIdentifier); break; } count++; @@ -244,10 +244,10 @@ public class ASN1SequenceParserTest switch (count) { case 0: - assertTrue(o instanceof DERInteger); + assertTrue(o instanceof ASN1Integer); break; case 1: - assertTrue(o instanceof DERObjectIdentifier); + assertTrue(o instanceof ASN1ObjectIdentifier); break; case 2: assertTrue(o instanceof ASN1SequenceParser); @@ -290,10 +290,10 @@ public class ASN1SequenceParserTest switch (count) { case 0: - assertTrue(o instanceof DERInteger); + assertTrue(o instanceof ASN1Integer); break; case 1: - assertTrue(o instanceof DERObjectIdentifier); + assertTrue(o instanceof ASN1ObjectIdentifier); break; } count++; @@ -320,9 +320,9 @@ public class ASN1SequenceParserTest ByteArrayOutputStream bOut = new ByteArrayOutputStream(); BERSequenceGenerator seqGen = new BERSequenceGenerator(bOut, 1, true); - seqGen.addObject(new DERInteger(BigInteger.valueOf(0))); + seqGen.addObject(new ASN1Integer(BigInteger.valueOf(0))); - seqGen.addObject(new DERObjectIdentifier("1.1")); + seqGen.addObject(new ASN1ObjectIdentifier("1.1")); seqGen.close(); @@ -353,10 +353,10 @@ public class ASN1SequenceParserTest assertTrue(o instanceof ASN1Null); break; case 1: - assertTrue(o instanceof DERInteger); + assertTrue(o instanceof ASN1Integer); break; case 2: - assertTrue(o instanceof DERObjectIdentifier); + assertTrue(o instanceof ASN1ObjectIdentifier); break; } count++; diff --git a/core/src/test/java/org/bouncycastle/asn1/test/AdmissionsUnitTest.java b/core/src/test/java/org/bouncycastle/asn1/test/AdmissionsUnitTest.java index b1d0e43d..171faec4 100644 --- a/core/src/test/java/org/bouncycastle/asn1/test/AdmissionsUnitTest.java +++ b/core/src/test/java/org/bouncycastle/asn1/test/AdmissionsUnitTest.java @@ -1,8 +1,10 @@ package org.bouncycastle.asn1.test; +import java.io.IOException; + import org.bouncycastle.asn1.ASN1InputStream; +import org.bouncycastle.asn1.ASN1ObjectIdentifier; import org.bouncycastle.asn1.ASN1Sequence; -import org.bouncycastle.asn1.DERObjectIdentifier; import org.bouncycastle.asn1.isismtt.x509.Admissions; import org.bouncycastle.asn1.isismtt.x509.NamingAuthority; import org.bouncycastle.asn1.isismtt.x509.ProfessionInfo; @@ -10,8 +12,6 @@ import org.bouncycastle.asn1.x500.DirectoryString; import org.bouncycastle.asn1.x509.GeneralName; import org.bouncycastle.asn1.x509.X509Name; -import java.io.IOException; - public class AdmissionsUnitTest extends ASN1UnitTest { @@ -24,7 +24,7 @@ public class AdmissionsUnitTest throws Exception { GeneralName name = new GeneralName(new X509Name("CN=hello world")); - NamingAuthority auth = new NamingAuthority(new DERObjectIdentifier("1.2.3"), "url", new DirectoryString("fred")); + NamingAuthority auth = new NamingAuthority(new ASN1ObjectIdentifier("1.2.3"), "url", new DirectoryString("fred")); Admissions admissions = new Admissions(name, auth, new ProfessionInfo[0]); checkConstruction(admissions, name, auth); diff --git a/core/src/test/java/org/bouncycastle/asn1/test/AttributeTableUnitTest.java b/core/src/test/java/org/bouncycastle/asn1/test/AttributeTableUnitTest.java index de7d1470..337fb1a5 100644 --- a/core/src/test/java/org/bouncycastle/asn1/test/AttributeTableUnitTest.java +++ b/core/src/test/java/org/bouncycastle/asn1/test/AttributeTableUnitTest.java @@ -3,7 +3,7 @@ package org.bouncycastle.asn1.test; import java.util.Hashtable; import org.bouncycastle.asn1.ASN1EncodableVector; -import org.bouncycastle.asn1.DERObjectIdentifier; +import org.bouncycastle.asn1.ASN1ObjectIdentifier; import org.bouncycastle.asn1.DERSet; import org.bouncycastle.asn1.cms.Attribute; import org.bouncycastle.asn1.cms.AttributeTable; @@ -12,9 +12,9 @@ import org.bouncycastle.util.test.SimpleTest; public class AttributeTableUnitTest extends SimpleTest { - private static final DERObjectIdentifier type1 = new DERObjectIdentifier("1.1.1"); - private static final DERObjectIdentifier type2 = new DERObjectIdentifier("1.1.2"); - private static final DERObjectIdentifier type3 = new DERObjectIdentifier("1.1.3"); + private static final ASN1ObjectIdentifier type1 = new ASN1ObjectIdentifier("1.1.1"); + private static final ASN1ObjectIdentifier type2 = new ASN1ObjectIdentifier("1.1.2"); + private static final ASN1ObjectIdentifier type3 = new ASN1ObjectIdentifier("1.1.3"); public String getName() { diff --git a/core/src/test/java/org/bouncycastle/asn1/test/CertHashUnitTest.java b/core/src/test/java/org/bouncycastle/asn1/test/CertHashUnitTest.java index 08fb70ce..62c81d45 100644 --- a/core/src/test/java/org/bouncycastle/asn1/test/CertHashUnitTest.java +++ b/core/src/test/java/org/bouncycastle/asn1/test/CertHashUnitTest.java @@ -1,13 +1,13 @@ package org.bouncycastle.asn1.test; +import java.io.IOException; + import org.bouncycastle.asn1.ASN1InputStream; +import org.bouncycastle.asn1.ASN1ObjectIdentifier; import org.bouncycastle.asn1.ASN1Sequence; -import org.bouncycastle.asn1.DERObjectIdentifier; import org.bouncycastle.asn1.isismtt.ocsp.CertHash; import org.bouncycastle.asn1.x509.AlgorithmIdentifier; -import java.io.IOException; - public class CertHashUnitTest extends ASN1UnitTest { @@ -19,7 +19,7 @@ public class CertHashUnitTest public void performTest() throws Exception { - AlgorithmIdentifier algId = new AlgorithmIdentifier(new DERObjectIdentifier("1.2.2.3")); + AlgorithmIdentifier algId = new AlgorithmIdentifier(new ASN1ObjectIdentifier("1.2.2.3")); byte[] digest = new byte[20]; CertHash certID = new CertHash(algId, digest); diff --git a/core/src/test/java/org/bouncycastle/asn1/test/CommitmentTypeIndicationUnitTest.java b/core/src/test/java/org/bouncycastle/asn1/test/CommitmentTypeIndicationUnitTest.java index 9b3d5d29..0ce1c236 100644 --- a/core/src/test/java/org/bouncycastle/asn1/test/CommitmentTypeIndicationUnitTest.java +++ b/core/src/test/java/org/bouncycastle/asn1/test/CommitmentTypeIndicationUnitTest.java @@ -4,8 +4,8 @@ import java.io.IOException; import org.bouncycastle.asn1.ASN1Encodable; import org.bouncycastle.asn1.ASN1InputStream; +import org.bouncycastle.asn1.ASN1ObjectIdentifier; import org.bouncycastle.asn1.ASN1Sequence; -import org.bouncycastle.asn1.DERObjectIdentifier; import org.bouncycastle.asn1.DERSequence; import org.bouncycastle.asn1.esf.CommitmentTypeIdentifier; import org.bouncycastle.asn1.esf.CommitmentTypeIndication; @@ -26,7 +26,7 @@ public class CommitmentTypeIndicationUnitTest checkConstruction(cti, CommitmentTypeIdentifier.proofOfOrigin, null); - ASN1Sequence qualifier = new DERSequence(new DERObjectIdentifier("1.2")); + ASN1Sequence qualifier = new DERSequence(new ASN1ObjectIdentifier("1.2")); cti = new CommitmentTypeIndication(CommitmentTypeIdentifier.proofOfOrigin, qualifier); @@ -53,7 +53,7 @@ public class CommitmentTypeIndicationUnitTest private void checkConstruction( CommitmentTypeIndication mv, - DERObjectIdentifier commitmenttTypeId, + ASN1ObjectIdentifier commitmenttTypeId, ASN1Encodable qualifier) throws IOException { @@ -74,7 +74,7 @@ public class CommitmentTypeIndicationUnitTest private void checkStatement( CommitmentTypeIndication cti, - DERObjectIdentifier commitmentTypeId, + ASN1ObjectIdentifier commitmentTypeId, ASN1Encodable qualifier) { if (!cti.getCommitmentTypeId().equals(commitmentTypeId)) diff --git a/core/src/test/java/org/bouncycastle/asn1/test/CommitmentTypeQualifierUnitTest.java b/core/src/test/java/org/bouncycastle/asn1/test/CommitmentTypeQualifierUnitTest.java index bebb1195..2d782ba9 100644 --- a/core/src/test/java/org/bouncycastle/asn1/test/CommitmentTypeQualifierUnitTest.java +++ b/core/src/test/java/org/bouncycastle/asn1/test/CommitmentTypeQualifierUnitTest.java @@ -4,8 +4,8 @@ import java.io.IOException; import org.bouncycastle.asn1.ASN1Encodable; import org.bouncycastle.asn1.ASN1InputStream; +import org.bouncycastle.asn1.ASN1ObjectIdentifier; import org.bouncycastle.asn1.ASN1Sequence; -import org.bouncycastle.asn1.DERObjectIdentifier; import org.bouncycastle.asn1.esf.CommitmentTypeIdentifier; import org.bouncycastle.asn1.esf.CommitmentTypeQualifier; import org.bouncycastle.util.test.SimpleTest; @@ -25,7 +25,7 @@ public class CommitmentTypeQualifierUnitTest checkConstruction(ctq, CommitmentTypeIdentifier.proofOfOrigin, null); - ASN1Encodable info = new DERObjectIdentifier("1.2"); + ASN1Encodable info = new ASN1ObjectIdentifier("1.2"); ctq = new CommitmentTypeQualifier(CommitmentTypeIdentifier.proofOfOrigin, info); @@ -52,7 +52,7 @@ public class CommitmentTypeQualifierUnitTest private void checkConstruction( CommitmentTypeQualifier mv, - DERObjectIdentifier commitmenttTypeId, + ASN1ObjectIdentifier commitmenttTypeId, ASN1Encodable qualifier) throws IOException { @@ -73,7 +73,7 @@ public class CommitmentTypeQualifierUnitTest private void checkStatement( CommitmentTypeQualifier ctq, - DERObjectIdentifier commitmentTypeId, + ASN1ObjectIdentifier commitmentTypeId, ASN1Encodable qualifier) { if (!ctq.getCommitmentTypeIdentifier().equals(commitmentTypeId)) diff --git a/core/src/test/java/org/bouncycastle/asn1/test/DERApplicationSpecificTest.java b/core/src/test/java/org/bouncycastle/asn1/test/DERApplicationSpecificTest.java index b41a8821..2e047dee 100644 --- a/core/src/test/java/org/bouncycastle/asn1/test/DERApplicationSpecificTest.java +++ b/core/src/test/java/org/bouncycastle/asn1/test/DERApplicationSpecificTest.java @@ -1,10 +1,10 @@ package org.bouncycastle.asn1.test; import org.bouncycastle.asn1.ASN1Encoding; +import org.bouncycastle.asn1.ASN1Integer; import org.bouncycastle.asn1.ASN1Primitive; import org.bouncycastle.asn1.BERTags; import org.bouncycastle.asn1.DERApplicationSpecific; -import org.bouncycastle.asn1.DERInteger; import org.bouncycastle.util.Arrays; import org.bouncycastle.util.encoders.Hex; import org.bouncycastle.util.test.SimpleTest; @@ -37,7 +37,7 @@ public class DERApplicationSpecificTest public void performTest() throws Exception { - DERInteger value = new DERInteger(9); + ASN1Integer value = new ASN1Integer(9); DERApplicationSpecific tagged = new DERApplicationSpecific(false, 3, value); @@ -46,7 +46,7 @@ public class DERApplicationSpecificTest fail("implicit encoding failed"); } - DERInteger recVal = (DERInteger)tagged.getObject(BERTags.INTEGER); + ASN1Integer recVal = (ASN1Integer)tagged.getObject(BERTags.INTEGER); if (!value.equals(recVal)) { diff --git a/core/src/test/java/org/bouncycastle/asn1/test/EqualsAndHashCodeTest.java b/core/src/test/java/org/bouncycastle/asn1/test/EqualsAndHashCodeTest.java index 640d7f61..3da4e6ad 100644 --- a/core/src/test/java/org/bouncycastle/asn1/test/EqualsAndHashCodeTest.java +++ b/core/src/test/java/org/bouncycastle/asn1/test/EqualsAndHashCodeTest.java @@ -4,7 +4,11 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.util.Date; +import org.bouncycastle.asn1.ASN1Boolean; +import org.bouncycastle.asn1.ASN1Enumerated; import org.bouncycastle.asn1.ASN1InputStream; +import org.bouncycastle.asn1.ASN1Integer; +import org.bouncycastle.asn1.ASN1ObjectIdentifier; import org.bouncycastle.asn1.ASN1OutputStream; import org.bouncycastle.asn1.ASN1Primitive; import org.bouncycastle.asn1.BERConstructedOctetString; @@ -14,15 +18,11 @@ import org.bouncycastle.asn1.BERTaggedObject; import org.bouncycastle.asn1.DERApplicationSpecific; import org.bouncycastle.asn1.DERBMPString; import org.bouncycastle.asn1.DERBitString; -import org.bouncycastle.asn1.DERBoolean; -import org.bouncycastle.asn1.DEREnumerated; import org.bouncycastle.asn1.DERGeneralString; import org.bouncycastle.asn1.DERGeneralizedTime; import org.bouncycastle.asn1.DERIA5String; -import org.bouncycastle.asn1.DERInteger; import org.bouncycastle.asn1.DERNull; import org.bouncycastle.asn1.DERNumericString; -import org.bouncycastle.asn1.DERObjectIdentifier; import org.bouncycastle.asn1.DEROctetString; import org.bouncycastle.asn1.DERPrintableString; import org.bouncycastle.asn1.DERSequence; @@ -52,16 +52,16 @@ public class EqualsAndHashCodeTest new DERApplicationSpecific(0, data), new DERBitString(data), new DERBMPString("hello world"), - new DERBoolean(true), - new DERBoolean(false), - new DEREnumerated(100), + new ASN1Boolean(true), + new ASN1Boolean(false), + new ASN1Enumerated(100), new DERGeneralizedTime("20070315173729Z"), new DERGeneralString("hello world"), new DERIA5String("hello"), - new DERInteger(1000), + new ASN1Integer(1000), new DERNull(), new DERNumericString("123456"), - new DERObjectIdentifier("1.1.1.10000.1"), + new ASN1ObjectIdentifier("1.1.1.10000.1"), new DEROctetString(data), new DERPrintableString("hello world"), new DERSequence(new DERPrintableString("hello world")), diff --git a/core/src/test/java/org/bouncycastle/asn1/test/NamingAuthorityUnitTest.java b/core/src/test/java/org/bouncycastle/asn1/test/NamingAuthorityUnitTest.java index 09214029..8dfcf8cd 100644 --- a/core/src/test/java/org/bouncycastle/asn1/test/NamingAuthorityUnitTest.java +++ b/core/src/test/java/org/bouncycastle/asn1/test/NamingAuthorityUnitTest.java @@ -1,13 +1,13 @@ package org.bouncycastle.asn1.test; +import java.io.IOException; + import org.bouncycastle.asn1.ASN1InputStream; +import org.bouncycastle.asn1.ASN1ObjectIdentifier; import org.bouncycastle.asn1.ASN1Sequence; -import org.bouncycastle.asn1.DERObjectIdentifier; import org.bouncycastle.asn1.isismtt.x509.NamingAuthority; import org.bouncycastle.asn1.x500.DirectoryString; -import java.io.IOException; - public class NamingAuthorityUnitTest extends ASN1UnitTest { @@ -19,7 +19,7 @@ public class NamingAuthorityUnitTest public void performTest() throws Exception { - DERObjectIdentifier namingAuthorityID = new DERObjectIdentifier("1.2.3"); + ASN1ObjectIdentifier namingAuthorityID = new ASN1ObjectIdentifier("1.2.3"); String namingAuthorityURL = "url"; DirectoryString namingAuthorityText = new DirectoryString("text"); @@ -60,7 +60,7 @@ public class NamingAuthorityUnitTest private void checkConstruction( NamingAuthority auth, - DERObjectIdentifier namingAuthorityID, + ASN1ObjectIdentifier namingAuthorityID, String namingAuthorityURL, DirectoryString namingAuthorityText) throws IOException @@ -82,7 +82,7 @@ public class NamingAuthorityUnitTest private void checkValues( NamingAuthority auth, - DERObjectIdentifier namingAuthorityId, + ASN1ObjectIdentifier namingAuthorityId, String namingAuthorityURL, DirectoryString namingAuthorityText) { diff --git a/core/src/test/java/org/bouncycastle/asn1/test/OIDTest.java b/core/src/test/java/org/bouncycastle/asn1/test/OIDTest.java index b238fa5e..fa5aa61b 100644 --- a/core/src/test/java/org/bouncycastle/asn1/test/OIDTest.java +++ b/core/src/test/java/org/bouncycastle/asn1/test/OIDTest.java @@ -7,7 +7,6 @@ import java.io.IOException; import org.bouncycastle.asn1.ASN1InputStream; import org.bouncycastle.asn1.ASN1ObjectIdentifier; import org.bouncycastle.asn1.ASN1OutputStream; -import org.bouncycastle.asn1.DERObjectIdentifier; import org.bouncycastle.asn1.DEROutputStream; import org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers; import org.bouncycastle.util.encoders.Hex; @@ -36,8 +35,8 @@ public class OIDTest ByteArrayInputStream bIn = new ByteArrayInputStream(enc); ASN1InputStream aIn = new ASN1InputStream(bIn); - DERObjectIdentifier o = new DERObjectIdentifier(oid); - DERObjectIdentifier encO = (DERObjectIdentifier)aIn.readObject(); + ASN1ObjectIdentifier o = new ASN1ObjectIdentifier(oid); + ASN1ObjectIdentifier encO = (ASN1ObjectIdentifier)aIn.readObject(); if (!o.equals(encO)) { @@ -69,7 +68,7 @@ public class OIDTest String oid) throws IOException { - DERObjectIdentifier o = new DERObjectIdentifier(oid); + ASN1ObjectIdentifier o = new ASN1ObjectIdentifier(oid); ByteArrayOutputStream bOut = new ByteArrayOutputStream(); ASN1OutputStream aOut = new ASN1OutputStream(bOut); @@ -78,7 +77,7 @@ public class OIDTest ByteArrayInputStream bIn = new ByteArrayInputStream(bOut.toByteArray()); ASN1InputStream aIn = new ASN1InputStream(bIn); - o = (DERObjectIdentifier)aIn.readObject(); + o = (ASN1ObjectIdentifier)aIn.readObject(); if (!o.getId().equals(oid)) { @@ -91,7 +90,7 @@ public class OIDTest { try { - new DERObjectIdentifier(oid); + new ASN1ObjectIdentifier(oid); fail("failed to catch bad oid: " + oid); } catch (IllegalArgumentException e) diff --git a/core/src/test/java/org/bouncycastle/asn1/test/OctetStringTest.java b/core/src/test/java/org/bouncycastle/asn1/test/OctetStringTest.java index 88618b70..68ed5da5 100644 --- a/core/src/test/java/org/bouncycastle/asn1/test/OctetStringTest.java +++ b/core/src/test/java/org/bouncycastle/asn1/test/OctetStringTest.java @@ -7,14 +7,14 @@ import java.io.OutputStream; import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; +import org.bouncycastle.asn1.ASN1Integer; +import org.bouncycastle.asn1.ASN1ObjectIdentifier; import org.bouncycastle.asn1.ASN1OctetStringParser; import org.bouncycastle.asn1.ASN1SequenceParser; import org.bouncycastle.asn1.ASN1StreamParser; import org.bouncycastle.asn1.BEROctetStringGenerator; import org.bouncycastle.asn1.BERSequenceGenerator; import org.bouncycastle.asn1.BERTags; -import org.bouncycastle.asn1.DERInteger; -import org.bouncycastle.asn1.DERObjectIdentifier; import org.bouncycastle.asn1.DERSequenceGenerator; import org.bouncycastle.asn1.cms.CMSObjectIdentifiers; import org.bouncycastle.asn1.cms.CompressedDataParser; @@ -135,18 +135,18 @@ public class OctetStringTest BERSequenceGenerator sGen = new BERSequenceGenerator(bOut); - sGen.addObject(new DERObjectIdentifier(CMSObjectIdentifiers.compressedData.getId())); + sGen.addObject(new ASN1ObjectIdentifier(CMSObjectIdentifiers.compressedData.getId())); BERSequenceGenerator cGen = new BERSequenceGenerator(sGen.getRawOutputStream(), 0, true); - cGen.addObject(new DERInteger(0)); + cGen.addObject(new ASN1Integer(0)); // // AlgorithmIdentifier // DERSequenceGenerator algGen = new DERSequenceGenerator(cGen.getRawOutputStream()); - algGen.addObject(new DERObjectIdentifier("1.2")); + algGen.addObject(new ASN1ObjectIdentifier("1.2")); algGen.close(); @@ -155,7 +155,7 @@ public class OctetStringTest // BERSequenceGenerator eiGen = new BERSequenceGenerator(cGen.getRawOutputStream()); - eiGen.addObject(new DERObjectIdentifier("1.1")); + eiGen.addObject(new ASN1ObjectIdentifier("1.1")); BEROctetStringGenerator octGen = new BEROctetStringGenerator(eiGen.getRawOutputStream(), 0, true); diff --git a/core/src/test/java/org/bouncycastle/asn1/test/OtherCertIDUnitTest.java b/core/src/test/java/org/bouncycastle/asn1/test/OtherCertIDUnitTest.java index e133ebd0..9a85ceac 100644 --- a/core/src/test/java/org/bouncycastle/asn1/test/OtherCertIDUnitTest.java +++ b/core/src/test/java/org/bouncycastle/asn1/test/OtherCertIDUnitTest.java @@ -4,8 +4,8 @@ import java.io.IOException; import org.bouncycastle.asn1.ASN1InputStream; import org.bouncycastle.asn1.ASN1Integer; +import org.bouncycastle.asn1.ASN1ObjectIdentifier; import org.bouncycastle.asn1.ASN1Sequence; -import org.bouncycastle.asn1.DERObjectIdentifier; import org.bouncycastle.asn1.ess.OtherCertID; import org.bouncycastle.asn1.x509.AlgorithmIdentifier; import org.bouncycastle.asn1.x509.GeneralName; @@ -24,7 +24,7 @@ public class OtherCertIDUnitTest public void performTest() throws Exception { - AlgorithmIdentifier algId = new AlgorithmIdentifier(new DERObjectIdentifier("1.2.2.3")); + AlgorithmIdentifier algId = new AlgorithmIdentifier(new ASN1ObjectIdentifier("1.2.2.3")); byte[] digest = new byte[20]; IssuerSerial issuerSerial = new IssuerSerial(new GeneralNames(new GeneralName(new X509Name("CN=test"))), new ASN1Integer(1)); diff --git a/core/src/test/java/org/bouncycastle/asn1/test/OtherSigningCertificateUnitTest.java b/core/src/test/java/org/bouncycastle/asn1/test/OtherSigningCertificateUnitTest.java index dfb46be7..9de12ee8 100644 --- a/core/src/test/java/org/bouncycastle/asn1/test/OtherSigningCertificateUnitTest.java +++ b/core/src/test/java/org/bouncycastle/asn1/test/OtherSigningCertificateUnitTest.java @@ -1,14 +1,14 @@ package org.bouncycastle.asn1.test; +import java.io.IOException; + import org.bouncycastle.asn1.ASN1InputStream; +import org.bouncycastle.asn1.ASN1ObjectIdentifier; import org.bouncycastle.asn1.ASN1Sequence; -import org.bouncycastle.asn1.DERObjectIdentifier; import org.bouncycastle.asn1.ess.OtherCertID; import org.bouncycastle.asn1.ess.OtherSigningCertificate; import org.bouncycastle.asn1.x509.AlgorithmIdentifier; -import java.io.IOException; - public class OtherSigningCertificateUnitTest extends ASN1UnitTest { @@ -20,7 +20,7 @@ public class OtherSigningCertificateUnitTest public void performTest() throws Exception { - AlgorithmIdentifier algId = new AlgorithmIdentifier(new DERObjectIdentifier("1.2.2.3")); + AlgorithmIdentifier algId = new AlgorithmIdentifier(new ASN1ObjectIdentifier("1.2.2.3")); byte[] digest = new byte[20]; OtherCertID otherCertID = new OtherCertID(algId, digest); diff --git a/core/src/test/java/org/bouncycastle/asn1/test/ProfessionInfoUnitTest.java b/core/src/test/java/org/bouncycastle/asn1/test/ProfessionInfoUnitTest.java index bb9cf8ca..34b33070 100644 --- a/core/src/test/java/org/bouncycastle/asn1/test/ProfessionInfoUnitTest.java +++ b/core/src/test/java/org/bouncycastle/asn1/test/ProfessionInfoUnitTest.java @@ -5,7 +5,6 @@ import java.io.IOException; import org.bouncycastle.asn1.ASN1InputStream; import org.bouncycastle.asn1.ASN1ObjectIdentifier; import org.bouncycastle.asn1.ASN1Sequence; -import org.bouncycastle.asn1.DERObjectIdentifier; import org.bouncycastle.asn1.DEROctetString; import org.bouncycastle.asn1.isismtt.x509.NamingAuthority; import org.bouncycastle.asn1.isismtt.x509.ProcurationSyntax; @@ -23,7 +22,7 @@ public class ProfessionInfoUnitTest public void performTest() throws Exception { - NamingAuthority auth = new NamingAuthority(new DERObjectIdentifier("1.2.3"), "url", new DirectoryString("fred")); + NamingAuthority auth = new NamingAuthority(new ASN1ObjectIdentifier("1.2.3"), "url", new DirectoryString("fred")); DirectoryString[] professionItems = { new DirectoryString("substitution") }; ASN1ObjectIdentifier[] professionOids = { new ASN1ObjectIdentifier("1.2.3") }; String registrationNumber = "12345"; @@ -72,7 +71,7 @@ public class ProfessionInfoUnitTest ProfessionInfo profInfo, NamingAuthority auth, DirectoryString[] professionItems, - DERObjectIdentifier[] professionOids, + ASN1ObjectIdentifier[] professionOids, String registrationNumber, DEROctetString addProfInfo) throws IOException @@ -96,7 +95,7 @@ public class ProfessionInfoUnitTest ProfessionInfo profInfo, NamingAuthority auth, DirectoryString[] professionItems, - DERObjectIdentifier[] professionOids, + ASN1ObjectIdentifier[] professionOids, String registrationNumber, DEROctetString addProfInfo) { diff --git a/core/src/test/java/org/bouncycastle/asn1/test/QCStatementUnitTest.java b/core/src/test/java/org/bouncycastle/asn1/test/QCStatementUnitTest.java index e431dc9c..d7a84a5e 100644 --- a/core/src/test/java/org/bouncycastle/asn1/test/QCStatementUnitTest.java +++ b/core/src/test/java/org/bouncycastle/asn1/test/QCStatementUnitTest.java @@ -6,7 +6,6 @@ import org.bouncycastle.asn1.ASN1Encodable; import org.bouncycastle.asn1.ASN1InputStream; import org.bouncycastle.asn1.ASN1ObjectIdentifier; import org.bouncycastle.asn1.ASN1Sequence; -import org.bouncycastle.asn1.DERObjectIdentifier; import org.bouncycastle.asn1.x509.qualified.QCStatement; import org.bouncycastle.asn1.x509.qualified.RFC3739QCObjectIdentifiers; import org.bouncycastle.asn1.x509.qualified.SemanticsInformation; @@ -54,7 +53,7 @@ public class QCStatementUnitTest private void checkConstruction( QCStatement mv, - DERObjectIdentifier statementId, + ASN1ObjectIdentifier statementId, ASN1Encodable statementInfo) throws IOException { @@ -75,7 +74,7 @@ public class QCStatementUnitTest private void checkStatement( QCStatement qcs, - DERObjectIdentifier statementId, + ASN1ObjectIdentifier statementId, ASN1Encodable statementInfo) throws IOException { diff --git a/core/src/test/java/org/bouncycastle/asn1/test/SemanticsInformationUnitTest.java b/core/src/test/java/org/bouncycastle/asn1/test/SemanticsInformationUnitTest.java index de5f0cf2..3fd26db5 100644 --- a/core/src/test/java/org/bouncycastle/asn1/test/SemanticsInformationUnitTest.java +++ b/core/src/test/java/org/bouncycastle/asn1/test/SemanticsInformationUnitTest.java @@ -4,7 +4,6 @@ import org.bouncycastle.asn1.ASN1EncodableVector; import org.bouncycastle.asn1.ASN1InputStream; import org.bouncycastle.asn1.ASN1ObjectIdentifier; import org.bouncycastle.asn1.ASN1Sequence; -import org.bouncycastle.asn1.DERObjectIdentifier; import org.bouncycastle.asn1.DERSequence; import org.bouncycastle.asn1.x509.GeneralName; import org.bouncycastle.asn1.x509.X509Name; @@ -74,7 +73,7 @@ public class SemanticsInformationUnitTest private void checkConstruction( SemanticsInformation mv, - DERObjectIdentifier semanticsIdentifier, + ASN1ObjectIdentifier semanticsIdentifier, GeneralName[] names) throws Exception { @@ -95,7 +94,7 @@ public class SemanticsInformationUnitTest private void checkStatement( SemanticsInformation si, - DERObjectIdentifier id, + ASN1ObjectIdentifier id, GeneralName[] names) { if (id != null) diff --git a/core/src/test/java/org/bouncycastle/asn1/test/SetTest.java b/core/src/test/java/org/bouncycastle/asn1/test/SetTest.java index d6256516..2e4fb392 100644 --- a/core/src/test/java/org/bouncycastle/asn1/test/SetTest.java +++ b/core/src/test/java/org/bouncycastle/asn1/test/SetTest.java @@ -1,12 +1,12 @@ package org.bouncycastle.asn1.test; +import org.bouncycastle.asn1.ASN1Boolean; import org.bouncycastle.asn1.ASN1EncodableVector; +import org.bouncycastle.asn1.ASN1Integer; import org.bouncycastle.asn1.ASN1Set; import org.bouncycastle.asn1.ASN1TaggedObject; import org.bouncycastle.asn1.BERSet; import org.bouncycastle.asn1.DERBitString; -import org.bouncycastle.asn1.DERBoolean; -import org.bouncycastle.asn1.DERInteger; import org.bouncycastle.asn1.DEROctetString; import org.bouncycastle.asn1.DERSequence; import org.bouncycastle.asn1.DERSet; @@ -27,8 +27,8 @@ public class SetTest private void checkedSortedSet(int attempt, ASN1Set s) { - if (s.getObjectAt(0) instanceof DERBoolean - && s.getObjectAt(1) instanceof DERInteger + if (s.getObjectAt(0) instanceof ASN1Boolean + && s.getObjectAt(1) instanceof ASN1Integer && s.getObjectAt(2) instanceof DERBitString && s.getObjectAt(3) instanceof DEROctetString) { @@ -45,24 +45,24 @@ public class SetTest v.add(new DEROctetString(data)); v.add(new DERBitString(data)); - v.add(new DERInteger(100)); - v.add(new DERBoolean(true)); + v.add(new ASN1Integer(100)); + v.add(new ASN1Boolean(true)); checkedSortedSet(0, new DERSet(v)); v = new ASN1EncodableVector(); - v.add(new DERInteger(100)); - v.add(new DERBoolean(true)); + v.add(new ASN1Integer(100)); + v.add(new ASN1Boolean(true)); v.add(new DEROctetString(data)); v.add(new DERBitString(data)); checkedSortedSet(1, new DERSet(v)); v = new ASN1EncodableVector(); - v.add(new DERBoolean(true)); + v.add(new ASN1Boolean(true)); v.add(new DEROctetString(data)); v.add(new DERBitString(data)); - v.add(new DERInteger(100)); + v.add(new ASN1Integer(100)); checkedSortedSet(2, new DERSet(v)); @@ -70,16 +70,16 @@ public class SetTest v = new ASN1EncodableVector(); v.add(new DERBitString(data)); v.add(new DEROctetString(data)); - v.add(new DERInteger(100)); - v.add(new DERBoolean(true)); + v.add(new ASN1Integer(100)); + v.add(new ASN1Boolean(true)); checkedSortedSet(3, new DERSet(v)); v = new ASN1EncodableVector(); v.add(new DEROctetString(data)); v.add(new DERBitString(data)); - v.add(new DERInteger(100)); - v.add(new DERBoolean(true)); + v.add(new ASN1Integer(100)); + v.add(new ASN1Boolean(true)); ASN1Set s = new BERSet(v); @@ -92,7 +92,7 @@ public class SetTest ASN1TaggedObject tag = new DERTaggedObject(false, 1, new DERSequence(v)); s = ASN1Set.getInstance(tag, false); - if (s.getObjectAt(0) instanceof DERBoolean) + if (s.getObjectAt(0) instanceof ASN1Boolean) { fail("sorted when shouldn't be."); } @@ -100,9 +100,9 @@ public class SetTest // equality test v = new ASN1EncodableVector(); - v.add(new DERBoolean(true)); - v.add(new DERBoolean(true)); - v.add(new DERBoolean(true)); + v.add(new ASN1Boolean(true)); + v.add(new ASN1Boolean(true)); + v.add(new ASN1Boolean(true)); s = new DERSet(v); } diff --git a/core/src/test/java/org/bouncycastle/asn1/test/TypeOfBiometricDataUnitTest.java b/core/src/test/java/org/bouncycastle/asn1/test/TypeOfBiometricDataUnitTest.java index 52dfd56f..add21ce3 100644 --- a/core/src/test/java/org/bouncycastle/asn1/test/TypeOfBiometricDataUnitTest.java +++ b/core/src/test/java/org/bouncycastle/asn1/test/TypeOfBiometricDataUnitTest.java @@ -5,7 +5,6 @@ import java.io.IOException; import org.bouncycastle.asn1.ASN1InputStream; import org.bouncycastle.asn1.ASN1ObjectIdentifier; import org.bouncycastle.asn1.ASN1Primitive; -import org.bouncycastle.asn1.DERObjectIdentifier; import org.bouncycastle.asn1.x509.qualified.TypeOfBiometricData; import org.bouncycastle.util.test.SimpleTest; @@ -124,7 +123,7 @@ public class TypeOfBiometricDataUnitTest private void checkNonPredefined( TypeOfBiometricData type, - DERObjectIdentifier value) + ASN1ObjectIdentifier value) { if (type.isPredefined()) { diff --git a/core/src/test/java/org/bouncycastle/asn1/test/X509NameTest.java b/core/src/test/java/org/bouncycastle/asn1/test/X509NameTest.java index 88c95818..a53a5f56 100644 --- a/core/src/test/java/org/bouncycastle/asn1/test/X509NameTest.java +++ b/core/src/test/java/org/bouncycastle/asn1/test/X509NameTest.java @@ -16,7 +16,6 @@ import org.bouncycastle.asn1.ASN1Sequence; import org.bouncycastle.asn1.ASN1Set; import org.bouncycastle.asn1.DERGeneralizedTime; import org.bouncycastle.asn1.DERIA5String; -import org.bouncycastle.asn1.DERObjectIdentifier; import org.bouncycastle.asn1.DERPrintableString; import org.bouncycastle.asn1.DERSequence; import org.bouncycastle.asn1.DERSet; @@ -59,7 +58,7 @@ public class X509NameTest return X509Name.getInstance(new ASN1InputStream(new ByteArrayInputStream(bytes)).readObject()); } - private ASN1Encodable createEntryValue(DERObjectIdentifier oid, String value) + private ASN1Encodable createEntryValue(ASN1ObjectIdentifier oid, String value) { Hashtable attrs = new Hashtable(); @@ -78,7 +77,7 @@ public class X509NameTest return seq.getObjectAt(1); } - private ASN1Encodable createEntryValueFromString(DERObjectIdentifier oid, String value) + private ASN1Encodable createEntryValueFromString(ASN1ObjectIdentifier oid, String value) { Hashtable attrs = new Hashtable(); @@ -97,7 +96,7 @@ public class X509NameTest return seq.getObjectAt(1); } - private void testEncodingPrintableString(DERObjectIdentifier oid, String value) + private void testEncodingPrintableString(ASN1ObjectIdentifier oid, String value) { ASN1Encodable converted = createEntryValue(oid, value); if (!(converted instanceof DERPrintableString)) @@ -106,7 +105,7 @@ public class X509NameTest } } - private void testEncodingIA5String(DERObjectIdentifier oid, String value) + private void testEncodingIA5String(ASN1ObjectIdentifier oid, String value) { ASN1Encodable converted = createEntryValue(oid, value); if (!(converted instanceof DERIA5String)) @@ -116,7 +115,7 @@ public class X509NameTest } - private void testEncodingUTF8String(DERObjectIdentifier oid, String value) + private void testEncodingUTF8String(ASN1ObjectIdentifier oid, String value) throws IOException { ASN1Encodable converted = createEntryValue(oid, value); @@ -130,7 +129,7 @@ public class X509NameTest } } - private void testEncodingGeneralizedTime(DERObjectIdentifier oid, String value) + private void testEncodingGeneralizedTime(ASN1ObjectIdentifier oid, String value) { ASN1Encodable converted = createEntryValue(oid, value); if (!(converted instanceof DERGeneralizedTime)) @@ -431,8 +430,8 @@ public class X509NameTest ASN1EncodableVector v = new ASN1EncodableVector(); - v.add(new DERObjectIdentifier("1.1")); - v.add(new DERObjectIdentifier("1.1")); + v.add(new ASN1ObjectIdentifier("1.1")); + v.add(new ASN1ObjectIdentifier("1.1")); if (name1.equals(new DERSequence(new DERSet(new DERSet(v))))) { fail("inequality test with sequence and bad set"); @@ -455,7 +454,7 @@ public class X509NameTest v = new ASN1EncodableVector(); - v.add(new DERObjectIdentifier("1.1")); + v.add(new ASN1ObjectIdentifier("1.1")); v.add(new DERSequence()); if (name1.equals(new DERSequence(new DERSet(new DERSequence(v))))) diff --git a/pg/src/main/j2me/org/bouncycastle/openpgp/PGPSignature.java b/pg/src/main/j2me/org/bouncycastle/openpgp/PGPSignature.java index 7f20fdc9..e345167a 100644 --- a/pg/src/main/j2me/org/bouncycastle/openpgp/PGPSignature.java +++ b/pg/src/main/j2me/org/bouncycastle/openpgp/PGPSignature.java @@ -6,7 +6,7 @@ import java.io.OutputStream; import java.util.Date; import org.bouncycastle.asn1.ASN1EncodableVector; -import org.bouncycastle.asn1.DERInteger; +import org.bouncycastle.asn1.ASN1Integer; import org.bouncycastle.asn1.DERSequence; import org.bouncycastle.bcpg.BCPGInputStream; import org.bouncycastle.bcpg.BCPGOutputStream; @@ -463,8 +463,8 @@ public class PGPSignature try { ASN1EncodableVector v = new ASN1EncodableVector(); - v.add(new DERInteger(sigValues[0].getValue())); - v.add(new DERInteger(sigValues[1].getValue())); + v.add(new ASN1Integer(sigValues[0].getValue())); + v.add(new ASN1Integer(sigValues[1].getValue())); signature = new DERSequence(v).getEncoded(); } diff --git a/pg/src/main/j2me/org/bouncycastle/openpgp/PGPUtil.java b/pg/src/main/j2me/org/bouncycastle/openpgp/PGPUtil.java index 2bae0cee..fc5dab65 100644 --- a/pg/src/main/j2me/org/bouncycastle/openpgp/PGPUtil.java +++ b/pg/src/main/j2me/org/bouncycastle/openpgp/PGPUtil.java @@ -5,7 +5,7 @@ import java.security.SecureRandom; import org.bouncycastle.asn1.ASN1InputStream; import org.bouncycastle.asn1.ASN1Sequence; -import org.bouncycastle.asn1.DERInteger; +import org.bouncycastle.asn1.ASN1Integer; import org.bouncycastle.bcpg.HashAlgorithmTags; import org.bouncycastle.bcpg.MPInteger; import org.bouncycastle.bcpg.PublicKeyAlgorithmTags; @@ -23,15 +23,15 @@ public class PGPUtil { ASN1InputStream aIn = new ASN1InputStream(encoding); - DERInteger i1; - DERInteger i2; + ASN1Integer i1; + ASN1Integer i2; try { ASN1Sequence s = (ASN1Sequence)aIn.readObject(); - i1 = (DERInteger)s.getObjectAt(0); - i2 = (DERInteger)s.getObjectAt(1); + i1 = (ASN1Integer)s.getObjectAt(0); + i2 = (ASN1Integer)s.getObjectAt(1); } catch (IOException e) { diff --git a/pg/src/main/java/org/bouncycastle/openpgp/PGPUtil.java b/pg/src/main/java/org/bouncycastle/openpgp/PGPUtil.java index ecb3b778..e3e9c438 100644 --- a/pg/src/main/java/org/bouncycastle/openpgp/PGPUtil.java +++ b/pg/src/main/java/org/bouncycastle/openpgp/PGPUtil.java @@ -13,8 +13,8 @@ import java.security.Security; import java.util.Date; import org.bouncycastle.asn1.ASN1InputStream; +import org.bouncycastle.asn1.ASN1Integer; import org.bouncycastle.asn1.ASN1Sequence; -import org.bouncycastle.asn1.DERInteger; import org.bouncycastle.bcpg.ArmoredInputStream; import org.bouncycastle.bcpg.HashAlgorithmTags; import org.bouncycastle.bcpg.MPInteger; @@ -59,15 +59,15 @@ public class PGPUtil { ASN1InputStream aIn = new ASN1InputStream(encoding); - DERInteger i1; - DERInteger i2; + ASN1Integer i1; + ASN1Integer i2; try { ASN1Sequence s = (ASN1Sequence)aIn.readObject(); - i1 = (DERInteger)s.getObjectAt(0); - i2 = (DERInteger)s.getObjectAt(1); + i1 = (ASN1Integer)s.getObjectAt(0); + i2 = (ASN1Integer)s.getObjectAt(1); } catch (IOException e) { diff --git a/pg/src/test/java/org/bouncycastle/openpgp/test/BcPGPPBETest.java b/pg/src/test/java/org/bouncycastle/openpgp/test/BcPGPPBETest.java index 80ca57a0..97fd07e0 100644 --- a/pg/src/test/java/org/bouncycastle/openpgp/test/BcPGPPBETest.java +++ b/pg/src/test/java/org/bouncycastle/openpgp/test/BcPGPPBETest.java @@ -106,6 +106,60 @@ public class BcPGPPBETest return bOut.toByteArray(); } + /** + * decrypt the passed in message stream, verifying the algorithm used. + */ + private byte[] decryptMessageCheck( + int algorithm, + byte[] message, + Date date) + throws Exception + { + PGPObjectFactory pgpF = new PGPObjectFactory(message); + PGPEncryptedDataList enc = (PGPEncryptedDataList)pgpF.nextObject(); + PGPPBEEncryptedData pbe = (PGPPBEEncryptedData)enc.get(0); + + if (algorithm != pbe.getSymmetricAlgorithm(new BcPBEDataDecryptorFactory(pass, new BcPGPDigestCalculatorProvider()))) + { + fail("algorithm mismatch"); + } + + InputStream clear = pbe.getDataStream(new BcPBEDataDecryptorFactory(pass, new BcPGPDigestCalculatorProvider())); + + PGPObjectFactory pgpFact = new PGPObjectFactory(clear); + PGPCompressedData cData = (PGPCompressedData)pgpFact.nextObject(); + + pgpFact = new PGPObjectFactory(cData.getDataStream()); + + PGPLiteralData ld = (PGPLiteralData)pgpFact.nextObject(); + + ByteArrayOutputStream bOut = new ByteArrayOutputStream(); + if (!ld.getFileName().equals("test.txt") + && !ld.getFileName().equals("_CONSOLE")) + { + fail("wrong filename in packet"); + } + if (!ld.getModificationTime().equals(date)) + { + fail("wrong modification time in packet: " + ld.getModificationTime().getTime() + " " + date.getTime()); + } + + InputStream unc = ld.getInputStream(); + int ch; + + while ((ch = unc.read()) >= 0) + { + bOut.write(ch); + } + + if (pbe.isIntegrityProtected() && !pbe.verify()) + { + fail("integrity check failed"); + } + + return bOut.toByteArray(); + } + private byte[] decryptMessageBuffered( byte[] message, Date date) @@ -383,6 +437,52 @@ public class BcPGPPBETest { fail("wrong plain text in buffer generated packet"); } + + tryAlgorithm(PGPEncryptedData.AES_128, text); + //tryAlgorithm(PGPEncryptedData.CAMELLIA_128, text); + } + + private void tryAlgorithm(int algorithm, byte[] text) + throws Exception + { + ByteArrayOutputStream bOut = new ByteArrayOutputStream(); + + PGPCompressedDataGenerator comData = new PGPCompressedDataGenerator( + PGPCompressedData.ZIP); + + Date cDate = new Date((System.currentTimeMillis() / 1000) * 1000); + PGPLiteralDataGenerator lData = new PGPLiteralDataGenerator(); + OutputStream comOut = comData.open(new UncloseableOutputStream(bOut)); + OutputStream ldOut = lData.open( + new UncloseableOutputStream(comOut), + PGPLiteralData.BINARY, + PGPLiteralData.CONSOLE, + text.length, + cDate); + + ldOut.write(text); + + ldOut.close(); + + comOut.close(); + + ByteArrayOutputStream cbOut = new ByteArrayOutputStream(); + PGPEncryptedDataGenerator cPk = new PGPEncryptedDataGenerator(new BcPGPDataEncryptorBuilder(algorithm).setSecureRandom(new SecureRandom())); + + cPk.addMethod(new BcPBEKeyEncryptionMethodGenerator(pass)); + + OutputStream cOut = cPk.open(new UncloseableOutputStream(cbOut), bOut.toByteArray().length); + + cOut.write(bOut.toByteArray()); + + cOut.close(); + + byte[] out = decryptMessageCheck(algorithm, cbOut.toByteArray(), cDate); + + if (!areEqual(out, text)) + { + fail("wrong plain text in generated packet"); + } } public String getName() diff --git a/pkix/src/main/java/org/bouncycastle/cms/CMSAuthenticatedDataParser.java b/pkix/src/main/java/org/bouncycastle/cms/CMSAuthenticatedDataParser.java index 57ea3059..11c90c67 100644 --- a/pkix/src/main/java/org/bouncycastle/cms/CMSAuthenticatedDataParser.java +++ b/pkix/src/main/java/org/bouncycastle/cms/CMSAuthenticatedDataParser.java @@ -109,7 +109,7 @@ public class CMSAuthenticatedDataParser this.authData = new AuthenticatedDataParser((ASN1SequenceParser)_contentInfo.getContent(BERTags.SEQUENCE)); // TODO Validate version? - //DERInteger version = this.authData.getVersion(); + //ASN1Integer version = this.authData.getVersion(); OriginatorInfo info = authData.getOriginatorInfo(); diff --git a/pkix/src/main/java/org/bouncycastle/cms/CMSAuthenticatedDataStreamGenerator.java b/pkix/src/main/java/org/bouncycastle/cms/CMSAuthenticatedDataStreamGenerator.java index 87afd701..f32666d1 100644 --- a/pkix/src/main/java/org/bouncycastle/cms/CMSAuthenticatedDataStreamGenerator.java +++ b/pkix/src/main/java/org/bouncycastle/cms/CMSAuthenticatedDataStreamGenerator.java @@ -9,11 +9,11 @@ import java.util.Map; import org.bouncycastle.asn1.ASN1EncodableVector; import org.bouncycastle.asn1.ASN1Encoding; +import org.bouncycastle.asn1.ASN1Integer; import org.bouncycastle.asn1.ASN1ObjectIdentifier; import org.bouncycastle.asn1.ASN1Set; import org.bouncycastle.asn1.BERSequenceGenerator; import org.bouncycastle.asn1.BERSet; -import org.bouncycastle.asn1.DERInteger; import org.bouncycastle.asn1.DEROctetString; import org.bouncycastle.asn1.DERSet; import org.bouncycastle.asn1.DERTaggedObject; @@ -161,7 +161,7 @@ public class CMSAuthenticatedDataStreamGenerator // BERSequenceGenerator authGen = new BERSequenceGenerator(cGen.getRawOutputStream(), 0, true); - authGen.addObject(new DERInteger(AuthenticatedData.calculateVersion(originatorInfo))); + authGen.addObject(new ASN1Integer(AuthenticatedData.calculateVersion(originatorInfo))); if (originatorInfo != null) { diff --git a/pkix/src/main/java/org/bouncycastle/cms/CMSEnvelopedDataParser.java b/pkix/src/main/java/org/bouncycastle/cms/CMSEnvelopedDataParser.java index defd2f70..67c9d913 100644 --- a/pkix/src/main/java/org/bouncycastle/cms/CMSEnvelopedDataParser.java +++ b/pkix/src/main/java/org/bouncycastle/cms/CMSEnvelopedDataParser.java @@ -78,7 +78,7 @@ public class CMSEnvelopedDataParser this.envelopedData = new EnvelopedDataParser((ASN1SequenceParser)_contentInfo.getContent(BERTags.SEQUENCE)); // TODO Validate version? - //DERInteger version = this._envelopedData.getVersion(); + //ASN1Integer version = this._envelopedData.getVersion(); OriginatorInfo info = this.envelopedData.getOriginatorInfo(); diff --git a/pkix/src/main/java/org/bouncycastle/eac/operator/jcajce/JcaEACSignatureVerifierBuilder.java b/pkix/src/main/java/org/bouncycastle/eac/operator/jcajce/JcaEACSignatureVerifierBuilder.java index c353d1ee..51156423 100644 --- a/pkix/src/main/java/org/bouncycastle/eac/operator/jcajce/JcaEACSignatureVerifierBuilder.java +++ b/pkix/src/main/java/org/bouncycastle/eac/operator/jcajce/JcaEACSignatureVerifierBuilder.java @@ -12,8 +12,8 @@ import java.security.Signature; import java.security.SignatureException; import org.bouncycastle.asn1.ASN1EncodableVector; +import org.bouncycastle.asn1.ASN1Integer; import org.bouncycastle.asn1.ASN1ObjectIdentifier; -import org.bouncycastle.asn1.DERInteger; import org.bouncycastle.asn1.DERSequence; import org.bouncycastle.asn1.eac.EACObjectIdentifiers; import org.bouncycastle.eac.operator.EACSignatureVerifier; @@ -116,8 +116,8 @@ public class JcaEACSignatureVerifierBuilder System.arraycopy(rawSign, len, s, 0, len); ASN1EncodableVector v = new ASN1EncodableVector(); - v.add(new DERInteger(new BigInteger(1, r))); - v.add(new DERInteger(new BigInteger(1, s))); + v.add(new ASN1Integer(new BigInteger(1, r))); + v.add(new ASN1Integer(new BigInteger(1, s))); DERSequence seq = new DERSequence(v); return seq.getEncoded(); diff --git a/pkix/src/main/java/org/bouncycastle/openssl/MiscPEMGenerator.java b/pkix/src/main/java/org/bouncycastle/openssl/MiscPEMGenerator.java index 488b9282..02866883 100644 --- a/pkix/src/main/java/org/bouncycastle/openssl/MiscPEMGenerator.java +++ b/pkix/src/main/java/org/bouncycastle/openssl/MiscPEMGenerator.java @@ -8,7 +8,6 @@ import java.util.List; import org.bouncycastle.asn1.ASN1EncodableVector; import org.bouncycastle.asn1.ASN1Integer; import org.bouncycastle.asn1.ASN1ObjectIdentifier; -import org.bouncycastle.asn1.DERInteger; import org.bouncycastle.asn1.DERSequence; import org.bouncycastle.asn1.cms.ContentInfo; import org.bouncycastle.asn1.oiw.OIWObjectIdentifiers; @@ -21,7 +20,6 @@ import org.bouncycastle.cert.X509AttributeCertificateHolder; import org.bouncycastle.cert.X509CRLHolder; import org.bouncycastle.cert.X509CertificateHolder; import org.bouncycastle.pkcs.PKCS10CertificationRequest; -import org.bouncycastle.pkcs.PKCS8EncryptedPrivateKeyInfo; import org.bouncycastle.util.Strings; import org.bouncycastle.util.io.pem.PemGenerationException; import org.bouncycastle.util.io.pem.PemHeader; @@ -105,16 +103,16 @@ public class MiscPEMGenerator DSAParameter p = DSAParameter.getInstance(info.getPrivateKeyAlgorithm().getParameters()); ASN1EncodableVector v = new ASN1EncodableVector(); - v.add(new DERInteger(0)); - v.add(new DERInteger(p.getP())); - v.add(new DERInteger(p.getQ())); - v.add(new DERInteger(p.getG())); + v.add(new ASN1Integer(0)); + v.add(new ASN1Integer(p.getP())); + v.add(new ASN1Integer(p.getQ())); + v.add(new ASN1Integer(p.getG())); BigInteger x = ASN1Integer.getInstance(info.parsePrivateKey()).getValue(); BigInteger y = p.getG().modPow(x, p.getP()); - v.add(new DERInteger(y)); - v.add(new DERInteger(x)); + v.add(new ASN1Integer(y)); + v.add(new ASN1Integer(x)); encoding = new DERSequence(v).getEncoded(); } diff --git a/pkix/src/main/java/org/bouncycastle/openssl/PEMUtilities.java b/pkix/src/main/java/org/bouncycastle/openssl/PEMUtilities.java index e6bd989d..71b365a9 100644 --- a/pkix/src/main/java/org/bouncycastle/openssl/PEMUtilities.java +++ b/pkix/src/main/java/org/bouncycastle/openssl/PEMUtilities.java @@ -6,7 +6,6 @@ import java.util.Map; import java.util.Set; import org.bouncycastle.asn1.ASN1ObjectIdentifier; -import org.bouncycastle.asn1.DERObjectIdentifier; import org.bouncycastle.asn1.nist.NISTObjectIdentifiers; import org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers; import org.bouncycastle.util.Integers; @@ -48,7 +47,7 @@ public final class PEMUtilities return ((Integer)KEYSIZES.get(algorithm)).intValue(); } - static boolean isPKCS5Scheme1(DERObjectIdentifier algOid) + static boolean isPKCS5Scheme1(ASN1ObjectIdentifier algOid) { return PKCS5_SCHEME_1.contains(algOid); } @@ -58,7 +57,7 @@ public final class PEMUtilities return PKCS5_SCHEME_2.contains(algOid); } - public static boolean isPKCS12(DERObjectIdentifier algOid) + public static boolean isPKCS12(ASN1ObjectIdentifier algOid) { return algOid.getId().startsWith(PKCSObjectIdentifiers.pkcs_12PbeIds.getId()); } diff --git a/pkix/src/main/java/org/bouncycastle/openssl/jcajce/PEMUtilities.java b/pkix/src/main/java/org/bouncycastle/openssl/jcajce/PEMUtilities.java index 49aaa2fe..bf713771 100644 --- a/pkix/src/main/java/org/bouncycastle/openssl/jcajce/PEMUtilities.java +++ b/pkix/src/main/java/org/bouncycastle/openssl/jcajce/PEMUtilities.java @@ -14,7 +14,6 @@ import javax.crypto.spec.RC2ParameterSpec; import javax.crypto.spec.SecretKeySpec; import org.bouncycastle.asn1.ASN1ObjectIdentifier; -import org.bouncycastle.asn1.DERObjectIdentifier; import org.bouncycastle.asn1.nist.NISTObjectIdentifiers; import org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers; import org.bouncycastle.crypto.PBEParametersGenerator; @@ -63,7 +62,7 @@ class PEMUtilities return ((Integer)KEYSIZES.get(algorithm)).intValue(); } - static boolean isPKCS5Scheme1(DERObjectIdentifier algOid) + static boolean isPKCS5Scheme1(ASN1ObjectIdentifier algOid) { return PKCS5_SCHEME_1.contains(algOid); } @@ -73,7 +72,7 @@ class PEMUtilities return PKCS5_SCHEME_2.contains(algOid); } - public static boolean isPKCS12(DERObjectIdentifier algOid) + public static boolean isPKCS12(ASN1ObjectIdentifier algOid) { return algOid.getId().startsWith(PKCSObjectIdentifiers.pkcs_12PbeIds.getId()); } diff --git a/pkix/src/main/java/org/bouncycastle/tsp/GenTimeAccuracy.java b/pkix/src/main/java/org/bouncycastle/tsp/GenTimeAccuracy.java index b48976d2..3cabb86b 100644 --- a/pkix/src/main/java/org/bouncycastle/tsp/GenTimeAccuracy.java +++ b/pkix/src/main/java/org/bouncycastle/tsp/GenTimeAccuracy.java @@ -1,6 +1,6 @@ package org.bouncycastle.tsp; -import org.bouncycastle.asn1.DERInteger; +import org.bouncycastle.asn1.ASN1Integer; import org.bouncycastle.asn1.tsp.Accuracy; public class GenTimeAccuracy @@ -28,7 +28,7 @@ public class GenTimeAccuracy } private int getTimeComponent( - DERInteger time) + ASN1Integer time) { if (time != null) { diff --git a/pkix/src/main/java/org/bouncycastle/tsp/TimeStampRequest.java b/pkix/src/main/java/org/bouncycastle/tsp/TimeStampRequest.java index 696c2d8c..fa7c9f78 100644 --- a/pkix/src/main/java/org/bouncycastle/tsp/TimeStampRequest.java +++ b/pkix/src/main/java/org/bouncycastle/tsp/TimeStampRequest.java @@ -14,7 +14,6 @@ import java.util.Set; import org.bouncycastle.asn1.ASN1InputStream; import org.bouncycastle.asn1.ASN1ObjectIdentifier; -import org.bouncycastle.asn1.DERObjectIdentifier; import org.bouncycastle.asn1.cmp.PKIFailureInfo; import org.bouncycastle.asn1.tsp.TimeStampReq; import org.bouncycastle.asn1.x509.Extension; @@ -162,7 +161,7 @@ public class TimeStampRequest Enumeration en = this.getExtensions().oids(); while(en.hasMoreElements()) { - String oid = ((DERObjectIdentifier)en.nextElement()).getId(); + String oid = ((ASN1ObjectIdentifier)en.nextElement()).getId(); if (!extensions.contains(oid)) { throw new TSPValidationException("request contains unknown extension.", PKIFailureInfo.unacceptedExtension); diff --git a/pkix/src/main/java/org/bouncycastle/tsp/TimeStampResponseGenerator.java b/pkix/src/main/java/org/bouncycastle/tsp/TimeStampResponseGenerator.java index 7b7c7574..8ab68aa4 100644 --- a/pkix/src/main/java/org/bouncycastle/tsp/TimeStampResponseGenerator.java +++ b/pkix/src/main/java/org/bouncycastle/tsp/TimeStampResponseGenerator.java @@ -8,9 +8,9 @@ import java.util.Iterator; import java.util.Set; import org.bouncycastle.asn1.ASN1EncodableVector; +import org.bouncycastle.asn1.ASN1Integer; import org.bouncycastle.asn1.ASN1ObjectIdentifier; import org.bouncycastle.asn1.DERBitString; -import org.bouncycastle.asn1.DERInteger; import org.bouncycastle.asn1.DERSequence; import org.bouncycastle.asn1.DERUTF8String; import org.bouncycastle.asn1.cmp.PKIFailureInfo; @@ -119,7 +119,7 @@ public class TimeStampResponseGenerator { ASN1EncodableVector v = new ASN1EncodableVector(); - v.add(new DERInteger(status)); + v.add(new ASN1Integer(status)); if (statusStrings.size() > 0) { diff --git a/pkix/src/main/jdk1.1/org/bouncycastle/operator/jcajce/JceSymmetricKeyWrapper.java b/pkix/src/main/jdk1.1/org/bouncycastle/operator/jcajce/JceSymmetricKeyWrapper.java index 16c85dca..9e14ad92 100644 --- a/pkix/src/main/jdk1.1/org/bouncycastle/operator/jcajce/JceSymmetricKeyWrapper.java +++ b/pkix/src/main/jdk1.1/org/bouncycastle/operator/jcajce/JceSymmetricKeyWrapper.java @@ -9,9 +9,9 @@ import java.security.InvalidKeyException; import javax.crypto.Cipher; import javax.crypto.SecretKey; -import org.bouncycastle.asn1.DERInteger; +import org.bouncycastle.asn1.ASN1Integer; import org.bouncycastle.asn1.DERNull; -import org.bouncycastle.asn1.DERObjectIdentifier; +import org.bouncycastle.asn1.ASN1ObjectIdentifier; import org.bouncycastle.asn1.kisa.KISAObjectIdentifiers; import org.bouncycastle.asn1.nist.NISTObjectIdentifiers; import org.bouncycastle.asn1.ntt.NTTObjectIdentifiers; @@ -87,18 +87,18 @@ public class JceSymmetricKeyWrapper if (algorithm.startsWith("DES")) { - return new AlgorithmIdentifier(new DERObjectIdentifier( + return new AlgorithmIdentifier(new ASN1ObjectIdentifier( "1.2.840.113549.1.9.16.3.6"), new DERNull()); } else if (algorithm.startsWith("RC2")) { - return new AlgorithmIdentifier(new DERObjectIdentifier( - "1.2.840.113549.1.9.16.3.7"), new DERInteger(58)); + return new AlgorithmIdentifier(new ASN1ObjectIdentifier( + "1.2.840.113549.1.9.16.3.7"), new ASN1Integer(58)); } else if (algorithm.startsWith("AES")) { int length = key.getEncoded().length * 8; - DERObjectIdentifier wrapOid; + ASN1ObjectIdentifier wrapOid; if (length == 128) { @@ -128,7 +128,7 @@ public class JceSymmetricKeyWrapper else if (algorithm.startsWith("Camellia")) { int length = key.getEncoded().length * 8; - DERObjectIdentifier wrapOid; + ASN1ObjectIdentifier wrapOid; if (length == 128) { diff --git a/pkix/src/test/java/org/bouncycastle/cert/test/CertTest.java b/pkix/src/test/java/org/bouncycastle/cert/test/CertTest.java index a11e76e4..30dec302 100644 --- a/pkix/src/test/java/org/bouncycastle/cert/test/CertTest.java +++ b/pkix/src/test/java/org/bouncycastle/cert/test/CertTest.java @@ -39,9 +39,7 @@ import org.bouncycastle.asn1.ASN1EncodableVector; import org.bouncycastle.asn1.ASN1Enumerated; import org.bouncycastle.asn1.ASN1ObjectIdentifier; import org.bouncycastle.asn1.ASN1Primitive; -import org.bouncycastle.asn1.DEREnumerated; import org.bouncycastle.asn1.DERNull; -import org.bouncycastle.asn1.DERObjectIdentifier; import org.bouncycastle.asn1.DEROctetString; import org.bouncycastle.asn1.DERSequence; import org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers; @@ -1775,7 +1773,7 @@ public class CertTest /** * we generate a self signed certificate for the sake of testing - SHA224withECDSA */ - private void createECCert(String algorithm, DERObjectIdentifier algOid) + private void createECCert(String algorithm, ASN1ObjectIdentifier algOid) throws Exception { ECCurve.Fp curve = new ECCurve.Fp( @@ -2030,7 +2028,7 @@ public class CertTest if (ext != null) { - DEREnumerated reasonCode = (DEREnumerated)X509ExtensionUtil.fromExtensionValue(ext); + ASN1Enumerated reasonCode = (ASN1Enumerated)X509ExtensionUtil.fromExtensionValue(ext); if (reasonCode.getValue().intValue() != CRLReason.privilegeWithdrawn) { @@ -2113,7 +2111,7 @@ public class CertTest if (ext != null) { - DEREnumerated reasonCode = (DEREnumerated)X509ExtensionUtil.fromExtensionValue(ext); + ASN1Enumerated reasonCode = (ASN1Enumerated)X509ExtensionUtil.fromExtensionValue(ext); if (reasonCode.getValue().intValue() != CRLReason.privilegeWithdrawn) { diff --git a/pkix/src/test/java/org/bouncycastle/cert/test/PKCS10Test.java b/pkix/src/test/java/org/bouncycastle/cert/test/PKCS10Test.java index c3ca8690..cd3e8af5 100644 --- a/pkix/src/test/java/org/bouncycastle/cert/test/PKCS10Test.java +++ b/pkix/src/test/java/org/bouncycastle/cert/test/PKCS10Test.java @@ -14,7 +14,7 @@ import java.security.spec.RSAPublicKeySpec; import javax.security.auth.x500.X500Principal; -import org.bouncycastle.asn1.DERObjectIdentifier; +import org.bouncycastle.asn1.ASN1ObjectIdentifier; import org.bouncycastle.asn1.DEROctetString; import org.bouncycastle.asn1.cryptopro.CryptoProObjectIdentifiers; import org.bouncycastle.asn1.pkcs.Attribute; @@ -184,7 +184,7 @@ public class PKCS10Test /* * we generate a self signed certificate for the sake of testing - SHA224withECDSA */ - private void createECRequest(String algorithm, DERObjectIdentifier algOid, DERObjectIdentifier curveOid) + private void createECRequest(String algorithm, ASN1ObjectIdentifier algOid, ASN1ObjectIdentifier curveOid) throws Exception { ECNamedCurveParameterSpec spec = ECNamedCurveTable.getParameterSpec(curveOid.getId()); @@ -262,7 +262,7 @@ public class PKCS10Test } } - private void createECRequest(String algorithm, DERObjectIdentifier algOid) + private void createECRequest(String algorithm, ASN1ObjectIdentifier algOid) throws Exception { ECCurve.Fp curve = new ECCurve.Fp( @@ -594,7 +594,7 @@ public class PKCS10Test createECRequest("SHA384withECDSA", X9ObjectIdentifiers.ecdsa_with_SHA384); createECRequest("SHA512withECDSA", X9ObjectIdentifiers.ecdsa_with_SHA512); - createECRequest("SHA1withECDSA", X9ObjectIdentifiers.ecdsa_with_SHA1, new DERObjectIdentifier("1.3.132.0.34")); + createECRequest("SHA1withECDSA", X9ObjectIdentifiers.ecdsa_with_SHA1, new ASN1ObjectIdentifier("1.3.132.0.34")); createECGOSTRequest(); diff --git a/pkix/src/test/java/org/bouncycastle/cms/test/NewAuthenticatedDataTest.java b/pkix/src/test/java/org/bouncycastle/cms/test/NewAuthenticatedDataTest.java index 1c0a80cf..8d788b58 100644 --- a/pkix/src/test/java/org/bouncycastle/cms/test/NewAuthenticatedDataTest.java +++ b/pkix/src/test/java/org/bouncycastle/cms/test/NewAuthenticatedDataTest.java @@ -15,7 +15,6 @@ import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; import org.bouncycastle.asn1.ASN1ObjectIdentifier; -import org.bouncycastle.asn1.DERObjectIdentifier; import org.bouncycastle.asn1.oiw.OIWObjectIdentifiers; import org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers; import org.bouncycastle.asn1.x509.AlgorithmIdentifier; @@ -141,13 +140,13 @@ public class NewAuthenticatedDataTest public void testKEKDESede() throws Exception { - tryKekAlgorithm(CMSTestUtil.makeDesede192Key(), new DERObjectIdentifier("1.2.840.113549.1.9.16.3.6")); + tryKekAlgorithm(CMSTestUtil.makeDesede192Key(), new ASN1ObjectIdentifier("1.2.840.113549.1.9.16.3.6")); } public void testKEKDESedeWithDigest() throws Exception { - tryKekAlgorithmWithDigest(CMSTestUtil.makeDesede192Key(), new DERObjectIdentifier("1.2.840.113549.1.9.16.3.6")); + tryKekAlgorithmWithDigest(CMSTestUtil.makeDesede192Key(), new ASN1ObjectIdentifier("1.2.840.113549.1.9.16.3.6")); } public void testPasswordAES256() @@ -351,7 +350,7 @@ public class NewAuthenticatedDataTest } } - private void tryKekAlgorithm(SecretKey kek, DERObjectIdentifier algOid) + private void tryKekAlgorithm(SecretKey kek, ASN1ObjectIdentifier algOid) throws NoSuchAlgorithmException, NoSuchProviderException, CMSException, OperatorCreationException { byte[] data = "Eric H. Echidna".getBytes(); @@ -390,7 +389,7 @@ public class NewAuthenticatedDataTest } } - private void tryKekAlgorithmWithDigest(SecretKey kek, DERObjectIdentifier algOid) + private void tryKekAlgorithmWithDigest(SecretKey kek, ASN1ObjectIdentifier algOid) throws NoSuchAlgorithmException, NoSuchProviderException, CMSException, OperatorCreationException { byte[] data = "Eric H. Echidna".getBytes(); diff --git a/pkix/src/test/java/org/bouncycastle/tsp/test/TSPTestUtil.java b/pkix/src/test/java/org/bouncycastle/tsp/test/TSPTestUtil.java index 1c3a4418..e9d94262 100644 --- a/pkix/src/test/java/org/bouncycastle/tsp/test/TSPTestUtil.java +++ b/pkix/src/test/java/org/bouncycastle/tsp/test/TSPTestUtil.java @@ -14,7 +14,7 @@ import java.util.Date; import javax.crypto.KeyGenerator; import javax.crypto.SecretKey; -import org.bouncycastle.asn1.DERObjectIdentifier; +import org.bouncycastle.asn1.ASN1ObjectIdentifier; import org.bouncycastle.asn1.x509.AuthorityKeyIdentifier; import org.bouncycastle.asn1.x509.BasicConstraints; import org.bouncycastle.asn1.x509.ExtendedKeyUsage; @@ -47,7 +47,7 @@ public class TSPTestUtil public static final boolean DEBUG = true; - public static DERObjectIdentifier EuroPKI_TSA_Test_Policy = new DERObjectIdentifier( + public static ASN1ObjectIdentifier EuroPKI_TSA_Test_Policy = new ASN1ObjectIdentifier( "1.3.6.1.4.1.5255.5.1"); public static JcaX509ExtensionUtils extUtils; diff --git a/pkix/src/test/jdk1.1/org/bouncycastle/cert/test/CertTest.java b/pkix/src/test/jdk1.1/org/bouncycastle/cert/test/CertTest.java index 1025a4bb..86ed344b 100644 --- a/pkix/src/test/jdk1.1/org/bouncycastle/cert/test/CertTest.java +++ b/pkix/src/test/jdk1.1/org/bouncycastle/cert/test/CertTest.java @@ -36,9 +36,9 @@ import org.bouncycastle.asn1.ASN1EncodableVector; import org.bouncycastle.asn1.ASN1Enumerated; import org.bouncycastle.asn1.ASN1ObjectIdentifier; import org.bouncycastle.asn1.ASN1Primitive; -import org.bouncycastle.asn1.DEREnumerated; +import org.bouncycastle.asn1.ASN1Enumerated; import org.bouncycastle.asn1.DERNull; -import org.bouncycastle.asn1.DERObjectIdentifier; +import org.bouncycastle.asn1.ASN1ObjectIdentifier; import org.bouncycastle.asn1.DEROctetString; import org.bouncycastle.asn1.DERSequence; import org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers; @@ -1775,7 +1775,7 @@ public class CertTest /** * we generate a self signed certificate for the sake of testing - SHA224withECDSA */ - private void createECCert(String algorithm, DERObjectIdentifier algOid) + private void createECCert(String algorithm, ASN1ObjectIdentifier algOid) throws Exception { ECCurve.Fp curve = new ECCurve.Fp( @@ -2030,7 +2030,7 @@ public class CertTest if (ext != null) { - DEREnumerated reasonCode = (DEREnumerated)X509ExtensionUtil.fromExtensionValue(ext); + ASN1Enumerated reasonCode = (ASN1Enumerated)X509ExtensionUtil.fromExtensionValue(ext); if (reasonCode.getValue().intValue() != CRLReason.privilegeWithdrawn) { @@ -2113,7 +2113,7 @@ public class CertTest if (ext != null) { - DEREnumerated reasonCode = (DEREnumerated)X509ExtensionUtil.fromExtensionValue(ext); + ASN1Enumerated reasonCode = (ASN1Enumerated)X509ExtensionUtil.fromExtensionValue(ext); if (reasonCode.getValue().intValue() != CRLReason.privilegeWithdrawn) { diff --git a/pkix/src/test/jdk1.1/org/bouncycastle/cert/test/PKCS10Test.java b/pkix/src/test/jdk1.1/org/bouncycastle/cert/test/PKCS10Test.java index e64c2d1b..48787e0d 100644 --- a/pkix/src/test/jdk1.1/org/bouncycastle/cert/test/PKCS10Test.java +++ b/pkix/src/test/jdk1.1/org/bouncycastle/cert/test/PKCS10Test.java @@ -13,7 +13,7 @@ import java.security.spec.RSAPrivateCrtKeySpec; import java.security.spec.RSAPublicKeySpec; import java.util.Vector; -import org.bouncycastle.asn1.DERObjectIdentifier; +import org.bouncycastle.asn1.ASN1ObjectIdentifier; import org.bouncycastle.asn1.DEROctetString; import org.bouncycastle.asn1.cryptopro.CryptoProObjectIdentifiers; import org.bouncycastle.asn1.pkcs.Attribute; @@ -139,7 +139,7 @@ public class PKCS10Test } } - private void createECRequest(String algorithm, DERObjectIdentifier algOid) + private void createECRequest(String algorithm, ASN1ObjectIdentifier algOid) throws Exception { ECCurve.Fp curve = new ECCurve.Fp( diff --git a/pkix/src/test/jdk1.3/org/bouncycastle/cert/test/CertTest.java b/pkix/src/test/jdk1.3/org/bouncycastle/cert/test/CertTest.java index 4a1f4b2f..2c5a8594 100644 --- a/pkix/src/test/jdk1.3/org/bouncycastle/cert/test/CertTest.java +++ b/pkix/src/test/jdk1.3/org/bouncycastle/cert/test/CertTest.java @@ -36,9 +36,9 @@ import org.bouncycastle.asn1.ASN1EncodableVector; import org.bouncycastle.asn1.ASN1Enumerated; import org.bouncycastle.asn1.ASN1ObjectIdentifier; import org.bouncycastle.asn1.ASN1Primitive; -import org.bouncycastle.asn1.DEREnumerated; +import org.bouncycastle.asn1.ASN1Enumerated; import org.bouncycastle.asn1.DERNull; -import org.bouncycastle.asn1.DERObjectIdentifier; +import org.bouncycastle.asn1.ASN1ObjectIdentifier; import org.bouncycastle.asn1.DEROctetString; import org.bouncycastle.asn1.DERSequence; import org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers; @@ -1775,7 +1775,7 @@ public class CertTest /** * we generate a self signed certificate for the sake of testing - SHA224withECDSA */ - private void createECCert(String algorithm, DERObjectIdentifier algOid) + private void createECCert(String algorithm, ASN1ObjectIdentifier algOid) throws Exception { ECCurve.Fp curve = new ECCurve.Fp( @@ -2030,7 +2030,7 @@ public class CertTest if (ext != null) { - DEREnumerated reasonCode = (DEREnumerated)X509ExtensionUtil.fromExtensionValue(ext); + ASN1Enumerated reasonCode = (ASN1Enumerated)X509ExtensionUtil.fromExtensionValue(ext); if (reasonCode.getValue().intValue() != CRLReason.privilegeWithdrawn) { @@ -2113,7 +2113,7 @@ public class CertTest if (ext != null) { - DEREnumerated reasonCode = (DEREnumerated)X509ExtensionUtil.fromExtensionValue(ext); + ASN1Enumerated reasonCode = (ASN1Enumerated)X509ExtensionUtil.fromExtensionValue(ext); if (reasonCode.getValue().intValue() != CRLReason.privilegeWithdrawn) { diff --git a/pkix/src/test/jdk1.3/org/bouncycastle/cert/test/PKCS10Test.java b/pkix/src/test/jdk1.3/org/bouncycastle/cert/test/PKCS10Test.java index 2cde520d..58838811 100644 --- a/pkix/src/test/jdk1.3/org/bouncycastle/cert/test/PKCS10Test.java +++ b/pkix/src/test/jdk1.3/org/bouncycastle/cert/test/PKCS10Test.java @@ -13,7 +13,7 @@ import java.security.spec.RSAPrivateCrtKeySpec; import java.security.spec.RSAPublicKeySpec; import java.util.Vector; -import org.bouncycastle.asn1.DERObjectIdentifier; +import org.bouncycastle.asn1.ASN1ObjectIdentifier; import org.bouncycastle.asn1.DEROctetString; import org.bouncycastle.asn1.cryptopro.CryptoProObjectIdentifiers; import org.bouncycastle.asn1.pkcs.Attribute; @@ -142,7 +142,7 @@ public class PKCS10Test /* * we generate a self signed certificate for the sake of testing - SHA224withECDSA */ - private void createECRequest(String algorithm, DERObjectIdentifier algOid, DERObjectIdentifier curveOid) + private void createECRequest(String algorithm, ASN1ObjectIdentifier algOid, ASN1ObjectIdentifier curveOid) throws Exception { ECNamedCurveParameterSpec spec = ECNamedCurveTable.getParameterSpec(curveOid.getId()); @@ -220,7 +220,7 @@ public class PKCS10Test } } - private void createECRequest(String algorithm, DERObjectIdentifier algOid) + private void createECRequest(String algorithm, ASN1ObjectIdentifier algOid) throws Exception { ECCurve.Fp curve = new ECCurve.Fp( @@ -556,7 +556,7 @@ public class PKCS10Test createECRequest("SHA384withECDSA", X9ObjectIdentifiers.ecdsa_with_SHA384); createECRequest("SHA512withECDSA", X9ObjectIdentifiers.ecdsa_with_SHA512); - createECRequest("SHA1withECDSA", X9ObjectIdentifiers.ecdsa_with_SHA1, new DERObjectIdentifier("1.3.132.0.34")); + createECRequest("SHA1withECDSA", X9ObjectIdentifiers.ecdsa_with_SHA1, new ASN1ObjectIdentifier("1.3.132.0.34")); createECGOSTRequest(); diff --git a/pkix/src/test/jdk1.4/org/bouncycastle/cert/test/CertTest.java b/pkix/src/test/jdk1.4/org/bouncycastle/cert/test/CertTest.java index b4a3a74e..55686343 100644 --- a/pkix/src/test/jdk1.4/org/bouncycastle/cert/test/CertTest.java +++ b/pkix/src/test/jdk1.4/org/bouncycastle/cert/test/CertTest.java @@ -39,9 +39,9 @@ import org.bouncycastle.asn1.ASN1EncodableVector; import org.bouncycastle.asn1.ASN1Enumerated; import org.bouncycastle.asn1.ASN1ObjectIdentifier; import org.bouncycastle.asn1.ASN1Primitive; -import org.bouncycastle.asn1.DEREnumerated; +import org.bouncycastle.asn1.ASN1Enumerated; import org.bouncycastle.asn1.DERNull; -import org.bouncycastle.asn1.DERObjectIdentifier; +import org.bouncycastle.asn1.ASN1ObjectIdentifier; import org.bouncycastle.asn1.DEROctetString; import org.bouncycastle.asn1.DERSequence; import org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers; @@ -1775,7 +1775,7 @@ public class CertTest /** * we generate a self signed certificate for the sake of testing - SHA224withECDSA */ - private void createECCert(String algorithm, DERObjectIdentifier algOid) + private void createECCert(String algorithm, ASN1ObjectIdentifier algOid) throws Exception { ECCurve.Fp curve = new ECCurve.Fp( @@ -2030,7 +2030,7 @@ public class CertTest if (ext != null) { - DEREnumerated reasonCode = (DEREnumerated)X509ExtensionUtil.fromExtensionValue(ext); + ASN1Enumerated reasonCode = (ASN1Enumerated)X509ExtensionUtil.fromExtensionValue(ext); if (reasonCode.getValue().intValue() != CRLReason.privilegeWithdrawn) { @@ -2113,7 +2113,7 @@ public class CertTest if (ext != null) { - DEREnumerated reasonCode = (DEREnumerated)X509ExtensionUtil.fromExtensionValue(ext); + ASN1Enumerated reasonCode = (ASN1Enumerated)X509ExtensionUtil.fromExtensionValue(ext); if (reasonCode.getValue().intValue() != CRLReason.privilegeWithdrawn) { diff --git a/prov/src/main/java/org/bouncycastle/jcajce/provider/asymmetric/dsa/KeyPairGeneratorSpi.java b/prov/src/main/java/org/bouncycastle/jcajce/provider/asymmetric/dsa/KeyPairGeneratorSpi.java index c6ddf9be..c9981537 100644 --- a/prov/src/main/java/org/bouncycastle/jcajce/provider/asymmetric/dsa/KeyPairGeneratorSpi.java +++ b/prov/src/main/java/org/bouncycastle/jcajce/provider/asymmetric/dsa/KeyPairGeneratorSpi.java @@ -34,9 +34,9 @@ public class KeyPairGeneratorSpi int strength, SecureRandom random) { - if (strength < 512 || strength > 1024 || strength % 64 != 0) + if (strength < 1024 || strength > 4096 || strength % 1024 != 0) { - throw new InvalidParameterException("strength must be from 512 - 1024 and a multiple of 64"); + throw new InvalidParameterException("strength must be from 1024 - 4096 and a multiple of 1024"); } this.strength = strength; diff --git a/prov/src/main/java/org/bouncycastle/jcajce/provider/asymmetric/dstu/BCDSTU4145PrivateKey.java b/prov/src/main/java/org/bouncycastle/jcajce/provider/asymmetric/dstu/BCDSTU4145PrivateKey.java index 9b7e7974..67b151e3 100644 --- a/prov/src/main/java/org/bouncycastle/jcajce/provider/asymmetric/dstu/BCDSTU4145PrivateKey.java +++ b/prov/src/main/java/org/bouncycastle/jcajce/provider/asymmetric/dstu/BCDSTU4145PrivateKey.java @@ -13,12 +13,11 @@ import java.util.Enumeration; import org.bouncycastle.asn1.ASN1Encodable; import org.bouncycastle.asn1.ASN1Encoding; +import org.bouncycastle.asn1.ASN1Integer; import org.bouncycastle.asn1.ASN1ObjectIdentifier; import org.bouncycastle.asn1.ASN1Primitive; import org.bouncycastle.asn1.DERBitString; -import org.bouncycastle.asn1.DERInteger; import org.bouncycastle.asn1.DERNull; -import org.bouncycastle.asn1.DERObjectIdentifier; import org.bouncycastle.asn1.pkcs.PrivateKeyInfo; import org.bouncycastle.asn1.ua.DSTU4145NamedCurves; import org.bouncycastle.asn1.ua.UAObjectIdentifiers; @@ -244,9 +243,9 @@ public class BCDSTU4145PrivateKey } ASN1Encodable privKey = info.parsePrivateKey(); - if (privKey instanceof DERInteger) + if (privKey instanceof ASN1Integer) { - DERInteger derD = DERInteger.getInstance(privKey); + ASN1Integer derD = ASN1Integer.getInstance(privKey); this.d = derD.getValue(); } @@ -286,10 +285,10 @@ public class BCDSTU4145PrivateKey if (ecSpec instanceof ECNamedCurveSpec) { - DERObjectIdentifier curveOid = ECUtil.getNamedCurveOid(((ECNamedCurveSpec)ecSpec).getName()); + ASN1ObjectIdentifier curveOid = ECUtil.getNamedCurveOid(((ECNamedCurveSpec)ecSpec).getName()); if (curveOid == null) // guess it's the OID { - curveOid = new DERObjectIdentifier(((ECNamedCurveSpec)ecSpec).getName()); + curveOid = new ASN1ObjectIdentifier(((ECNamedCurveSpec)ecSpec).getName()); } params = new X962Parameters(curveOid); } diff --git a/prov/src/main/java/org/bouncycastle/jcajce/provider/asymmetric/ecgost/BCECGOST3410PrivateKey.java b/prov/src/main/java/org/bouncycastle/jcajce/provider/asymmetric/ecgost/BCECGOST3410PrivateKey.java index 2b1c3fae..9bcc4d41 100644 --- a/prov/src/main/java/org/bouncycastle/jcajce/provider/asymmetric/ecgost/BCECGOST3410PrivateKey.java +++ b/prov/src/main/java/org/bouncycastle/jcajce/provider/asymmetric/ecgost/BCECGOST3410PrivateKey.java @@ -13,14 +13,13 @@ import java.util.Enumeration; import org.bouncycastle.asn1.ASN1Encodable; import org.bouncycastle.asn1.ASN1Encoding; +import org.bouncycastle.asn1.ASN1Integer; import org.bouncycastle.asn1.ASN1ObjectIdentifier; import org.bouncycastle.asn1.ASN1OctetString; import org.bouncycastle.asn1.ASN1Primitive; import org.bouncycastle.asn1.ASN1Sequence; import org.bouncycastle.asn1.DERBitString; -import org.bouncycastle.asn1.DERInteger; import org.bouncycastle.asn1.DERNull; -import org.bouncycastle.asn1.DERObjectIdentifier; import org.bouncycastle.asn1.DEROctetString; import org.bouncycastle.asn1.cryptopro.CryptoProObjectIdentifiers; import org.bouncycastle.asn1.cryptopro.ECGOST3410NamedCurves; @@ -289,9 +288,9 @@ public class BCECGOST3410PrivateKey } ASN1Encodable privKey = info.parsePrivateKey(); - if (privKey instanceof DERInteger) + if (privKey instanceof ASN1Integer) { - DERInteger derD = DERInteger.getInstance(privKey); + ASN1Integer derD = ASN1Integer.getInstance(privKey); this.d = derD.getValue(); } @@ -351,7 +350,7 @@ public class BCECGOST3410PrivateKey if (ecSpec instanceof ECNamedCurveSpec) { - DERObjectIdentifier curveOid = ECUtil.getNamedCurveOid(((ECNamedCurveSpec)ecSpec).getName()); + ASN1ObjectIdentifier curveOid = ECUtil.getNamedCurveOid(((ECNamedCurveSpec)ecSpec).getName()); if (curveOid == null) // guess it's the OID { curveOid = new ASN1ObjectIdentifier(((ECNamedCurveSpec)ecSpec).getName()); diff --git a/prov/src/main/java/org/bouncycastle/jcajce/provider/asymmetric/elgamal/AlgorithmParametersSpi.java b/prov/src/main/java/org/bouncycastle/jcajce/provider/asymmetric/elgamal/AlgorithmParametersSpi.java index 2c56ee3a..a77f0a40 100644 --- a/prov/src/main/java/org/bouncycastle/jcajce/provider/asymmetric/elgamal/AlgorithmParametersSpi.java +++ b/prov/src/main/java/org/bouncycastle/jcajce/provider/asymmetric/elgamal/AlgorithmParametersSpi.java @@ -8,7 +8,6 @@ import javax.crypto.spec.DHParameterSpec; import org.bouncycastle.asn1.ASN1Encoding; import org.bouncycastle.asn1.ASN1Primitive; -import org.bouncycastle.asn1.ASN1Sequence; import org.bouncycastle.asn1.oiw.ElGamalParameter; import org.bouncycastle.jcajce.provider.symmetric.util.BaseAlgorithmParameters; import org.bouncycastle.jce.spec.ElGamalParameterSpec; @@ -95,7 +94,7 @@ public class AlgorithmParametersSpi { try { - ElGamalParameter elP = new ElGamalParameter((ASN1Sequence)ASN1Primitive.fromByteArray(params)); + ElGamalParameter elP = ElGamalParameter.getInstance(ASN1Primitive.fromByteArray(params)); currentSpec = new ElGamalParameterSpec(elP.getP(), elP.getG()); } diff --git a/prov/src/main/java/org/bouncycastle/jcajce/provider/asymmetric/elgamal/BCElGamalPrivateKey.java b/prov/src/main/java/org/bouncycastle/jcajce/provider/asymmetric/elgamal/BCElGamalPrivateKey.java index 0806b43e..f0f83fa4 100644 --- a/prov/src/main/java/org/bouncycastle/jcajce/provider/asymmetric/elgamal/BCElGamalPrivateKey.java +++ b/prov/src/main/java/org/bouncycastle/jcajce/provider/asymmetric/elgamal/BCElGamalPrivateKey.java @@ -14,8 +14,6 @@ import org.bouncycastle.asn1.ASN1Encodable; import org.bouncycastle.asn1.ASN1Encoding; import org.bouncycastle.asn1.ASN1Integer; import org.bouncycastle.asn1.ASN1ObjectIdentifier; -import org.bouncycastle.asn1.ASN1Sequence; -import org.bouncycastle.asn1.DERInteger; import org.bouncycastle.asn1.oiw.ElGamalParameter; import org.bouncycastle.asn1.oiw.OIWObjectIdentifiers; import org.bouncycastle.asn1.pkcs.PrivateKeyInfo; @@ -73,8 +71,8 @@ public class BCElGamalPrivateKey PrivateKeyInfo info) throws IOException { - ElGamalParameter params = new ElGamalParameter((ASN1Sequence)info.getAlgorithmId().getParameters()); - DERInteger derX = ASN1Integer.getInstance(info.parsePrivateKey()); + ElGamalParameter params = ElGamalParameter.getInstance(info.getPrivateKeyAlgorithm().getParameters()); + ASN1Integer derX = ASN1Integer.getInstance(info.parsePrivateKey()); this.x = derX.getValue(); this.elSpec = new ElGamalParameterSpec(params.getP(), params.getG()); @@ -112,7 +110,7 @@ public class BCElGamalPrivateKey { try { - PrivateKeyInfo info = new PrivateKeyInfo(new AlgorithmIdentifier(OIWObjectIdentifiers.elGamalAlgorithm, new ElGamalParameter(elSpec.getP(), elSpec.getG())), new DERInteger(getX())); + PrivateKeyInfo info = new PrivateKeyInfo(new AlgorithmIdentifier(OIWObjectIdentifiers.elGamalAlgorithm, new ElGamalParameter(elSpec.getP(), elSpec.getG())), new ASN1Integer(getX())); return info.getEncoded(ASN1Encoding.DER); } diff --git a/prov/src/main/java/org/bouncycastle/jcajce/provider/asymmetric/elgamal/BCElGamalPublicKey.java b/prov/src/main/java/org/bouncycastle/jcajce/provider/asymmetric/elgamal/BCElGamalPublicKey.java index e0f72980..cd31cc57 100644 --- a/prov/src/main/java/org/bouncycastle/jcajce/provider/asymmetric/elgamal/BCElGamalPublicKey.java +++ b/prov/src/main/java/org/bouncycastle/jcajce/provider/asymmetric/elgamal/BCElGamalPublicKey.java @@ -10,8 +10,7 @@ import javax.crypto.spec.DHParameterSpec; import javax.crypto.spec.DHPublicKeySpec; import org.bouncycastle.asn1.ASN1Encoding; -import org.bouncycastle.asn1.ASN1Sequence; -import org.bouncycastle.asn1.DERInteger; +import org.bouncycastle.asn1.ASN1Integer; import org.bouncycastle.asn1.oiw.ElGamalParameter; import org.bouncycastle.asn1.oiw.OIWObjectIdentifiers; import org.bouncycastle.asn1.x509.AlgorithmIdentifier; @@ -75,12 +74,12 @@ public class BCElGamalPublicKey BCElGamalPublicKey( SubjectPublicKeyInfo info) { - ElGamalParameter params = new ElGamalParameter((ASN1Sequence)info.getAlgorithmId().getParameters()); - DERInteger derY = null; + ElGamalParameter params = ElGamalParameter.getInstance(info.getAlgorithm().getParameters()); + ASN1Integer derY = null; try { - derY = (DERInteger)info.parsePublicKey(); + derY = (ASN1Integer)info.parsePublicKey(); } catch (IOException e) { @@ -105,7 +104,7 @@ public class BCElGamalPublicKey { try { - SubjectPublicKeyInfo info = new SubjectPublicKeyInfo(new AlgorithmIdentifier(OIWObjectIdentifiers.elGamalAlgorithm, new ElGamalParameter(elSpec.getP(), elSpec.getG())), new DERInteger(y)); + SubjectPublicKeyInfo info = new SubjectPublicKeyInfo(new AlgorithmIdentifier(OIWObjectIdentifiers.elGamalAlgorithm, new ElGamalParameter(elSpec.getP(), elSpec.getG())), new ASN1Integer(y)); return info.getEncoded(ASN1Encoding.DER); } diff --git a/prov/src/main/java/org/bouncycastle/jcajce/provider/asymmetric/ies/AlgorithmParametersSpi.java b/prov/src/main/java/org/bouncycastle/jcajce/provider/asymmetric/ies/AlgorithmParametersSpi.java index 2f39c4ae..61f1e373 100644 --- a/prov/src/main/java/org/bouncycastle/jcajce/provider/asymmetric/ies/AlgorithmParametersSpi.java +++ b/prov/src/main/java/org/bouncycastle/jcajce/provider/asymmetric/ies/AlgorithmParametersSpi.java @@ -6,10 +6,10 @@ import java.security.spec.InvalidParameterSpecException; import org.bouncycastle.asn1.ASN1EncodableVector; import org.bouncycastle.asn1.ASN1Encoding; +import org.bouncycastle.asn1.ASN1Integer; import org.bouncycastle.asn1.ASN1OctetString; import org.bouncycastle.asn1.ASN1Primitive; import org.bouncycastle.asn1.ASN1Sequence; -import org.bouncycastle.asn1.DERInteger; import org.bouncycastle.asn1.DEROctetString; import org.bouncycastle.asn1.DERSequence; import org.bouncycastle.jce.spec.IESParameterSpec; @@ -48,7 +48,7 @@ public class AlgorithmParametersSpi v.add(new DEROctetString(currentSpec.getDerivationV())); v.add(new DEROctetString(currentSpec.getEncodingV())); - v.add(new DERInteger(currentSpec.getMacKeySize())); + v.add(new ASN1Integer(currentSpec.getMacKeySize())); return new DERSequence(v).getEncoded(ASN1Encoding.DER); } @@ -104,7 +104,7 @@ public class AlgorithmParametersSpi this.currentSpec = new IESParameterSpec( ((ASN1OctetString)s.getObjectAt(0)).getOctets(), ((ASN1OctetString)s.getObjectAt(0)).getOctets(), - ((DERInteger)s.getObjectAt(0)).getValue().intValue()); + ((ASN1Integer)s.getObjectAt(0)).getValue().intValue()); } catch (ClassCastException e) { diff --git a/prov/src/main/java/org/bouncycastle/jcajce/provider/asymmetric/util/PKCS12BagAttributeCarrierImpl.java b/prov/src/main/java/org/bouncycastle/jcajce/provider/asymmetric/util/PKCS12BagAttributeCarrierImpl.java index 532554d2..3e328dae 100644 --- a/prov/src/main/java/org/bouncycastle/jcajce/provider/asymmetric/util/PKCS12BagAttributeCarrierImpl.java +++ b/prov/src/main/java/org/bouncycastle/jcajce/provider/asymmetric/util/PKCS12BagAttributeCarrierImpl.java @@ -12,7 +12,6 @@ import org.bouncycastle.asn1.ASN1Encodable; import org.bouncycastle.asn1.ASN1InputStream; import org.bouncycastle.asn1.ASN1ObjectIdentifier; import org.bouncycastle.asn1.ASN1OutputStream; -import org.bouncycastle.asn1.DERObjectIdentifier; import org.bouncycastle.jce.interfaces.PKCS12BagAttributeCarrier; public class PKCS12BagAttributeCarrierImpl @@ -90,7 +89,7 @@ public class PKCS12BagAttributeCarrierImpl while (e.hasMoreElements()) { - DERObjectIdentifier oid = (DERObjectIdentifier)e.nextElement(); + ASN1ObjectIdentifier oid = (ASN1ObjectIdentifier)e.nextElement(); aOut.writeObject(oid); aOut.writeObject((ASN1Encodable)pkcs12Attributes.get(oid)); diff --git a/prov/src/main/java/org/bouncycastle/jcajce/provider/asymmetric/x509/X509SignatureUtil.java b/prov/src/main/java/org/bouncycastle/jcajce/provider/asymmetric/x509/X509SignatureUtil.java index 127b5341..06d30759 100644 --- a/prov/src/main/java/org/bouncycastle/jcajce/provider/asymmetric/x509/X509SignatureUtil.java +++ b/prov/src/main/java/org/bouncycastle/jcajce/provider/asymmetric/x509/X509SignatureUtil.java @@ -11,9 +11,9 @@ import java.security.spec.PSSParameterSpec; import org.bouncycastle.asn1.ASN1Encodable; import org.bouncycastle.asn1.ASN1Null; +import org.bouncycastle.asn1.ASN1ObjectIdentifier; import org.bouncycastle.asn1.ASN1Sequence; import org.bouncycastle.asn1.DERNull; -import org.bouncycastle.asn1.DERObjectIdentifier; import org.bouncycastle.asn1.cryptopro.CryptoProObjectIdentifiers; import org.bouncycastle.asn1.nist.NISTObjectIdentifiers; import org.bouncycastle.asn1.oiw.OIWObjectIdentifiers; @@ -76,7 +76,7 @@ class X509SignatureUtil { ASN1Sequence ecDsaParams = ASN1Sequence.getInstance(params); - return getDigestAlgName((DERObjectIdentifier)ecDsaParams.getObjectAt(0)) + "withECDSA"; + return getDigestAlgName((ASN1ObjectIdentifier)ecDsaParams.getObjectAt(0)) + "withECDSA"; } } @@ -88,7 +88,7 @@ class X509SignatureUtil * representations rather the the algorithm identifier (if possible). */ private static String getDigestAlgName( - DERObjectIdentifier digestAlgOID) + ASN1ObjectIdentifier digestAlgOID) { if (PKCSObjectIdentifiers.md5.equals(digestAlgOID)) { diff --git a/prov/src/main/java/org/bouncycastle/jce/PKCS10CertificationRequest.java b/prov/src/main/java/org/bouncycastle/jce/PKCS10CertificationRequest.java index 2a611e30..13bed1a9 100644 --- a/prov/src/main/java/org/bouncycastle/jce/PKCS10CertificationRequest.java +++ b/prov/src/main/java/org/bouncycastle/jce/PKCS10CertificationRequest.java @@ -24,12 +24,12 @@ import org.bouncycastle.asn1.ASN1Encodable; import org.bouncycastle.asn1.ASN1Encoding; import org.bouncycastle.asn1.ASN1InputStream; import org.bouncycastle.asn1.ASN1Integer; +import org.bouncycastle.asn1.ASN1ObjectIdentifier; import org.bouncycastle.asn1.ASN1Primitive; import org.bouncycastle.asn1.ASN1Sequence; import org.bouncycastle.asn1.ASN1Set; import org.bouncycastle.asn1.DERBitString; import org.bouncycastle.asn1.DERNull; -import org.bouncycastle.asn1.DERObjectIdentifier; import org.bouncycastle.asn1.cryptopro.CryptoProObjectIdentifiers; import org.bouncycastle.asn1.nist.NISTObjectIdentifiers; import org.bouncycastle.asn1.oiw.OIWObjectIdentifiers; @@ -81,13 +81,13 @@ public class PKCS10CertificationRequest static { - algorithms.put("MD2WITHRSAENCRYPTION", new DERObjectIdentifier("1.2.840.113549.1.1.2")); - algorithms.put("MD2WITHRSA", new DERObjectIdentifier("1.2.840.113549.1.1.2")); - algorithms.put("MD5WITHRSAENCRYPTION", new DERObjectIdentifier("1.2.840.113549.1.1.4")); - algorithms.put("MD5WITHRSA", new DERObjectIdentifier("1.2.840.113549.1.1.4")); - algorithms.put("RSAWITHMD5", new DERObjectIdentifier("1.2.840.113549.1.1.4")); - algorithms.put("SHA1WITHRSAENCRYPTION", new DERObjectIdentifier("1.2.840.113549.1.1.5")); - algorithms.put("SHA1WITHRSA", new DERObjectIdentifier("1.2.840.113549.1.1.5")); + algorithms.put("MD2WITHRSAENCRYPTION", new ASN1ObjectIdentifier("1.2.840.113549.1.1.2")); + algorithms.put("MD2WITHRSA", new ASN1ObjectIdentifier("1.2.840.113549.1.1.2")); + algorithms.put("MD5WITHRSAENCRYPTION", new ASN1ObjectIdentifier("1.2.840.113549.1.1.4")); + algorithms.put("MD5WITHRSA", new ASN1ObjectIdentifier("1.2.840.113549.1.1.4")); + algorithms.put("RSAWITHMD5", new ASN1ObjectIdentifier("1.2.840.113549.1.1.4")); + algorithms.put("SHA1WITHRSAENCRYPTION", new ASN1ObjectIdentifier("1.2.840.113549.1.1.5")); + algorithms.put("SHA1WITHRSA", new ASN1ObjectIdentifier("1.2.840.113549.1.1.5")); algorithms.put("SHA224WITHRSAENCRYPTION", PKCSObjectIdentifiers.sha224WithRSAEncryption); algorithms.put("SHA224WITHRSA", PKCSObjectIdentifiers.sha224WithRSAEncryption); algorithms.put("SHA256WITHRSAENCRYPTION", PKCSObjectIdentifiers.sha256WithRSAEncryption); @@ -101,15 +101,15 @@ public class PKCS10CertificationRequest algorithms.put("SHA256WITHRSAANDMGF1", PKCSObjectIdentifiers.id_RSASSA_PSS); algorithms.put("SHA384WITHRSAANDMGF1", PKCSObjectIdentifiers.id_RSASSA_PSS); algorithms.put("SHA512WITHRSAANDMGF1", PKCSObjectIdentifiers.id_RSASSA_PSS); - algorithms.put("RSAWITHSHA1", new DERObjectIdentifier("1.2.840.113549.1.1.5")); + algorithms.put("RSAWITHSHA1", new ASN1ObjectIdentifier("1.2.840.113549.1.1.5")); algorithms.put("RIPEMD128WITHRSAENCRYPTION", TeleTrusTObjectIdentifiers.rsaSignatureWithripemd128); algorithms.put("RIPEMD128WITHRSA", TeleTrusTObjectIdentifiers.rsaSignatureWithripemd128); algorithms.put("RIPEMD160WITHRSAENCRYPTION", TeleTrusTObjectIdentifiers.rsaSignatureWithripemd160); algorithms.put("RIPEMD160WITHRSA", TeleTrusTObjectIdentifiers.rsaSignatureWithripemd160); algorithms.put("RIPEMD256WITHRSAENCRYPTION", TeleTrusTObjectIdentifiers.rsaSignatureWithripemd256); algorithms.put("RIPEMD256WITHRSA", TeleTrusTObjectIdentifiers.rsaSignatureWithripemd256); - algorithms.put("SHA1WITHDSA", new DERObjectIdentifier("1.2.840.10040.4.3")); - algorithms.put("DSAWITHSHA1", new DERObjectIdentifier("1.2.840.10040.4.3")); + algorithms.put("SHA1WITHDSA", new ASN1ObjectIdentifier("1.2.840.10040.4.3")); + algorithms.put("DSAWITHSHA1", new ASN1ObjectIdentifier("1.2.840.10040.4.3")); algorithms.put("SHA224WITHDSA", NISTObjectIdentifiers.dsa_with_sha224); algorithms.put("SHA256WITHDSA", NISTObjectIdentifiers.dsa_with_sha256); algorithms.put("SHA384WITHDSA", NISTObjectIdentifiers.dsa_with_sha384); @@ -129,7 +129,7 @@ public class PKCS10CertificationRequest // // reverse mappings // - oids.put(new DERObjectIdentifier("1.2.840.113549.1.1.5"), "SHA1WITHRSA"); + oids.put(new ASN1ObjectIdentifier("1.2.840.113549.1.1.5"), "SHA1WITHRSA"); oids.put(PKCSObjectIdentifiers.sha224WithRSAEncryption, "SHA224WITHRSA"); oids.put(PKCSObjectIdentifiers.sha256WithRSAEncryption, "SHA256WITHRSA"); oids.put(PKCSObjectIdentifiers.sha384WithRSAEncryption, "SHA384WITHRSA"); @@ -137,9 +137,9 @@ public class PKCS10CertificationRequest oids.put(CryptoProObjectIdentifiers.gostR3411_94_with_gostR3410_94, "GOST3411WITHGOST3410"); oids.put(CryptoProObjectIdentifiers.gostR3411_94_with_gostR3410_2001, "GOST3411WITHECGOST3410"); - oids.put(new DERObjectIdentifier("1.2.840.113549.1.1.4"), "MD5WITHRSA"); - oids.put(new DERObjectIdentifier("1.2.840.113549.1.1.2"), "MD2WITHRSA"); - oids.put(new DERObjectIdentifier("1.2.840.10040.4.3"), "SHA1WITHDSA"); + oids.put(new ASN1ObjectIdentifier("1.2.840.113549.1.1.4"), "MD5WITHRSA"); + oids.put(new ASN1ObjectIdentifier("1.2.840.113549.1.1.2"), "MD2WITHRSA"); + oids.put(new ASN1ObjectIdentifier("1.2.840.10040.4.3"), "SHA1WITHDSA"); oids.put(X9ObjectIdentifiers.ecdsa_with_SHA1, "SHA1WITHECDSA"); oids.put(X9ObjectIdentifiers.ecdsa_with_SHA224, "SHA224WITHECDSA"); oids.put(X9ObjectIdentifiers.ecdsa_with_SHA256, "SHA256WITHECDSA"); @@ -306,13 +306,13 @@ public class PKCS10CertificationRequest InvalidKeyException, SignatureException { String algorithmName = Strings.toUpperCase(signatureAlgorithm); - DERObjectIdentifier sigOID = (DERObjectIdentifier)algorithms.get(algorithmName); + ASN1ObjectIdentifier sigOID = (ASN1ObjectIdentifier)algorithms.get(algorithmName); if (sigOID == null) { try { - sigOID = new DERObjectIdentifier(algorithmName); + sigOID = new ASN1ObjectIdentifier(algorithmName); } catch (Exception e) { @@ -590,7 +590,7 @@ public class PKCS10CertificationRequest } private static String getDigestAlgName( - DERObjectIdentifier digestAlgOID) + ASN1ObjectIdentifier digestAlgOID) { if (PKCSObjectIdentifiers.md5.equals(digestAlgOID)) { diff --git a/prov/src/main/java/org/bouncycastle/jce/PKCS12Util.java b/prov/src/main/java/org/bouncycastle/jce/PKCS12Util.java index c780ed6b..c7059b26 100644 --- a/prov/src/main/java/org/bouncycastle/jce/PKCS12Util.java +++ b/prov/src/main/java/org/bouncycastle/jce/PKCS12Util.java @@ -10,10 +10,10 @@ import javax.crypto.spec.PBEKeySpec; import javax.crypto.spec.PBEParameterSpec; import org.bouncycastle.asn1.ASN1InputStream; +import org.bouncycastle.asn1.ASN1ObjectIdentifier; import org.bouncycastle.asn1.ASN1OctetString; import org.bouncycastle.asn1.ASN1Primitive; import org.bouncycastle.asn1.DERNull; -import org.bouncycastle.asn1.DERObjectIdentifier; import org.bouncycastle.asn1.DEROctetString; import org.bouncycastle.asn1.DEROutputStream; import org.bouncycastle.asn1.pkcs.ContentInfo; @@ -104,7 +104,7 @@ public class PKCS12Util } private static byte[] calculatePbeMac( - DERObjectIdentifier oid, + ASN1ObjectIdentifier oid, byte[] salt, int itCount, char[] password, diff --git a/prov/src/main/java/org/bouncycastle/jce/X509Principal.java b/prov/src/main/java/org/bouncycastle/jce/X509Principal.java index ddd38e87..b1daa98e 100644 --- a/prov/src/main/java/org/bouncycastle/jce/X509Principal.java +++ b/prov/src/main/java/org/bouncycastle/jce/X509Principal.java @@ -129,7 +129,7 @@ public class X509Principal * Takes an X509 dir name as a string of the format "C=AU, ST=Victoria", or * some such, converting it into an ordered set of name attributes. lookUp * should provide a table of lookups, indexed by lowercase only strings and - * yielding a DERObjectIdentifier, other than that OID. and numeric oids + * yielding a ASN1ObjectIdentifier, other than that OID. and numeric oids * will be processed automatically. * <p> * If reverse is true, create the encoded version of the sequence starting diff --git a/prov/src/main/java/org/bouncycastle/jce/examples/PKCS12Example.java b/prov/src/main/java/org/bouncycastle/jce/examples/PKCS12Example.java index fe613df7..4d918fc2 100644 --- a/prov/src/main/java/org/bouncycastle/jce/examples/PKCS12Example.java +++ b/prov/src/main/java/org/bouncycastle/jce/examples/PKCS12Example.java @@ -29,7 +29,7 @@ import org.bouncycastle.x509.extension.AuthorityKeyIdentifierStructure; import org.bouncycastle.x509.extension.SubjectKeyIdentifierStructure; /** - * Example of how to set up a certificiate chain and a PKCS 12 store for + * Example of how to set up a certificate chain and a PKCS 12 store for * a private individual - obviously you'll need to generate your own keys, * and you may need to add a NetscapeCertType extension or add a key * usage extension depending on your application, but you should get the diff --git a/prov/src/main/java/org/bouncycastle/jce/provider/CertPathValidatorUtilities.java b/prov/src/main/java/org/bouncycastle/jce/provider/CertPathValidatorUtilities.java index 9200fdae..a130dc48 100644 --- a/prov/src/main/java/org/bouncycastle/jce/provider/CertPathValidatorUtilities.java +++ b/prov/src/main/java/org/bouncycastle/jce/provider/CertPathValidatorUtilities.java @@ -38,16 +38,16 @@ import java.util.Set; import javax.security.auth.x500.X500Principal; import org.bouncycastle.asn1.ASN1Encodable; +import org.bouncycastle.asn1.ASN1Enumerated; import org.bouncycastle.asn1.ASN1InputStream; import org.bouncycastle.asn1.ASN1Integer; +import org.bouncycastle.asn1.ASN1ObjectIdentifier; import org.bouncycastle.asn1.ASN1OctetString; import org.bouncycastle.asn1.ASN1OutputStream; import org.bouncycastle.asn1.ASN1Primitive; import org.bouncycastle.asn1.ASN1Sequence; -import org.bouncycastle.asn1.DEREnumerated; import org.bouncycastle.asn1.DERGeneralizedTime; import org.bouncycastle.asn1.DERIA5String; -import org.bouncycastle.asn1.DERObjectIdentifier; import org.bouncycastle.asn1.DERSequence; import org.bouncycastle.asn1.isismtt.ISISMTTObjectIdentifiers; import org.bouncycastle.asn1.x509.AlgorithmIdentifier; @@ -455,7 +455,7 @@ public class CertPathValidatorUtilities protected static boolean processCertD1i( int index, List[] policyNodes, - DERObjectIdentifier pOid, + ASN1ObjectIdentifier pOid, Set pq) { List policyNodeVec = policyNodes[index - 1]; @@ -490,7 +490,7 @@ public class CertPathValidatorUtilities protected static void processCertD1ii( int index, List[] policyNodes, - DERObjectIdentifier _poid, + ASN1ObjectIdentifier _poid, Set _pq) { List policyNodeVec = policyNodes[index - 1]; @@ -1017,12 +1017,12 @@ public class CertPathValidatorUtilities } } - DEREnumerated reasonCode = null; + ASN1Enumerated reasonCode = null; if (crl_entry.hasExtensions()) { try { - reasonCode = DEREnumerated + reasonCode = ASN1Enumerated .getInstance(CertPathValidatorUtilities .getExtensionValue(crl_entry, X509Extension.reasonCode.getId())); diff --git a/prov/src/main/java/org/bouncycastle/jce/provider/JCEDHPrivateKey.java b/prov/src/main/java/org/bouncycastle/jce/provider/JCEDHPrivateKey.java index b38f60bb..a30b2df7 100644 --- a/prov/src/main/java/org/bouncycastle/jce/provider/JCEDHPrivateKey.java +++ b/prov/src/main/java/org/bouncycastle/jce/provider/JCEDHPrivateKey.java @@ -12,10 +12,9 @@ import javax.crypto.spec.DHPrivateKeySpec; import org.bouncycastle.asn1.ASN1Encodable; import org.bouncycastle.asn1.ASN1Encoding; +import org.bouncycastle.asn1.ASN1Integer; import org.bouncycastle.asn1.ASN1ObjectIdentifier; import org.bouncycastle.asn1.ASN1Sequence; -import org.bouncycastle.asn1.DERInteger; -import org.bouncycastle.asn1.DERObjectIdentifier; import org.bouncycastle.asn1.pkcs.DHParameter; import org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers; import org.bouncycastle.asn1.pkcs.PrivateKeyInfo; @@ -61,8 +60,8 @@ public class JCEDHPrivateKey throws IOException { ASN1Sequence seq = ASN1Sequence.getInstance(info.getAlgorithmId().getParameters()); - DERInteger derX = DERInteger.getInstance(info.parsePrivateKey()); - DERObjectIdentifier id = info.getAlgorithmId().getAlgorithm(); + ASN1Integer derX = ASN1Integer.getInstance(info.parsePrivateKey()); + ASN1ObjectIdentifier id = info.getAlgorithmId().getAlgorithm(); this.info = info; this.x = derX.getValue(); @@ -129,7 +128,7 @@ public class JCEDHPrivateKey return info.getEncoded(ASN1Encoding.DER); } - PrivateKeyInfo info = new PrivateKeyInfo(new AlgorithmIdentifier(PKCSObjectIdentifiers.dhKeyAgreement, new DHParameter(dhSpec.getP(), dhSpec.getG(), dhSpec.getL())), new DERInteger(getX())); + PrivateKeyInfo info = new PrivateKeyInfo(new AlgorithmIdentifier(PKCSObjectIdentifiers.dhKeyAgreement, new DHParameter(dhSpec.getP(), dhSpec.getG(), dhSpec.getL())), new ASN1Integer(getX())); return info.getEncoded(ASN1Encoding.DER); } diff --git a/prov/src/main/java/org/bouncycastle/jce/provider/JCEDHPublicKey.java b/prov/src/main/java/org/bouncycastle/jce/provider/JCEDHPublicKey.java index 6ff1e083..3e6a09a6 100644 --- a/prov/src/main/java/org/bouncycastle/jce/provider/JCEDHPublicKey.java +++ b/prov/src/main/java/org/bouncycastle/jce/provider/JCEDHPublicKey.java @@ -9,9 +9,9 @@ import javax.crypto.interfaces.DHPublicKey; import javax.crypto.spec.DHParameterSpec; import javax.crypto.spec.DHPublicKeySpec; +import org.bouncycastle.asn1.ASN1Integer; +import org.bouncycastle.asn1.ASN1ObjectIdentifier; import org.bouncycastle.asn1.ASN1Sequence; -import org.bouncycastle.asn1.DERInteger; -import org.bouncycastle.asn1.DERObjectIdentifier; import org.bouncycastle.asn1.pkcs.DHParameter; import org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers; import org.bouncycastle.asn1.x509.AlgorithmIdentifier; @@ -64,10 +64,10 @@ public class JCEDHPublicKey { this.info = info; - DERInteger derY; + ASN1Integer derY; try { - derY = (DERInteger)info.parsePublicKey(); + derY = (ASN1Integer)info.parsePublicKey(); } catch (IOException e) { @@ -77,7 +77,7 @@ public class JCEDHPublicKey this.y = derY.getValue(); ASN1Sequence seq = ASN1Sequence.getInstance(info.getAlgorithmId().getParameters()); - DERObjectIdentifier id = info.getAlgorithmId().getAlgorithm(); + ASN1ObjectIdentifier id = info.getAlgorithmId().getAlgorithm(); // we need the PKCS check to handle older keys marked with the X9 oid. if (id.equals(PKCSObjectIdentifiers.dhKeyAgreement) || isPKCSParam(seq)) @@ -122,7 +122,7 @@ public class JCEDHPublicKey return KeyUtil.getEncodedSubjectPublicKeyInfo(info); } - return KeyUtil.getEncodedSubjectPublicKeyInfo(new AlgorithmIdentifier(PKCSObjectIdentifiers.dhKeyAgreement, new DHParameter(dhSpec.getP(), dhSpec.getG(), dhSpec.getL())), new DERInteger(y)); + return KeyUtil.getEncodedSubjectPublicKeyInfo(new AlgorithmIdentifier(PKCSObjectIdentifiers.dhKeyAgreement, new DHParameter(dhSpec.getP(), dhSpec.getG(), dhSpec.getL())), new ASN1Integer(y)); } public DHParameterSpec getParams() @@ -147,8 +147,8 @@ public class JCEDHPublicKey return false; } - DERInteger l = DERInteger.getInstance(seq.getObjectAt(2)); - DERInteger p = DERInteger.getInstance(seq.getObjectAt(0)); + ASN1Integer l = ASN1Integer.getInstance(seq.getObjectAt(2)); + ASN1Integer p = ASN1Integer.getInstance(seq.getObjectAt(0)); if (l.getValue().compareTo(BigInteger.valueOf(p.getValue().bitLength())) > 0) { diff --git a/prov/src/main/java/org/bouncycastle/jce/provider/JCEECPrivateKey.java b/prov/src/main/java/org/bouncycastle/jce/provider/JCEECPrivateKey.java index 63bb6d89..67e40b40 100644 --- a/prov/src/main/java/org/bouncycastle/jce/provider/JCEECPrivateKey.java +++ b/prov/src/main/java/org/bouncycastle/jce/provider/JCEECPrivateKey.java @@ -13,13 +13,12 @@ import java.util.Enumeration; import org.bouncycastle.asn1.ASN1Encodable; import org.bouncycastle.asn1.ASN1Encoding; +import org.bouncycastle.asn1.ASN1Integer; import org.bouncycastle.asn1.ASN1ObjectIdentifier; import org.bouncycastle.asn1.ASN1Primitive; import org.bouncycastle.asn1.ASN1Sequence; import org.bouncycastle.asn1.DERBitString; -import org.bouncycastle.asn1.DERInteger; import org.bouncycastle.asn1.DERNull; -import org.bouncycastle.asn1.DERObjectIdentifier; import org.bouncycastle.asn1.cryptopro.CryptoProObjectIdentifiers; import org.bouncycastle.asn1.cryptopro.ECGOST3410NamedCurves; import org.bouncycastle.asn1.pkcs.PrivateKeyInfo; @@ -250,9 +249,9 @@ public class JCEECPrivateKey } ASN1Encodable privKey = info.parsePrivateKey(); - if (privKey instanceof DERInteger) + if (privKey instanceof ASN1Integer) { - DERInteger derD = DERInteger.getInstance(privKey); + ASN1Integer derD = ASN1Integer.getInstance(privKey); this.d = derD.getValue(); } @@ -292,10 +291,10 @@ public class JCEECPrivateKey if (ecSpec instanceof ECNamedCurveSpec) { - DERObjectIdentifier curveOid = ECUtil.getNamedCurveOid(((ECNamedCurveSpec)ecSpec).getName()); + ASN1ObjectIdentifier curveOid = ECUtil.getNamedCurveOid(((ECNamedCurveSpec)ecSpec).getName()); if (curveOid == null) // guess it's the OID { - curveOid = new DERObjectIdentifier(((ECNamedCurveSpec)ecSpec).getName()); + curveOid = new ASN1ObjectIdentifier(((ECNamedCurveSpec)ecSpec).getName()); } params = new X962Parameters(curveOid); } diff --git a/prov/src/main/java/org/bouncycastle/jce/provider/JCEElGamalPrivateKey.java b/prov/src/main/java/org/bouncycastle/jce/provider/JCEElGamalPrivateKey.java index afaddfa0..6c21f876 100644 --- a/prov/src/main/java/org/bouncycastle/jce/provider/JCEElGamalPrivateKey.java +++ b/prov/src/main/java/org/bouncycastle/jce/provider/JCEElGamalPrivateKey.java @@ -13,8 +13,6 @@ import javax.crypto.spec.DHPrivateKeySpec; import org.bouncycastle.asn1.ASN1Encodable; import org.bouncycastle.asn1.ASN1Integer; import org.bouncycastle.asn1.ASN1ObjectIdentifier; -import org.bouncycastle.asn1.ASN1Sequence; -import org.bouncycastle.asn1.DERInteger; import org.bouncycastle.asn1.oiw.ElGamalParameter; import org.bouncycastle.asn1.oiw.OIWObjectIdentifiers; import org.bouncycastle.asn1.pkcs.PrivateKeyInfo; @@ -74,8 +72,8 @@ public class JCEElGamalPrivateKey PrivateKeyInfo info) throws IOException { - ElGamalParameter params = new ElGamalParameter((ASN1Sequence)info.getAlgorithmId().getParameters()); - DERInteger derX = ASN1Integer.getInstance(info.parsePrivateKey()); + ElGamalParameter params = ElGamalParameter.getInstance(info.getPrivateKeyAlgorithm().getParameters()); + ASN1Integer derX = ASN1Integer.getInstance(info.parsePrivateKey()); this.x = derX.getValue(); this.elSpec = new ElGamalParameterSpec(params.getP(), params.getG()); @@ -111,7 +109,7 @@ public class JCEElGamalPrivateKey */ public byte[] getEncoded() { - return KeyUtil.getEncodedPrivateKeyInfo(new AlgorithmIdentifier(OIWObjectIdentifiers.elGamalAlgorithm, new ElGamalParameter(elSpec.getP(), elSpec.getG())), new DERInteger(getX())); + return KeyUtil.getEncodedPrivateKeyInfo(new AlgorithmIdentifier(OIWObjectIdentifiers.elGamalAlgorithm, new ElGamalParameter(elSpec.getP(), elSpec.getG())), new ASN1Integer(getX())); } public ElGamalParameterSpec getParameters() diff --git a/prov/src/main/java/org/bouncycastle/jce/provider/JCEElGamalPublicKey.java b/prov/src/main/java/org/bouncycastle/jce/provider/JCEElGamalPublicKey.java index cb7a0abf..30780c85 100644 --- a/prov/src/main/java/org/bouncycastle/jce/provider/JCEElGamalPublicKey.java +++ b/prov/src/main/java/org/bouncycastle/jce/provider/JCEElGamalPublicKey.java @@ -9,8 +9,7 @@ import javax.crypto.interfaces.DHPublicKey; import javax.crypto.spec.DHParameterSpec; import javax.crypto.spec.DHPublicKeySpec; -import org.bouncycastle.asn1.ASN1Sequence; -import org.bouncycastle.asn1.DERInteger; +import org.bouncycastle.asn1.ASN1Integer; import org.bouncycastle.asn1.oiw.ElGamalParameter; import org.bouncycastle.asn1.oiw.OIWObjectIdentifiers; import org.bouncycastle.asn1.x509.AlgorithmIdentifier; @@ -75,12 +74,12 @@ public class JCEElGamalPublicKey JCEElGamalPublicKey( SubjectPublicKeyInfo info) { - ElGamalParameter params = new ElGamalParameter((ASN1Sequence)info.getAlgorithmId().getParameters()); - DERInteger derY = null; + ElGamalParameter params = ElGamalParameter.getInstance(info.getAlgorithm().getParameters()); + ASN1Integer derY = null; try { - derY = (DERInteger)info.parsePublicKey(); + derY = (ASN1Integer)info.parsePublicKey(); } catch (IOException e) { @@ -103,7 +102,7 @@ public class JCEElGamalPublicKey public byte[] getEncoded() { - return KeyUtil.getEncodedSubjectPublicKeyInfo(new AlgorithmIdentifier(OIWObjectIdentifiers.elGamalAlgorithm, new ElGamalParameter(elSpec.getP(), elSpec.getG())), new DERInteger(y)); + return KeyUtil.getEncodedSubjectPublicKeyInfo(new AlgorithmIdentifier(OIWObjectIdentifiers.elGamalAlgorithm, new ElGamalParameter(elSpec.getP(), elSpec.getG())), new ASN1Integer(y)); } public ElGamalParameterSpec getParameters() diff --git a/prov/src/main/java/org/bouncycastle/jce/provider/JDKDSAPrivateKey.java b/prov/src/main/java/org/bouncycastle/jce/provider/JDKDSAPrivateKey.java index 50a714c8..3bd6d307 100644 --- a/prov/src/main/java/org/bouncycastle/jce/provider/JDKDSAPrivateKey.java +++ b/prov/src/main/java/org/bouncycastle/jce/provider/JDKDSAPrivateKey.java @@ -14,8 +14,6 @@ import org.bouncycastle.asn1.ASN1Encodable; import org.bouncycastle.asn1.ASN1Encoding; import org.bouncycastle.asn1.ASN1Integer; import org.bouncycastle.asn1.ASN1ObjectIdentifier; -import org.bouncycastle.asn1.ASN1Sequence; -import org.bouncycastle.asn1.DERInteger; import org.bouncycastle.asn1.pkcs.PrivateKeyInfo; import org.bouncycastle.asn1.x509.AlgorithmIdentifier; import org.bouncycastle.asn1.x509.DSAParameter; @@ -57,7 +55,7 @@ public class JDKDSAPrivateKey throws IOException { DSAParameter params = DSAParameter.getInstance(info.getPrivateKeyAlgorithm().getParameters()); - DERInteger derX = ASN1Integer.getInstance(info.parsePrivateKey()); + ASN1Integer derX = ASN1Integer.getInstance(info.parsePrivateKey()); this.x = derX.getValue(); this.dsaSpec = new DSAParameterSpec(params.getP(), params.getQ(), params.getG()); @@ -95,7 +93,7 @@ public class JDKDSAPrivateKey { try { - PrivateKeyInfo info = new PrivateKeyInfo(new AlgorithmIdentifier(X9ObjectIdentifiers.id_dsa, new DSAParameter(dsaSpec.getP(), dsaSpec.getQ(), dsaSpec.getG())), new DERInteger(getX())); + PrivateKeyInfo info = new PrivateKeyInfo(new AlgorithmIdentifier(X9ObjectIdentifiers.id_dsa, new DSAParameter(dsaSpec.getP(), dsaSpec.getQ(), dsaSpec.getG())), new ASN1Integer(getX())); return info.getEncoded(ASN1Encoding.DER); } diff --git a/prov/src/main/java/org/bouncycastle/jce/provider/JDKDSAPublicKey.java b/prov/src/main/java/org/bouncycastle/jce/provider/JDKDSAPublicKey.java index 85a39a46..80bbf3c5 100644 --- a/prov/src/main/java/org/bouncycastle/jce/provider/JDKDSAPublicKey.java +++ b/prov/src/main/java/org/bouncycastle/jce/provider/JDKDSAPublicKey.java @@ -11,8 +11,7 @@ import java.security.spec.DSAPublicKeySpec; import org.bouncycastle.asn1.ASN1Encodable; import org.bouncycastle.asn1.ASN1Encoding; -import org.bouncycastle.asn1.ASN1Sequence; -import org.bouncycastle.asn1.DERInteger; +import org.bouncycastle.asn1.ASN1Integer; import org.bouncycastle.asn1.DERNull; import org.bouncycastle.asn1.x509.AlgorithmIdentifier; import org.bouncycastle.asn1.x509.DSAParameter; @@ -61,11 +60,11 @@ public class JDKDSAPublicKey SubjectPublicKeyInfo info) { - DERInteger derY; + ASN1Integer derY; try { - derY = (DERInteger)info.parsePublicKey(); + derY = (ASN1Integer)info.parsePublicKey(); } catch (IOException e) { @@ -103,10 +102,10 @@ public class JDKDSAPublicKey { if (dsaSpec == null) { - return new SubjectPublicKeyInfo(new AlgorithmIdentifier(X9ObjectIdentifiers.id_dsa), new DERInteger(y)).getEncoded(ASN1Encoding.DER); + return new SubjectPublicKeyInfo(new AlgorithmIdentifier(X9ObjectIdentifiers.id_dsa), new ASN1Integer(y)).getEncoded(ASN1Encoding.DER); } - return new SubjectPublicKeyInfo(new AlgorithmIdentifier(X9ObjectIdentifiers.id_dsa, new DSAParameter(dsaSpec.getP(), dsaSpec.getQ(), dsaSpec.getG())), new DERInteger(y)).getEncoded(ASN1Encoding.DER); + return new SubjectPublicKeyInfo(new AlgorithmIdentifier(X9ObjectIdentifiers.id_dsa, new DSAParameter(dsaSpec.getP(), dsaSpec.getQ(), dsaSpec.getG())), new ASN1Integer(y)).getEncoded(ASN1Encoding.DER); } catch (IOException e) { diff --git a/prov/src/main/java/org/bouncycastle/jce/provider/PKIXCertPathValidatorSpi.java b/prov/src/main/java/org/bouncycastle/jce/provider/PKIXCertPathValidatorSpi.java index f28a02a7..0e62bfc6 100644 --- a/prov/src/main/java/org/bouncycastle/jce/provider/PKIXCertPathValidatorSpi.java +++ b/prov/src/main/java/org/bouncycastle/jce/provider/PKIXCertPathValidatorSpi.java @@ -21,7 +21,7 @@ import java.util.Set; import javax.security.auth.x500.X500Principal; import org.bouncycastle.asn1.ASN1Encodable; -import org.bouncycastle.asn1.DERObjectIdentifier; +import org.bouncycastle.asn1.ASN1ObjectIdentifier; import org.bouncycastle.asn1.x509.AlgorithmIdentifier; import org.bouncycastle.jce.exception.ExtCertPathValidatorException; import org.bouncycastle.x509.ExtendedPKIXParameters; @@ -218,7 +218,7 @@ public class PKIXCertPathValidatorSpi throw new ExtCertPathValidatorException( "Algorithm identifier of public key of trust anchor could not be read.", e, certPath, -1); } - DERObjectIdentifier workingPublicKeyAlgorithm = workingAlgId.getObjectId(); + ASN1ObjectIdentifier workingPublicKeyAlgorithm = workingAlgId.getAlgorithm(); ASN1Encodable workingPublicKeyParameters = workingAlgId.getParameters(); // @@ -371,7 +371,7 @@ public class PKIXCertPathValidatorSpi workingAlgId = CertPathValidatorUtilities.getAlgorithmIdentifier(workingPublicKey); // (f) - workingPublicKeyAlgorithm = workingAlgId.getObjectId(); + workingPublicKeyAlgorithm = workingAlgId.getAlgorithm(); // (e) workingPublicKeyParameters = workingAlgId.getParameters(); } diff --git a/prov/src/main/java/org/bouncycastle/jce/provider/RFC3280CertPathUtilities.java b/prov/src/main/java/org/bouncycastle/jce/provider/RFC3280CertPathUtilities.java index beb8bfa7..881ceeb9 100644 --- a/prov/src/main/java/org/bouncycastle/jce/provider/RFC3280CertPathUtilities.java +++ b/prov/src/main/java/org/bouncycastle/jce/provider/RFC3280CertPathUtilities.java @@ -33,11 +33,11 @@ import javax.security.auth.x500.X500Principal; import org.bouncycastle.asn1.ASN1Encodable; import org.bouncycastle.asn1.ASN1EncodableVector; import org.bouncycastle.asn1.ASN1InputStream; +import org.bouncycastle.asn1.ASN1Integer; +import org.bouncycastle.asn1.ASN1ObjectIdentifier; import org.bouncycastle.asn1.ASN1Primitive; import org.bouncycastle.asn1.ASN1Sequence; import org.bouncycastle.asn1.ASN1TaggedObject; -import org.bouncycastle.asn1.DERInteger; -import org.bouncycastle.asn1.DERObjectIdentifier; import org.bouncycastle.asn1.DERSequence; import org.bouncycastle.asn1.x509.BasicConstraints; import org.bouncycastle.asn1.x509.CRLDistPoint; @@ -893,8 +893,8 @@ public class RFC3280CertPathUtilities for (int j = 0; j < mappings.size(); j++) { ASN1Sequence mapping = (ASN1Sequence)mappings.getObjectAt(j); - String id_p = ((DERObjectIdentifier)mapping.getObjectAt(0)).getId(); - String sd_p = ((DERObjectIdentifier)mapping.getObjectAt(1)).getId(); + String id_p = ((ASN1ObjectIdentifier)mapping.getObjectAt(0)).getId(); + String sd_p = ((ASN1ObjectIdentifier)mapping.getObjectAt(1)).getId(); Set tmp; if (!m_idp.containsKey(id_p)) @@ -1072,14 +1072,14 @@ public class RFC3280CertPathUtilities for (int j = 0; j < mappings.size(); j++) { - DERObjectIdentifier issuerDomainPolicy = null; - DERObjectIdentifier subjectDomainPolicy = null; + ASN1ObjectIdentifier issuerDomainPolicy = null; + ASN1ObjectIdentifier subjectDomainPolicy = null; try { ASN1Sequence mapping = DERSequence.getInstance(mappings.getObjectAt(j)); - issuerDomainPolicy = DERObjectIdentifier.getInstance(mapping.getObjectAt(0)); - subjectDomainPolicy = DERObjectIdentifier.getInstance(mapping.getObjectAt(1)); + issuerDomainPolicy = ASN1ObjectIdentifier.getInstance(mapping.getObjectAt(0)); + subjectDomainPolicy = ASN1ObjectIdentifier.getInstance(mapping.getObjectAt(1)); } catch (Exception e) { @@ -1286,7 +1286,7 @@ public class RFC3280CertPathUtilities while (e.hasMoreElements()) { PolicyInformation pInfo = PolicyInformation.getInstance(e.nextElement()); - DERObjectIdentifier pOid = pInfo.getPolicyIdentifier(); + ASN1ObjectIdentifier pOid = pInfo.getPolicyIdentifier(); pols.add(pOid.getId()); @@ -1365,9 +1365,9 @@ public class RFC3280CertPathUtilities { _policy = (String)_tmp; } - else if (_tmp instanceof DERObjectIdentifier) + else if (_tmp instanceof ASN1ObjectIdentifier) { - _policy = ((DERObjectIdentifier)_tmp).getId(); + _policy = ((ASN1ObjectIdentifier)_tmp).getId(); } else { @@ -1567,7 +1567,7 @@ public class RFC3280CertPathUtilities ASN1TaggedObject constraint = ASN1TaggedObject.getInstance(policyConstraints.nextElement()); if (constraint.getTagNo() == 0) { - tmpInt = DERInteger.getInstance(constraint, false).getValue().intValue(); + tmpInt = ASN1Integer.getInstance(constraint, false).getValue().intValue(); if (tmpInt < explicitPolicy) { return tmpInt; @@ -1621,7 +1621,7 @@ public class RFC3280CertPathUtilities ASN1TaggedObject constraint = ASN1TaggedObject.getInstance(policyConstraints.nextElement()); if (constraint.getTagNo() == 1) { - tmpInt = DERInteger.getInstance(constraint, false).getValue().intValue(); + tmpInt = ASN1Integer.getInstance(constraint, false).getValue().intValue(); if (tmpInt < policyMapping) { return tmpInt; @@ -2033,10 +2033,10 @@ public class RFC3280CertPathUtilities // // (j) // - DERInteger iap = null; + ASN1Integer iap = null; try { - iap = DERInteger.getInstance(CertPathValidatorUtilities.getExtensionValue(cert, + iap = ASN1Integer.getInstance(CertPathValidatorUtilities.getExtensionValue(cert, RFC3280CertPathUtilities.INHIBIT_ANY_POLICY)); } catch (Exception e) @@ -2339,7 +2339,7 @@ public class RFC3280CertPathUtilities case 0: try { - tmpInt = DERInteger.getInstance(constraint, false).getValue().intValue(); + tmpInt = ASN1Integer.getInstance(constraint, false).getValue().intValue(); } catch (Exception e) { diff --git a/prov/src/main/java/org/bouncycastle/jce/provider/X509AttrCertParser.java b/prov/src/main/java/org/bouncycastle/jce/provider/X509AttrCertParser.java index 847f32bd..08f61c2b 100644 --- a/prov/src/main/java/org/bouncycastle/jce/provider/X509AttrCertParser.java +++ b/prov/src/main/java/org/bouncycastle/jce/provider/X509AttrCertParser.java @@ -8,10 +8,10 @@ import java.util.Collection; import java.util.List; import org.bouncycastle.asn1.ASN1InputStream; +import org.bouncycastle.asn1.ASN1ObjectIdentifier; import org.bouncycastle.asn1.ASN1Sequence; import org.bouncycastle.asn1.ASN1Set; import org.bouncycastle.asn1.ASN1TaggedObject; -import org.bouncycastle.asn1.DERObjectIdentifier; import org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers; import org.bouncycastle.asn1.pkcs.SignedData; import org.bouncycastle.x509.X509AttributeCertificate; @@ -36,7 +36,7 @@ public class X509AttrCertParser ASN1Sequence seq = (ASN1Sequence)dIn.readObject(); if (seq.size() > 1 - && seq.getObjectAt(0) instanceof DERObjectIdentifier) + && seq.getObjectAt(0) instanceof ASN1ObjectIdentifier) { if (seq.getObjectAt(0).equals(PKCSObjectIdentifiers.signedData)) { diff --git a/prov/src/main/java/org/bouncycastle/jce/provider/X509CRLParser.java b/prov/src/main/java/org/bouncycastle/jce/provider/X509CRLParser.java index 40f0a64f..0d1eca72 100644 --- a/prov/src/main/java/org/bouncycastle/jce/provider/X509CRLParser.java +++ b/prov/src/main/java/org/bouncycastle/jce/provider/X509CRLParser.java @@ -10,10 +10,10 @@ import java.util.Collection; import java.util.List; import org.bouncycastle.asn1.ASN1InputStream; +import org.bouncycastle.asn1.ASN1ObjectIdentifier; import org.bouncycastle.asn1.ASN1Sequence; import org.bouncycastle.asn1.ASN1Set; import org.bouncycastle.asn1.ASN1TaggedObject; -import org.bouncycastle.asn1.DERObjectIdentifier; import org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers; import org.bouncycastle.asn1.pkcs.SignedData; import org.bouncycastle.asn1.x509.CertificateList; @@ -37,7 +37,7 @@ public class X509CRLParser ASN1Sequence seq = (ASN1Sequence)dIn.readObject(); if (seq.size() > 1 - && seq.getObjectAt(0) instanceof DERObjectIdentifier) + && seq.getObjectAt(0) instanceof ASN1ObjectIdentifier) { if (seq.getObjectAt(0).equals(PKCSObjectIdentifiers.signedData)) { diff --git a/prov/src/main/java/org/bouncycastle/jce/provider/X509CertParser.java b/prov/src/main/java/org/bouncycastle/jce/provider/X509CertParser.java index a407ba83..0663735b 100644 --- a/prov/src/main/java/org/bouncycastle/jce/provider/X509CertParser.java +++ b/prov/src/main/java/org/bouncycastle/jce/provider/X509CertParser.java @@ -10,10 +10,10 @@ import java.util.Collection; import java.util.List; import org.bouncycastle.asn1.ASN1InputStream; +import org.bouncycastle.asn1.ASN1ObjectIdentifier; import org.bouncycastle.asn1.ASN1Sequence; import org.bouncycastle.asn1.ASN1Set; import org.bouncycastle.asn1.ASN1TaggedObject; -import org.bouncycastle.asn1.DERObjectIdentifier; import org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers; import org.bouncycastle.asn1.pkcs.SignedData; import org.bouncycastle.x509.X509StreamParserSpi; @@ -36,7 +36,7 @@ public class X509CertParser ASN1Sequence seq = (ASN1Sequence)dIn.readObject(); if (seq.size() > 1 - && seq.getObjectAt(0) instanceof DERObjectIdentifier) + && seq.getObjectAt(0) instanceof ASN1ObjectIdentifier) { if (seq.getObjectAt(0).equals(PKCSObjectIdentifiers.signedData)) { diff --git a/prov/src/main/java/org/bouncycastle/jce/provider/X509SignatureUtil.java b/prov/src/main/java/org/bouncycastle/jce/provider/X509SignatureUtil.java index c9a13885..eb1e556e 100644 --- a/prov/src/main/java/org/bouncycastle/jce/provider/X509SignatureUtil.java +++ b/prov/src/main/java/org/bouncycastle/jce/provider/X509SignatureUtil.java @@ -11,9 +11,9 @@ import java.security.spec.PSSParameterSpec; import org.bouncycastle.asn1.ASN1Encodable; import org.bouncycastle.asn1.ASN1Null; +import org.bouncycastle.asn1.ASN1ObjectIdentifier; import org.bouncycastle.asn1.ASN1Sequence; import org.bouncycastle.asn1.DERNull; -import org.bouncycastle.asn1.DERObjectIdentifier; import org.bouncycastle.asn1.cryptopro.CryptoProObjectIdentifiers; import org.bouncycastle.asn1.nist.NISTObjectIdentifiers; import org.bouncycastle.asn1.oiw.OIWObjectIdentifiers; @@ -66,21 +66,21 @@ class X509SignatureUtil if (params != null && !derNull.equals(params)) { - if (sigAlgId.getObjectId().equals(PKCSObjectIdentifiers.id_RSASSA_PSS)) + if (sigAlgId.getAlgorithm().equals(PKCSObjectIdentifiers.id_RSASSA_PSS)) { RSASSAPSSparams rsaParams = RSASSAPSSparams.getInstance(params); - return getDigestAlgName(rsaParams.getHashAlgorithm().getObjectId()) + "withRSAandMGF1"; + return getDigestAlgName(rsaParams.getHashAlgorithm().getAlgorithm()) + "withRSAandMGF1"; } - if (sigAlgId.getObjectId().equals(X9ObjectIdentifiers.ecdsa_with_SHA2)) + if (sigAlgId.getAlgorithm().equals(X9ObjectIdentifiers.ecdsa_with_SHA2)) { ASN1Sequence ecDsaParams = ASN1Sequence.getInstance(params); - return getDigestAlgName((DERObjectIdentifier)ecDsaParams.getObjectAt(0)) + "withECDSA"; + return getDigestAlgName(ASN1ObjectIdentifier.getInstance(ecDsaParams.getObjectAt(0))) + "withECDSA"; } } - return sigAlgId.getObjectId().getId(); + return sigAlgId.getAlgorithm().getId(); } /** @@ -88,7 +88,7 @@ class X509SignatureUtil * representations rather the the algorithm identifier (if possible). */ private static String getDigestAlgName( - DERObjectIdentifier digestAlgOID) + ASN1ObjectIdentifier digestAlgOID) { if (PKCSObjectIdentifiers.md5.equals(digestAlgOID)) { diff --git a/prov/src/main/java/org/bouncycastle/ocsp/BasicOCSPResp.java b/prov/src/main/java/org/bouncycastle/ocsp/BasicOCSPResp.java index b113e2fe..dec8312b 100644 --- a/prov/src/main/java/org/bouncycastle/ocsp/BasicOCSPResp.java +++ b/prov/src/main/java/org/bouncycastle/ocsp/BasicOCSPResp.java @@ -24,9 +24,9 @@ import java.util.Set; import org.bouncycastle.asn1.ASN1Encodable; import org.bouncycastle.asn1.ASN1Encoding; +import org.bouncycastle.asn1.ASN1ObjectIdentifier; import org.bouncycastle.asn1.ASN1OutputStream; import org.bouncycastle.asn1.ASN1Sequence; -import org.bouncycastle.asn1.DERObjectIdentifier; import org.bouncycastle.asn1.ocsp.BasicOCSPResponse; import org.bouncycastle.asn1.ocsp.ResponseData; import org.bouncycastle.asn1.ocsp.SingleResponse; @@ -144,7 +144,7 @@ public class BasicOCSPResp while (e.hasMoreElements()) { - DERObjectIdentifier oid = (DERObjectIdentifier)e.nextElement(); + ASN1ObjectIdentifier oid = (ASN1ObjectIdentifier)e.nextElement(); X509Extension ext = extensions.getExtension(oid); if (critical == ext.isCritical()) @@ -173,7 +173,7 @@ public class BasicOCSPResp if (exts != null) { - X509Extension ext = exts.getExtension(new DERObjectIdentifier(oid)); + X509Extension ext = exts.getExtension(new ASN1ObjectIdentifier(oid)); if (ext != null) { diff --git a/prov/src/main/java/org/bouncycastle/ocsp/BasicOCSPRespGenerator.java b/prov/src/main/java/org/bouncycastle/ocsp/BasicOCSPRespGenerator.java index 841c0c35..1c23cf2b 100644 --- a/prov/src/main/java/org/bouncycastle/ocsp/BasicOCSPRespGenerator.java +++ b/prov/src/main/java/org/bouncycastle/ocsp/BasicOCSPRespGenerator.java @@ -17,12 +17,12 @@ import java.util.List; import org.bouncycastle.asn1.ASN1EncodableVector; import org.bouncycastle.asn1.ASN1Encoding; import org.bouncycastle.asn1.ASN1GeneralizedTime; +import org.bouncycastle.asn1.ASN1ObjectIdentifier; import org.bouncycastle.asn1.ASN1Primitive; import org.bouncycastle.asn1.ASN1Sequence; import org.bouncycastle.asn1.DERBitString; import org.bouncycastle.asn1.DERGeneralizedTime; import org.bouncycastle.asn1.DERNull; -import org.bouncycastle.asn1.DERObjectIdentifier; import org.bouncycastle.asn1.DERSequence; import org.bouncycastle.asn1.ocsp.BasicOCSPResponse; import org.bouncycastle.asn1.ocsp.CertStatus; @@ -211,7 +211,7 @@ public class BasicOCSPRespGenerator throws OCSPException, NoSuchProviderException { Iterator it = list.iterator(); - DERObjectIdentifier signingAlgorithm; + ASN1ObjectIdentifier signingAlgorithm; try { diff --git a/prov/src/main/java/org/bouncycastle/ocsp/CertificateID.java b/prov/src/main/java/org/bouncycastle/ocsp/CertificateID.java index afba340e..87bb461c 100644 --- a/prov/src/main/java/org/bouncycastle/ocsp/CertificateID.java +++ b/prov/src/main/java/org/bouncycastle/ocsp/CertificateID.java @@ -7,9 +7,9 @@ import java.security.cert.X509Certificate; import org.bouncycastle.asn1.ASN1InputStream; import org.bouncycastle.asn1.ASN1Integer; +import org.bouncycastle.asn1.ASN1ObjectIdentifier; import org.bouncycastle.asn1.ASN1OctetString; import org.bouncycastle.asn1.DERNull; -import org.bouncycastle.asn1.DERObjectIdentifier; import org.bouncycastle.asn1.DEROctetString; import org.bouncycastle.asn1.ocsp.CertID; import org.bouncycastle.asn1.x509.AlgorithmIdentifier; @@ -52,7 +52,7 @@ public class CertificateID throws OCSPException { AlgorithmIdentifier hashAlg = new AlgorithmIdentifier( - new DERObjectIdentifier(hashAlgorithm), DERNull.INSTANCE); + new ASN1ObjectIdentifier(hashAlgorithm), DERNull.INSTANCE); this.id = createCertID(hashAlg, issuerCert, new ASN1Integer(number), provider); } diff --git a/prov/src/main/java/org/bouncycastle/ocsp/OCSPReqGenerator.java b/prov/src/main/java/org/bouncycastle/ocsp/OCSPReqGenerator.java index 7de59cf4..0e01e8ec 100644 --- a/prov/src/main/java/org/bouncycastle/ocsp/OCSPReqGenerator.java +++ b/prov/src/main/java/org/bouncycastle/ocsp/OCSPReqGenerator.java @@ -15,12 +15,12 @@ import java.util.List; import javax.security.auth.x500.X500Principal; import org.bouncycastle.asn1.ASN1EncodableVector; +import org.bouncycastle.asn1.ASN1ObjectIdentifier; import org.bouncycastle.asn1.ASN1OutputStream; import org.bouncycastle.asn1.ASN1Primitive; import org.bouncycastle.asn1.ASN1Sequence; import org.bouncycastle.asn1.DERBitString; import org.bouncycastle.asn1.DERNull; -import org.bouncycastle.asn1.DERObjectIdentifier; import org.bouncycastle.asn1.DERSequence; import org.bouncycastle.asn1.ocsp.OCSPRequest; import org.bouncycastle.asn1.ocsp.Request; @@ -117,7 +117,7 @@ public class OCSPReqGenerator } private OCSPReq generateRequest( - DERObjectIdentifier signingAlgorithm, + ASN1ObjectIdentifier signingAlgorithm, PrivateKey key, X509Certificate[] chain, String provider, @@ -272,7 +272,7 @@ public class OCSPReqGenerator try { - DERObjectIdentifier oid = OCSPUtil.getAlgorithmOID(signingAlgorithm); + ASN1ObjectIdentifier oid = OCSPUtil.getAlgorithmOID(signingAlgorithm); return generateRequest(oid, key, chain, provider, random); } diff --git a/prov/src/main/java/org/bouncycastle/ocsp/OCSPUtil.java b/prov/src/main/java/org/bouncycastle/ocsp/OCSPUtil.java index ffb9245c..4f0c5efc 100644 --- a/prov/src/main/java/org/bouncycastle/ocsp/OCSPUtil.java +++ b/prov/src/main/java/org/bouncycastle/ocsp/OCSPUtil.java @@ -1,15 +1,5 @@ package org.bouncycastle.ocsp; -import org.bouncycastle.asn1.DERNull; -import org.bouncycastle.asn1.DERObjectIdentifier; -import org.bouncycastle.asn1.cryptopro.CryptoProObjectIdentifiers; -import org.bouncycastle.asn1.nist.NISTObjectIdentifiers; -import org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers; -import org.bouncycastle.asn1.teletrust.TeleTrusTObjectIdentifiers; -import org.bouncycastle.asn1.x509.AlgorithmIdentifier; -import org.bouncycastle.asn1.x9.X9ObjectIdentifiers; -import org.bouncycastle.util.Strings; - import java.security.InvalidAlgorithmParameterException; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; @@ -27,6 +17,16 @@ import java.util.Iterator; import java.util.List; import java.util.Set; +import org.bouncycastle.asn1.ASN1ObjectIdentifier; +import org.bouncycastle.asn1.DERNull; +import org.bouncycastle.asn1.cryptopro.CryptoProObjectIdentifiers; +import org.bouncycastle.asn1.nist.NISTObjectIdentifiers; +import org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers; +import org.bouncycastle.asn1.teletrust.TeleTrusTObjectIdentifiers; +import org.bouncycastle.asn1.x509.AlgorithmIdentifier; +import org.bouncycastle.asn1.x9.X9ObjectIdentifiers; +import org.bouncycastle.util.Strings; + class OCSPUtil { private static Hashtable algorithms = new Hashtable(); @@ -102,21 +102,21 @@ class OCSPUtil noParams.add(NISTObjectIdentifiers.dsa_with_sha256); } - static DERObjectIdentifier getAlgorithmOID( + static ASN1ObjectIdentifier getAlgorithmOID( String algorithmName) { algorithmName = Strings.toUpperCase(algorithmName); if (algorithms.containsKey(algorithmName)) { - return (DERObjectIdentifier)algorithms.get(algorithmName); + return (ASN1ObjectIdentifier)algorithms.get(algorithmName); } - return new DERObjectIdentifier(algorithmName); + return new ASN1ObjectIdentifier(algorithmName); } static String getAlgorithmName( - DERObjectIdentifier oid) + ASN1ObjectIdentifier oid) { if (oids.containsKey(oid)) { @@ -127,7 +127,7 @@ class OCSPUtil } static AlgorithmIdentifier getSigAlgID( - DERObjectIdentifier sigOid) + ASN1ObjectIdentifier sigOid) { if (noParams.contains(sigOid)) { diff --git a/prov/src/main/java/org/bouncycastle/ocsp/Req.java b/prov/src/main/java/org/bouncycastle/ocsp/Req.java index 8acf019d..c5f472a5 100644 --- a/prov/src/main/java/org/bouncycastle/ocsp/Req.java +++ b/prov/src/main/java/org/bouncycastle/ocsp/Req.java @@ -5,7 +5,7 @@ import java.util.HashSet; import java.util.Set; import org.bouncycastle.asn1.ASN1Encoding; -import org.bouncycastle.asn1.DERObjectIdentifier; +import org.bouncycastle.asn1.ASN1ObjectIdentifier; import org.bouncycastle.asn1.ocsp.Request; import org.bouncycastle.asn1.x509.X509Extension; import org.bouncycastle.asn1.x509.X509Extensions; @@ -59,7 +59,7 @@ public class Req while (e.hasMoreElements()) { - DERObjectIdentifier oid = (DERObjectIdentifier)e.nextElement(); + ASN1ObjectIdentifier oid = (ASN1ObjectIdentifier)e.nextElement(); X509Extension ext = extensions.getExtension(oid); if (critical == ext.isCritical()) @@ -88,7 +88,7 @@ public class Req if (exts != null) { - X509Extension ext = exts.getExtension(new DERObjectIdentifier(oid)); + X509Extension ext = exts.getExtension(new ASN1ObjectIdentifier(oid)); if (ext != null) { diff --git a/prov/src/main/java/org/bouncycastle/ocsp/RespData.java b/prov/src/main/java/org/bouncycastle/ocsp/RespData.java index 027e7a20..4b973bbd 100644 --- a/prov/src/main/java/org/bouncycastle/ocsp/RespData.java +++ b/prov/src/main/java/org/bouncycastle/ocsp/RespData.java @@ -7,8 +7,8 @@ import java.util.HashSet; import java.util.Set; import org.bouncycastle.asn1.ASN1Encoding; +import org.bouncycastle.asn1.ASN1ObjectIdentifier; import org.bouncycastle.asn1.ASN1Sequence; -import org.bouncycastle.asn1.DERObjectIdentifier; import org.bouncycastle.asn1.ocsp.ResponseData; import org.bouncycastle.asn1.ocsp.SingleResponse; import org.bouncycastle.asn1.x509.X509Extension; @@ -93,7 +93,7 @@ public class RespData while (e.hasMoreElements()) { - DERObjectIdentifier oid = (DERObjectIdentifier)e.nextElement(); + ASN1ObjectIdentifier oid = (ASN1ObjectIdentifier)e.nextElement(); X509Extension ext = extensions.getExtension(oid); if (critical == ext.isCritical()) @@ -122,7 +122,7 @@ public class RespData if (exts != null) { - X509Extension ext = exts.getExtension(new DERObjectIdentifier(oid)); + X509Extension ext = exts.getExtension(new ASN1ObjectIdentifier(oid)); if (ext != null) { diff --git a/prov/src/main/java/org/bouncycastle/ocsp/SingleResp.java b/prov/src/main/java/org/bouncycastle/ocsp/SingleResp.java index a378e3b5..da640923 100644 --- a/prov/src/main/java/org/bouncycastle/ocsp/SingleResp.java +++ b/prov/src/main/java/org/bouncycastle/ocsp/SingleResp.java @@ -7,7 +7,7 @@ import java.util.HashSet; import java.util.Set; import org.bouncycastle.asn1.ASN1Encoding; -import org.bouncycastle.asn1.DERObjectIdentifier; +import org.bouncycastle.asn1.ASN1ObjectIdentifier; import org.bouncycastle.asn1.ocsp.CertStatus; import org.bouncycastle.asn1.ocsp.RevokedInfo; import org.bouncycastle.asn1.ocsp.SingleResponse; @@ -115,7 +115,7 @@ public class SingleResp while (e.hasMoreElements()) { - DERObjectIdentifier oid = (DERObjectIdentifier)e.nextElement(); + ASN1ObjectIdentifier oid = (ASN1ObjectIdentifier)e.nextElement(); X509Extension ext = extensions.getExtension(oid); if (critical == ext.isCritical()) @@ -144,7 +144,7 @@ public class SingleResp if (exts != null) { - X509Extension ext = exts.getExtension(new DERObjectIdentifier(oid)); + X509Extension ext = exts.getExtension(new ASN1ObjectIdentifier(oid)); if (ext != null) { diff --git a/prov/src/main/java/org/bouncycastle/x509/PKIXCertPathReviewer.java b/prov/src/main/java/org/bouncycastle/x509/PKIXCertPathReviewer.java index 14c06a81..528fbec4 100644 --- a/prov/src/main/java/org/bouncycastle/x509/PKIXCertPathReviewer.java +++ b/prov/src/main/java/org/bouncycastle/x509/PKIXCertPathReviewer.java @@ -37,15 +37,15 @@ import java.util.Vector; import javax.security.auth.x500.X500Principal; import org.bouncycastle.asn1.ASN1Encodable; +import org.bouncycastle.asn1.ASN1Enumerated; import org.bouncycastle.asn1.ASN1InputStream; +import org.bouncycastle.asn1.ASN1Integer; +import org.bouncycastle.asn1.ASN1ObjectIdentifier; import org.bouncycastle.asn1.ASN1OctetString; import org.bouncycastle.asn1.ASN1Primitive; import org.bouncycastle.asn1.ASN1Sequence; import org.bouncycastle.asn1.ASN1TaggedObject; -import org.bouncycastle.asn1.DEREnumerated; import org.bouncycastle.asn1.DERIA5String; -import org.bouncycastle.asn1.DERInteger; -import org.bouncycastle.asn1.DERObjectIdentifier; import org.bouncycastle.asn1.DEROctetString; import org.bouncycastle.asn1.x509.AccessDescription; import org.bouncycastle.asn1.x509.AlgorithmIdentifier; @@ -809,7 +809,7 @@ public class PKIXCertPathReviewer extends CertPathValidatorUtilities X509Certificate sign = null; AlgorithmIdentifier workingAlgId = null; - DERObjectIdentifier workingPublicKeyAlgorithm = null; + ASN1ObjectIdentifier workingPublicKeyAlgorithm = null; ASN1Encodable workingPublicKeyParameters = null; if (trust != null) @@ -1215,7 +1215,7 @@ public class PKIXCertPathReviewer extends CertPathValidatorUtilities while (e.hasMoreElements()) { PolicyInformation pInfo = PolicyInformation.getInstance(e.nextElement()); - DERObjectIdentifier pOid = pInfo.getPolicyIdentifier(); + ASN1ObjectIdentifier pOid = pInfo.getPolicyIdentifier(); pols.add(pOid.getId()); @@ -1301,9 +1301,9 @@ public class PKIXCertPathReviewer extends CertPathValidatorUtilities { _policy = (String) _tmp; } - else if (_tmp instanceof DERObjectIdentifier) + else if (_tmp instanceof ASN1ObjectIdentifier) { - _policy = ((DERObjectIdentifier) _tmp).getId(); + _policy = ((ASN1ObjectIdentifier) _tmp).getId(); } else { @@ -1425,8 +1425,8 @@ public class PKIXCertPathReviewer extends CertPathValidatorUtilities for (int j = 0; j < mappings.size(); j++) { ASN1Sequence mapping = (ASN1Sequence) mappings.getObjectAt(j); - DERObjectIdentifier ip_id = (DERObjectIdentifier) mapping.getObjectAt(0); - DERObjectIdentifier sp_id = (DERObjectIdentifier) mapping.getObjectAt(1); + ASN1ObjectIdentifier ip_id = (ASN1ObjectIdentifier) mapping.getObjectAt(0); + ASN1ObjectIdentifier sp_id = (ASN1ObjectIdentifier) mapping.getObjectAt(1); if (ANY_POLICY.equals(ip_id.getId())) { ErrorBundle msg = new ErrorBundle(RESOURCE_NAME,"CertPathReviewer.invalidPolicyMapping"); @@ -1451,8 +1451,8 @@ public class PKIXCertPathReviewer extends CertPathValidatorUtilities for (int j = 0; j < mappings.size(); j++) { ASN1Sequence mapping = (ASN1Sequence)mappings.getObjectAt(j); - String id_p = ((DERObjectIdentifier)mapping.getObjectAt(0)).getId(); - String sd_p = ((DERObjectIdentifier)mapping.getObjectAt(1)).getId(); + String id_p = ((ASN1ObjectIdentifier)mapping.getObjectAt(0)).getId(); + String sd_p = ((ASN1ObjectIdentifier)mapping.getObjectAt(1)).getId(); Set tmp; if (!m_idp.containsKey(id_p)) @@ -1554,14 +1554,14 @@ public class PKIXCertPathReviewer extends CertPathValidatorUtilities switch (constraint.getTagNo()) { case 0: - tmpInt = DERInteger.getInstance(constraint, false).getValue().intValue(); + tmpInt = ASN1Integer.getInstance(constraint, false).getValue().intValue(); if (tmpInt < explicitPolicy) { explicitPolicy = tmpInt; } break; case 1: - tmpInt = DERInteger.getInstance(constraint, false).getValue().intValue(); + tmpInt = ASN1Integer.getInstance(constraint, false).getValue().intValue(); if (tmpInt < policyMapping) { policyMapping = tmpInt; @@ -1583,7 +1583,7 @@ public class PKIXCertPathReviewer extends CertPathValidatorUtilities try { - DERInteger iap = (DERInteger)getExtensionValue(cert, INHIBIT_ANY_POLICY); + ASN1Integer iap = (ASN1Integer)getExtensionValue(cert, INHIBIT_ANY_POLICY); if (iap != null) { @@ -1634,7 +1634,7 @@ public class PKIXCertPathReviewer extends CertPathValidatorUtilities switch (constraint.getTagNo()) { case 0: - int tmpInt = DERInteger.getInstance(constraint, false).getValue().intValue(); + int tmpInt = ASN1Integer.getInstance(constraint, false).getValue().intValue(); if (tmpInt == 0) { explicitPolicy = 0; @@ -1906,7 +1906,7 @@ public class PKIXCertPathReviewer extends CertPathValidatorUtilities while (it.hasNext()) { msg = new ErrorBundle(RESOURCE_NAME,"CertPathReviewer.unknownCriticalExt", - new Object[] {new DERObjectIdentifier((String) it.next())}); + new Object[] {new ASN1ObjectIdentifier((String) it.next())}); addError(msg, index); } } @@ -2206,10 +2206,10 @@ public class PKIXCertPathReviewer extends CertPathValidatorUtilities if (crl_entry.hasExtensions()) { - DEREnumerated reasonCode; + ASN1Enumerated reasonCode; try { - reasonCode = DEREnumerated.getInstance(getExtensionValue(crl_entry, X509Extensions.ReasonCode.getId())); + reasonCode = ASN1Enumerated.getInstance(getExtensionValue(crl_entry, X509Extensions.ReasonCode.getId())); } catch (AnnotatedException ae) { @@ -2297,10 +2297,10 @@ public class PKIXCertPathReviewer extends CertPathValidatorUtilities throw new CertPathReviewerException(msg,e); } - baseSelect.setMinCRLNumber(((DERInteger)dci).getPositiveValue()); + baseSelect.setMinCRLNumber(((ASN1Integer)dci).getPositiveValue()); try { - baseSelect.setMaxCRLNumber(((DERInteger)getExtensionValue(crl, CRL_NUMBER)).getPositiveValue().subtract(BigInteger.valueOf(1))); + baseSelect.setMaxCRLNumber(((ASN1Integer)getExtensionValue(crl, CRL_NUMBER)).getPositiveValue().subtract(BigInteger.valueOf(1))); } catch (AnnotatedException ae) { diff --git a/prov/src/main/java/org/bouncycastle/x509/X509CRLStoreSelector.java b/prov/src/main/java/org/bouncycastle/x509/X509CRLStoreSelector.java index cc50b8f2..2486d208 100644 --- a/prov/src/main/java/org/bouncycastle/x509/X509CRLStoreSelector.java +++ b/prov/src/main/java/org/bouncycastle/x509/X509CRLStoreSelector.java @@ -1,17 +1,17 @@ package org.bouncycastle.x509; -import org.bouncycastle.asn1.DERInteger; -import org.bouncycastle.asn1.x509.X509Extensions; -import org.bouncycastle.util.Arrays; -import org.bouncycastle.util.Selector; -import org.bouncycastle.x509.extension.X509ExtensionUtil; - import java.io.IOException; import java.math.BigInteger; import java.security.cert.CRL; import java.security.cert.X509CRL; import java.security.cert.X509CRLSelector; +import org.bouncycastle.asn1.ASN1Integer; +import org.bouncycastle.asn1.x509.X509Extensions; +import org.bouncycastle.util.Arrays; +import org.bouncycastle.util.Selector; +import org.bouncycastle.x509.extension.X509ExtensionUtil; + /** * This class is a Selector implementation for X.509 certificate revocation * lists. @@ -96,14 +96,14 @@ public class X509CRLStoreSelector return false; } X509CRL crl = (X509CRL)obj; - DERInteger dci = null; + ASN1Integer dci = null; try { byte[] bytes = crl .getExtensionValue(X509Extensions.DeltaCRLIndicator.getId()); if (bytes != null) { - dci = DERInteger.getInstance(X509ExtensionUtil + dci = ASN1Integer.getInstance(X509ExtensionUtil .fromExtensionValue(bytes)); } } diff --git a/prov/src/main/java/org/bouncycastle/x509/X509Util.java b/prov/src/main/java/org/bouncycastle/x509/X509Util.java index e5c99265..d002111e 100644 --- a/prov/src/main/java/org/bouncycastle/x509/X509Util.java +++ b/prov/src/main/java/org/bouncycastle/x509/X509Util.java @@ -23,8 +23,8 @@ import javax.security.auth.x500.X500Principal; import org.bouncycastle.asn1.ASN1Encodable; import org.bouncycastle.asn1.ASN1Encoding; import org.bouncycastle.asn1.ASN1Integer; +import org.bouncycastle.asn1.ASN1ObjectIdentifier; import org.bouncycastle.asn1.DERNull; -import org.bouncycastle.asn1.DERObjectIdentifier; import org.bouncycastle.asn1.cryptopro.CryptoProObjectIdentifiers; import org.bouncycastle.asn1.nist.NISTObjectIdentifiers; import org.bouncycastle.asn1.oiw.OIWObjectIdentifiers; @@ -136,21 +136,21 @@ class X509Util new ASN1Integer(1)); } - static DERObjectIdentifier getAlgorithmOID( + static ASN1ObjectIdentifier getAlgorithmOID( String algorithmName) { algorithmName = Strings.toUpperCase(algorithmName); if (algorithms.containsKey(algorithmName)) { - return (DERObjectIdentifier)algorithms.get(algorithmName); + return (ASN1ObjectIdentifier)algorithms.get(algorithmName); } - return new DERObjectIdentifier(algorithmName); + return new ASN1ObjectIdentifier(algorithmName); } static AlgorithmIdentifier getSigAlgID( - DERObjectIdentifier sigOid, + ASN1ObjectIdentifier sigOid, String algorithmName) { if (noParams.contains(sigOid)) @@ -206,7 +206,7 @@ class X509Util } static byte[] calculateSignature( - DERObjectIdentifier sigOid, + ASN1ObjectIdentifier sigOid, String sigName, PrivateKey key, SecureRandom random, @@ -237,7 +237,7 @@ class X509Util } static byte[] calculateSignature( - DERObjectIdentifier sigOid, + ASN1ObjectIdentifier sigOid, String sigName, String provider, PrivateKey key, diff --git a/prov/src/main/java/org/bouncycastle/x509/X509V1CertificateGenerator.java b/prov/src/main/java/org/bouncycastle/x509/X509V1CertificateGenerator.java index ac44d731..f7ff3e43 100644 --- a/prov/src/main/java/org/bouncycastle/x509/X509V1CertificateGenerator.java +++ b/prov/src/main/java/org/bouncycastle/x509/X509V1CertificateGenerator.java @@ -22,9 +22,9 @@ import javax.security.auth.x500.X500Principal; import org.bouncycastle.asn1.ASN1EncodableVector; import org.bouncycastle.asn1.ASN1InputStream; import org.bouncycastle.asn1.ASN1Integer; +import org.bouncycastle.asn1.ASN1ObjectIdentifier; import org.bouncycastle.asn1.ASN1Sequence; import org.bouncycastle.asn1.DERBitString; -import org.bouncycastle.asn1.DERObjectIdentifier; import org.bouncycastle.asn1.DERSequence; import org.bouncycastle.asn1.x509.AlgorithmIdentifier; import org.bouncycastle.asn1.x509.Certificate; @@ -43,7 +43,7 @@ import org.bouncycastle.jce.provider.X509CertificateObject; public class X509V1CertificateGenerator { private V1TBSCertificateGenerator tbsGen; - private DERObjectIdentifier sigOID; + private ASN1ObjectIdentifier sigOID; private AlgorithmIdentifier sigAlgId; private String signatureAlgorithm; diff --git a/prov/src/main/java/org/bouncycastle/x509/X509V2AttributeCertificateGenerator.java b/prov/src/main/java/org/bouncycastle/x509/X509V2AttributeCertificateGenerator.java index 24a0f2b3..c8624faf 100644 --- a/prov/src/main/java/org/bouncycastle/x509/X509V2AttributeCertificateGenerator.java +++ b/prov/src/main/java/org/bouncycastle/x509/X509V2AttributeCertificateGenerator.java @@ -19,7 +19,6 @@ import org.bouncycastle.asn1.ASN1GeneralizedTime; import org.bouncycastle.asn1.ASN1Integer; import org.bouncycastle.asn1.ASN1ObjectIdentifier; import org.bouncycastle.asn1.DERBitString; -import org.bouncycastle.asn1.DERObjectIdentifier; import org.bouncycastle.asn1.DERSequence; import org.bouncycastle.asn1.x509.AlgorithmIdentifier; import org.bouncycastle.asn1.x509.AttCertIssuer; @@ -36,7 +35,7 @@ import org.bouncycastle.asn1.x509.X509ExtensionsGenerator; public class X509V2AttributeCertificateGenerator { private V2AttributeCertificateInfoGenerator acInfoGen; - private DERObjectIdentifier sigOID; + private ASN1ObjectIdentifier sigOID; private AlgorithmIdentifier sigAlgId; private String signatureAlgorithm; private X509ExtensionsGenerator extGenerator; diff --git a/prov/src/main/java/org/bouncycastle/x509/X509V2CRLGenerator.java b/prov/src/main/java/org/bouncycastle/x509/X509V2CRLGenerator.java index 7285d86d..8773d0ec 100644 --- a/prov/src/main/java/org/bouncycastle/x509/X509V2CRLGenerator.java +++ b/prov/src/main/java/org/bouncycastle/x509/X509V2CRLGenerator.java @@ -26,7 +26,6 @@ import org.bouncycastle.asn1.ASN1Integer; import org.bouncycastle.asn1.ASN1ObjectIdentifier; import org.bouncycastle.asn1.ASN1Sequence; import org.bouncycastle.asn1.DERBitString; -import org.bouncycastle.asn1.DERObjectIdentifier; import org.bouncycastle.asn1.DERSequence; import org.bouncycastle.asn1.x509.AlgorithmIdentifier; import org.bouncycastle.asn1.x509.CertificateList; @@ -47,7 +46,7 @@ import org.bouncycastle.jce.provider.X509CRLObject; public class X509V2CRLGenerator { private V2TBSCertListGenerator tbsGen; - private DERObjectIdentifier sigOID; + private ASN1ObjectIdentifier sigOID; private AlgorithmIdentifier sigAlgId; private String signatureAlgorithm; private X509ExtensionsGenerator extGenerator; @@ -197,14 +196,14 @@ public class X509V2CRLGenerator boolean critical, ASN1Encodable value) { - this.addExtension(new DERObjectIdentifier(oid), critical, value); + this.addExtension(new ASN1ObjectIdentifier(oid), critical, value); } /** * add a given extension field for the standard extensions tag (tag 0) */ public void addExtension( - DERObjectIdentifier oid, + ASN1ObjectIdentifier oid, boolean critical, ASN1Encodable value) { @@ -219,14 +218,14 @@ public class X509V2CRLGenerator boolean critical, byte[] value) { - this.addExtension(new DERObjectIdentifier(oid), critical, value); + this.addExtension(new ASN1ObjectIdentifier(oid), critical, value); } /** * add a given extension field for the standard extensions tag (tag 0) */ public void addExtension( - DERObjectIdentifier oid, + ASN1ObjectIdentifier oid, boolean critical, byte[] value) { diff --git a/prov/src/main/java/org/bouncycastle/x509/X509V3CertificateGenerator.java b/prov/src/main/java/org/bouncycastle/x509/X509V3CertificateGenerator.java index d216295c..c422cb26 100644 --- a/prov/src/main/java/org/bouncycastle/x509/X509V3CertificateGenerator.java +++ b/prov/src/main/java/org/bouncycastle/x509/X509V3CertificateGenerator.java @@ -24,7 +24,6 @@ import org.bouncycastle.asn1.ASN1InputStream; import org.bouncycastle.asn1.ASN1Integer; import org.bouncycastle.asn1.ASN1ObjectIdentifier; import org.bouncycastle.asn1.DERBitString; -import org.bouncycastle.asn1.DERObjectIdentifier; import org.bouncycastle.asn1.DERSequence; import org.bouncycastle.asn1.x509.AlgorithmIdentifier; import org.bouncycastle.asn1.x509.Certificate; @@ -45,7 +44,7 @@ import org.bouncycastle.x509.extension.X509ExtensionUtil; public class X509V3CertificateGenerator { private V3TBSCertificateGenerator tbsGen; - private DERObjectIdentifier sigOID; + private ASN1ObjectIdentifier sigOID; private AlgorithmIdentifier sigAlgId; private String signatureAlgorithm; private X509ExtensionsGenerator extGenerator; @@ -228,14 +227,14 @@ public class X509V3CertificateGenerator boolean critical, ASN1Encodable value) { - this.addExtension(new DERObjectIdentifier(oid), critical, value); + this.addExtension(new ASN1ObjectIdentifier(oid), critical, value); } /** * add a given extension field for the standard extensions tag (tag 3) */ public void addExtension( - DERObjectIdentifier oid, + ASN1ObjectIdentifier oid, boolean critical, ASN1Encodable value) { @@ -252,14 +251,14 @@ public class X509V3CertificateGenerator boolean critical, byte[] value) { - this.addExtension(new DERObjectIdentifier(oid), critical, value); + this.addExtension(new ASN1ObjectIdentifier(oid), critical, value); } /** * add a given extension field for the standard extensions tag (tag 3) */ public void addExtension( - DERObjectIdentifier oid, + ASN1ObjectIdentifier oid, boolean critical, byte[] value) { @@ -302,7 +301,7 @@ public class X509V3CertificateGenerator * @throws CertificateParsingException if the extension cannot be extracted. */ public void copyAndAddExtension( - DERObjectIdentifier oid, + ASN1ObjectIdentifier oid, boolean critical, X509Certificate cert) throws CertificateParsingException diff --git a/prov/src/main/jdk1.1/org/bouncycastle/jce/provider/PKIXCertPathValidatorSpi.java b/prov/src/main/jdk1.1/org/bouncycastle/jce/provider/PKIXCertPathValidatorSpi.java index 91ef2d17..ed8d25c4 100644 --- a/prov/src/main/jdk1.1/org/bouncycastle/jce/provider/PKIXCertPathValidatorSpi.java +++ b/prov/src/main/jdk1.1/org/bouncycastle/jce/provider/PKIXCertPathValidatorSpi.java @@ -49,11 +49,11 @@ import org.bouncycastle.asn1.ASN1Sequence; import org.bouncycastle.asn1.ASN1TaggedObject; import org.bouncycastle.asn1.BERConstructedOctetString; import org.bouncycastle.asn1.ASN1Encodable; -import org.bouncycastle.asn1.DEREnumerated; +import org.bouncycastle.asn1.ASN1Enumerated; import org.bouncycastle.asn1.DERIA5String; -import org.bouncycastle.asn1.DERInteger; +import org.bouncycastle.asn1.ASN1Integer; import org.bouncycastle.asn1.ASN1Primitive; -import org.bouncycastle.asn1.DERObjectIdentifier; +import org.bouncycastle.asn1.ASN1ObjectIdentifier; import org.bouncycastle.asn1.x509.AlgorithmIdentifier; import org.bouncycastle.asn1.x509.BasicConstraints; import org.bouncycastle.asn1.x509.GeneralName; @@ -564,7 +564,7 @@ public class PKIXCertPathValidatorSpi extends CertPathValidatorSpi private boolean processCertD1i( int index, List [] policyNodes, - DERObjectIdentifier pOid, + ASN1ObjectIdentifier pOid, Set pq) { List policyNodeVec = policyNodes[index - 1]; @@ -599,7 +599,7 @@ public class PKIXCertPathValidatorSpi extends CertPathValidatorSpi private void processCertD1ii( int index, List [] policyNodes, - DERObjectIdentifier _poid, + ASN1ObjectIdentifier _poid, Set _pq) { List policyNodeVec = policyNodes[index - 1]; @@ -799,7 +799,7 @@ public class PKIXCertPathValidatorSpi extends CertPathValidatorSpi } AlgorithmIdentifier workingAlgId = getAlgorithmIdentifier(workingPublicKey); - DERObjectIdentifier workingPublicKeyAlgorithm = workingAlgId.getObjectId(); + ASN1ObjectIdentifier workingPublicKeyAlgorithm = workingAlgId.getObjectId(); ASN1Encodable workingPublicKeyParameters = workingAlgId.getParameters(); // @@ -970,7 +970,7 @@ public class PKIXCertPathValidatorSpi extends CertPathValidatorSpi while (e.hasMoreElements()) { PolicyInformation pInfo = PolicyInformation.getInstance(e.nextElement()); - DERObjectIdentifier pOid = pInfo.getPolicyIdentifier(); + ASN1ObjectIdentifier pOid = pInfo.getPolicyIdentifier(); pols.add(pOid.getId()); @@ -1039,9 +1039,9 @@ public class PKIXCertPathValidatorSpi extends CertPathValidatorSpi { _policy = (String)_tmp; } - else if (_tmp instanceof DERObjectIdentifier) + else if (_tmp instanceof ASN1ObjectIdentifier) { - _policy = ((DERObjectIdentifier)_tmp).getId(); + _policy = ((ASN1ObjectIdentifier)_tmp).getId(); } else { @@ -1163,8 +1163,8 @@ public class PKIXCertPathValidatorSpi extends CertPathValidatorSpi { ASN1Sequence mapping = (ASN1Sequence)mappings.getObjectAt(j); - DERObjectIdentifier issuerDomainPolicy = (DERObjectIdentifier)mapping.getObjectAt(0); - DERObjectIdentifier subjectDomainPolicy = (DERObjectIdentifier)mapping.getObjectAt(1); + ASN1ObjectIdentifier issuerDomainPolicy = (ASN1ObjectIdentifier)mapping.getObjectAt(0); + ASN1ObjectIdentifier subjectDomainPolicy = (ASN1ObjectIdentifier)mapping.getObjectAt(1); if (ANY_POLICY.equals(issuerDomainPolicy.getId())) { @@ -1191,8 +1191,8 @@ public class PKIXCertPathValidatorSpi extends CertPathValidatorSpi for (int j = 0; j < mappings.size(); j++) { ASN1Sequence mapping = (ASN1Sequence)mappings.getObjectAt(j); - String id_p = ((DERObjectIdentifier)mapping.getObjectAt(0)).getId(); - String sd_p = ((DERObjectIdentifier)mapping.getObjectAt(1)).getId(); + String id_p = ((ASN1ObjectIdentifier)mapping.getObjectAt(0)).getId(); + String sd_p = ((ASN1ObjectIdentifier)mapping.getObjectAt(1)).getId(); Set tmp; if (!m_idp.containsKey(id_p)) @@ -1417,14 +1417,14 @@ public class PKIXCertPathValidatorSpi extends CertPathValidatorSpi switch (constraint.getTagNo()) { case 0: - tmpInt = DERInteger.getInstance(constraint).getValue().intValue(); + tmpInt = ASN1Integer.getInstance(constraint).getValue().intValue(); if (tmpInt < explicitPolicy) { explicitPolicy = tmpInt; } break; case 1: - tmpInt = DERInteger.getInstance(constraint).getValue().intValue(); + tmpInt = ASN1Integer.getInstance(constraint).getValue().intValue(); if (tmpInt < policyMapping) { policyMapping = tmpInt; @@ -1437,7 +1437,7 @@ public class PKIXCertPathValidatorSpi extends CertPathValidatorSpi // // (j) // - DERInteger iap = (DERInteger)getExtensionValue(cert, INHIBIT_ANY_POLICY); + ASN1Integer iap = (ASN1Integer)getExtensionValue(cert, INHIBIT_ANY_POLICY); if (iap != null) { @@ -1593,7 +1593,7 @@ public class PKIXCertPathValidatorSpi extends CertPathValidatorSpi switch (constraint.getTagNo()) { case 0: - tmpInt = DERInteger.getInstance(constraint).getValue().intValue(); + tmpInt = ASN1Integer.getInstance(constraint).getValue().intValue(); if (tmpInt == 0) { explicitPolicy = 0; @@ -1893,7 +1893,7 @@ public class PKIXCertPathValidatorSpi extends CertPathValidatorSpi if (crl_entry.hasExtensions()) { - DEREnumerated reasonCode = DEREnumerated.getInstance(getExtensionValue(crl_entry, X509Extensions.ReasonCode.getId())); + ASN1Enumerated reasonCode = ASN1Enumerated.getInstance(getExtensionValue(crl_entry, X509Extensions.ReasonCode.getId())); if (reasonCode != null) { reason = crlReasons[reasonCode.getValue().intValue()]; @@ -1931,8 +1931,8 @@ public class PKIXCertPathValidatorSpi extends CertPathValidatorSpi throw new AnnotatedException("can't extract issuer from certificate: " + e, e); } - baseSelect.setMinCRLNumber(((DERInteger)dci).getPositiveValue()); - baseSelect.setMaxCRLNumber(((DERInteger)getExtensionValue(crl, CRL_NUMBER)).getPositiveValue().subtract(BigInteger.valueOf(1))); + baseSelect.setMinCRLNumber(((ASN1Integer)dci).getPositiveValue()); + baseSelect.setMaxCRLNumber(((ASN1Integer)getExtensionValue(crl, CRL_NUMBER)).getPositiveValue().subtract(BigInteger.valueOf(1))); boolean foundBase = false; Iterator it = findCRLs(baseSelect, paramsPKIX.getCertStores()).iterator(); diff --git a/prov/src/main/jdk1.1/org/bouncycastle/jce/provider/X509CRLObject.java b/prov/src/main/jdk1.1/org/bouncycastle/jce/provider/X509CRLObject.java index c7112868..324cf84a 100644 --- a/prov/src/main/jdk1.1/org/bouncycastle/jce/provider/X509CRLObject.java +++ b/prov/src/main/jdk1.1/org/bouncycastle/jce/provider/X509CRLObject.java @@ -26,7 +26,7 @@ import org.bouncycastle.asn1.ASN1Encodable; import org.bouncycastle.asn1.ASN1Encoding; import org.bouncycastle.asn1.ASN1InputStream; import org.bouncycastle.asn1.ASN1ObjectIdentifier; -import org.bouncycastle.asn1.DERInteger; +import org.bouncycastle.asn1.ASN1Integer; import org.bouncycastle.asn1.util.ASN1Dump; import org.bouncycastle.asn1.x500.X500Name; import org.bouncycastle.asn1.x509.CRLDistPoint; @@ -430,7 +430,7 @@ public class X509CRLObject if (oid.equals(Extension.cRLNumber)) { buf.append( - new CRLNumber(DERInteger.getInstance( + new CRLNumber(ASN1Integer.getInstance( dIn.readObject()).getPositiveValue())) .append(nl); } @@ -438,7 +438,7 @@ public class X509CRLObject { buf.append( "Base CRL: " - + new CRLNumber(DERInteger.getInstance( + + new CRLNumber(ASN1Integer.getInstance( dIn.readObject()).getPositiveValue())) .append(nl); } diff --git a/prov/src/main/jdk1.1/org/bouncycastle/ocsp/OCSPUtil.java b/prov/src/main/jdk1.1/org/bouncycastle/ocsp/OCSPUtil.java index 3536a7eb..f6d4bace 100644 --- a/prov/src/main/jdk1.1/org/bouncycastle/ocsp/OCSPUtil.java +++ b/prov/src/main/jdk1.1/org/bouncycastle/ocsp/OCSPUtil.java @@ -1,7 +1,7 @@ package org.bouncycastle.ocsp; import org.bouncycastle.asn1.DERNull; -import org.bouncycastle.asn1.DERObjectIdentifier; +import org.bouncycastle.asn1.ASN1ObjectIdentifier; import org.bouncycastle.asn1.cryptopro.CryptoProObjectIdentifiers; import org.bouncycastle.asn1.nist.NISTObjectIdentifiers; import org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers; @@ -102,21 +102,21 @@ class OCSPUtil noParams.add(NISTObjectIdentifiers.dsa_with_sha256); } - static DERObjectIdentifier getAlgorithmOID( + static ASN1ObjectIdentifier getAlgorithmOID( String algorithmName) { algorithmName = Strings.toUpperCase(algorithmName); if (algorithms.containsKey(algorithmName)) { - return (DERObjectIdentifier)algorithms.get(algorithmName); + return (ASN1ObjectIdentifier)algorithms.get(algorithmName); } - return new DERObjectIdentifier(algorithmName); + return new ASN1ObjectIdentifier(algorithmName); } static String getAlgorithmName( - DERObjectIdentifier oid) + ASN1ObjectIdentifier oid) { if (oids.containsKey(oid)) { @@ -127,7 +127,7 @@ class OCSPUtil } static AlgorithmIdentifier getSigAlgID( - DERObjectIdentifier sigOid) + ASN1ObjectIdentifier sigOid) { if (noParams.contains(sigOid)) { diff --git a/prov/src/main/jdk1.1/org/bouncycastle/x509/X509Util.java b/prov/src/main/jdk1.1/org/bouncycastle/x509/X509Util.java index 56739eb4..21dbcad7 100644 --- a/prov/src/main/jdk1.1/org/bouncycastle/x509/X509Util.java +++ b/prov/src/main/jdk1.1/org/bouncycastle/x509/X509Util.java @@ -22,7 +22,7 @@ import org.bouncycastle.asn1.ASN1Encodable; import org.bouncycastle.asn1.ASN1Encoding; import org.bouncycastle.asn1.ASN1Integer; import org.bouncycastle.asn1.DERNull; -import org.bouncycastle.asn1.DERObjectIdentifier; +import org.bouncycastle.asn1.ASN1ObjectIdentifier; import org.bouncycastle.asn1.cryptopro.CryptoProObjectIdentifiers; import org.bouncycastle.asn1.nist.NISTObjectIdentifiers; import org.bouncycastle.asn1.oiw.OIWObjectIdentifiers; @@ -134,21 +134,21 @@ class X509Util new ASN1Integer(1)); } - static DERObjectIdentifier getAlgorithmOID( + static ASN1ObjectIdentifier getAlgorithmOID( String algorithmName) { algorithmName = Strings.toUpperCase(algorithmName); if (algorithms.containsKey(algorithmName)) { - return (DERObjectIdentifier)algorithms.get(algorithmName); + return (ASN1ObjectIdentifier)algorithms.get(algorithmName); } - return new DERObjectIdentifier(algorithmName); + return new ASN1ObjectIdentifier(algorithmName); } static AlgorithmIdentifier getSigAlgID( - DERObjectIdentifier sigOid, + ASN1ObjectIdentifier sigOid, String algorithmName) { if (noParams.contains(sigOid)) @@ -204,7 +204,7 @@ class X509Util } static byte[] calculateSignature( - DERObjectIdentifier sigOid, + ASN1ObjectIdentifier sigOid, String sigName, PrivateKey key, SecureRandom random, @@ -235,7 +235,7 @@ class X509Util } static byte[] calculateSignature( - DERObjectIdentifier sigOid, + ASN1ObjectIdentifier sigOid, String sigName, String provider, PrivateKey key, diff --git a/prov/src/main/jdk1.1/org/bouncycastle/x509/X509V1CertificateGenerator.java b/prov/src/main/jdk1.1/org/bouncycastle/x509/X509V1CertificateGenerator.java index b9e78ece..20f24bb9 100644 --- a/prov/src/main/jdk1.1/org/bouncycastle/x509/X509V1CertificateGenerator.java +++ b/prov/src/main/jdk1.1/org/bouncycastle/x509/X509V1CertificateGenerator.java @@ -22,7 +22,7 @@ import org.bouncycastle.asn1.ASN1InputStream; import org.bouncycastle.asn1.ASN1Integer; import org.bouncycastle.asn1.ASN1Sequence; import org.bouncycastle.asn1.DERBitString; -import org.bouncycastle.asn1.DERObjectIdentifier; +import org.bouncycastle.asn1.ASN1ObjectIdentifier; import org.bouncycastle.asn1.DERSequence; import org.bouncycastle.asn1.x509.AlgorithmIdentifier; import org.bouncycastle.asn1.x509.SubjectPublicKeyInfo; @@ -40,7 +40,7 @@ import org.bouncycastle.jce.provider.X509CertificateObject; public class X509V1CertificateGenerator { private V1TBSCertificateGenerator tbsGen; - private DERObjectIdentifier sigOID; + private ASN1ObjectIdentifier sigOID; private AlgorithmIdentifier sigAlgId; private String signatureAlgorithm; diff --git a/prov/src/main/jdk1.1/org/bouncycastle/x509/X509V2AttributeCertificateGenerator.java b/prov/src/main/jdk1.1/org/bouncycastle/x509/X509V2AttributeCertificateGenerator.java index 57a862ad..7e2a3f8f 100644 --- a/prov/src/main/jdk1.1/org/bouncycastle/x509/X509V2AttributeCertificateGenerator.java +++ b/prov/src/main/jdk1.1/org/bouncycastle/x509/X509V2AttributeCertificateGenerator.java @@ -20,7 +20,7 @@ import org.bouncycastle.asn1.DERBitString; import org.bouncycastle.asn1.ASN1GeneralizedTime; import org.bouncycastle.asn1.ASN1Integer; import org.bouncycastle.asn1.DERNull; -import org.bouncycastle.asn1.DERObjectIdentifier; +import org.bouncycastle.asn1.ASN1ObjectIdentifier; import org.bouncycastle.asn1.DEROctetString; import org.bouncycastle.asn1.DEROutputStream; import org.bouncycastle.asn1.DERSequence; @@ -40,7 +40,7 @@ import org.bouncycastle.util.Strings; public class X509V2AttributeCertificateGenerator { private V2AttributeCertificateInfoGenerator acInfoGen; - private DERObjectIdentifier sigOID; + private ASN1ObjectIdentifier sigOID; private AlgorithmIdentifier sigAlgId; private String signatureAlgorithm; private Hashtable extensions = null; @@ -49,18 +49,18 @@ public class X509V2AttributeCertificateGenerator static { - algorithms.put("MD2WITHRSAENCRYPTION", new DERObjectIdentifier("1.2.840.113549.1.1.2")); - algorithms.put("MD2WITHRSA", new DERObjectIdentifier("1.2.840.113549.1.1.2")); - algorithms.put("MD5WITHRSAENCRYPTION", new DERObjectIdentifier("1.2.840.113549.1.1.4")); - algorithms.put("MD5WITHRSA", new DERObjectIdentifier("1.2.840.113549.1.1.4")); - algorithms.put("SHA1WITHRSAENCRYPTION", new DERObjectIdentifier("1.2.840.113549.1.1.5")); - algorithms.put("SHA1WITHRSA", new DERObjectIdentifier("1.2.840.113549.1.1.5")); - algorithms.put("RIPEMD160WITHRSAENCRYPTION", new DERObjectIdentifier("1.3.36.3.3.1.2")); - algorithms.put("RIPEMD160WITHRSA", new DERObjectIdentifier("1.3.36.3.3.1.2")); - algorithms.put("SHA1WITHDSA", new DERObjectIdentifier("1.2.840.10040.4.3")); - algorithms.put("DSAWITHSHA1", new DERObjectIdentifier("1.2.840.10040.4.3")); - algorithms.put("SHA1WITHECDSA", new DERObjectIdentifier("1.2.840.10045.4.1")); - algorithms.put("ECDSAWITHSHA1", new DERObjectIdentifier("1.2.840.10045.4.1")); + algorithms.put("MD2WITHRSAENCRYPTION", new ASN1ObjectIdentifier("1.2.840.113549.1.1.2")); + algorithms.put("MD2WITHRSA", new ASN1ObjectIdentifier("1.2.840.113549.1.1.2")); + algorithms.put("MD5WITHRSAENCRYPTION", new ASN1ObjectIdentifier("1.2.840.113549.1.1.4")); + algorithms.put("MD5WITHRSA", new ASN1ObjectIdentifier("1.2.840.113549.1.1.4")); + algorithms.put("SHA1WITHRSAENCRYPTION", new ASN1ObjectIdentifier("1.2.840.113549.1.1.5")); + algorithms.put("SHA1WITHRSA", new ASN1ObjectIdentifier("1.2.840.113549.1.1.5")); + algorithms.put("RIPEMD160WITHRSAENCRYPTION", new ASN1ObjectIdentifier("1.3.36.3.3.1.2")); + algorithms.put("RIPEMD160WITHRSA", new ASN1ObjectIdentifier("1.3.36.3.3.1.2")); + algorithms.put("SHA1WITHDSA", new ASN1ObjectIdentifier("1.2.840.10040.4.3")); + algorithms.put("DSAWITHSHA1", new ASN1ObjectIdentifier("1.2.840.10040.4.3")); + algorithms.put("SHA1WITHECDSA", new ASN1ObjectIdentifier("1.2.840.10045.4.1")); + algorithms.put("ECDSAWITHSHA1", new ASN1ObjectIdentifier("1.2.840.10045.4.1")); } public X509V2AttributeCertificateGenerator() @@ -131,7 +131,7 @@ public class X509V2AttributeCertificateGenerator { this.signatureAlgorithm = signatureAlgorithm; - sigOID = (DERObjectIdentifier)algorithms.get(Strings.toUpperCase(signatureAlgorithm)); + sigOID = (ASN1ObjectIdentifier)algorithms.get(Strings.toUpperCase(signatureAlgorithm)); if (sigOID == null) { @@ -188,7 +188,7 @@ public class X509V2AttributeCertificateGenerator extOrdering = new Vector(); } - DERObjectIdentifier oid = new DERObjectIdentifier(OID); + ASN1ObjectIdentifier oid = new ASN1ObjectIdentifier(OID); extensions.put(oid, new X509Extension(critical, new DEROctetString(value))); extOrdering.addElement(oid); diff --git a/prov/src/main/jdk1.1/org/bouncycastle/x509/X509V2CRLGenerator.java b/prov/src/main/jdk1.1/org/bouncycastle/x509/X509V2CRLGenerator.java index a31ee763..ea1a4f0d 100644 --- a/prov/src/main/jdk1.1/org/bouncycastle/x509/X509V2CRLGenerator.java +++ b/prov/src/main/jdk1.1/org/bouncycastle/x509/X509V2CRLGenerator.java @@ -24,7 +24,7 @@ import org.bouncycastle.asn1.ASN1Sequence; import org.bouncycastle.asn1.DERBitString; import org.bouncycastle.asn1.ASN1GeneralizedTime; import org.bouncycastle.asn1.ASN1Integer; -import org.bouncycastle.asn1.DERObjectIdentifier; +import org.bouncycastle.asn1.ASN1ObjectIdentifier; import org.bouncycastle.asn1.DERSequence; import org.bouncycastle.asn1.x509.AlgorithmIdentifier; import org.bouncycastle.asn1.x509.CertificateList; @@ -44,7 +44,7 @@ import org.bouncycastle.jce.provider.X509CRLObject; public class X509V2CRLGenerator { private V2TBSCertListGenerator tbsGen; - private DERObjectIdentifier sigOID; + private ASN1ObjectIdentifier sigOID; private AlgorithmIdentifier sigAlgId; private String signatureAlgorithm; private X509ExtensionsGenerator extGenerator; @@ -177,14 +177,14 @@ public class X509V2CRLGenerator boolean critical, ASN1Encodable value) { - this.addExtension(new DERObjectIdentifier(oid), critical, value); + this.addExtension(new ASN1ObjectIdentifier(oid), critical, value); } /** * add a given extension field for the standard extensions tag (tag 0) */ public void addExtension( - DERObjectIdentifier oid, + ASN1ObjectIdentifier oid, boolean critical, ASN1Encodable value) { @@ -199,14 +199,14 @@ public class X509V2CRLGenerator boolean critical, byte[] value) { - this.addExtension(new DERObjectIdentifier(oid), critical, value); + this.addExtension(new ASN1ObjectIdentifier(oid), critical, value); } /** * add a given extension field for the standard extensions tag (tag 0) */ public void addExtension( - DERObjectIdentifier oid, + ASN1ObjectIdentifier oid, boolean critical, byte[] value) { diff --git a/prov/src/main/jdk1.1/org/bouncycastle/x509/X509V3CertificateGenerator.java b/prov/src/main/jdk1.1/org/bouncycastle/x509/X509V3CertificateGenerator.java index 38572f7d..60135972 100644 --- a/prov/src/main/jdk1.1/org/bouncycastle/x509/X509V3CertificateGenerator.java +++ b/prov/src/main/jdk1.1/org/bouncycastle/x509/X509V3CertificateGenerator.java @@ -22,7 +22,7 @@ import org.bouncycastle.asn1.ASN1InputStream; import org.bouncycastle.asn1.ASN1Integer; import org.bouncycastle.asn1.ASN1ObjectIdentifier; import org.bouncycastle.asn1.DERBitString; -import org.bouncycastle.asn1.DERObjectIdentifier; +import org.bouncycastle.asn1.ASN1ObjectIdentifier; import org.bouncycastle.asn1.DERSequence; import org.bouncycastle.asn1.x509.AlgorithmIdentifier; import org.bouncycastle.asn1.x509.SubjectPublicKeyInfo; @@ -42,7 +42,7 @@ import org.bouncycastle.x509.extension.X509ExtensionUtil; public class X509V3CertificateGenerator { private V3TBSCertificateGenerator tbsGen; - private DERObjectIdentifier sigOID; + private ASN1ObjectIdentifier sigOID; private AlgorithmIdentifier sigAlgId; private String signatureAlgorithm; private X509ExtensionsGenerator extGenerator; @@ -192,14 +192,14 @@ public class X509V3CertificateGenerator boolean critical, ASN1Encodable value) { - this.addExtension(new DERObjectIdentifier(oid), critical, value); + this.addExtension(new ASN1ObjectIdentifier(oid), critical, value); } /** * add a given extension field for the standard extensions tag (tag 3) */ public void addExtension( - DERObjectIdentifier oid, + ASN1ObjectIdentifier oid, boolean critical, ASN1Encodable value) { @@ -216,14 +216,14 @@ public class X509V3CertificateGenerator boolean critical, byte[] value) { - this.addExtension(new DERObjectIdentifier(oid), critical, value); + this.addExtension(new ASN1ObjectIdentifier(oid), critical, value); } /** * add a given extension field for the standard extensions tag (tag 3) */ public void addExtension( - DERObjectIdentifier oid, + ASN1ObjectIdentifier oid, boolean critical, byte[] value) { @@ -266,7 +266,7 @@ public class X509V3CertificateGenerator * @throws CertificateParsingException if the extension cannot be extracted. */ public void copyAndAddExtension( - DERObjectIdentifier oid, + ASN1ObjectIdentifier oid, boolean critical, X509Certificate cert) throws CertificateParsingException diff --git a/prov/src/main/jdk1.3/org/bouncycastle/jcajce/provider/asymmetric/x509/X509CRLEntryObject.java b/prov/src/main/jdk1.3/org/bouncycastle/jcajce/provider/asymmetric/x509/X509CRLEntryObject.java index 0403daba..2b64aa04 100644 --- a/prov/src/main/jdk1.3/org/bouncycastle/jcajce/provider/asymmetric/x509/X509CRLEntryObject.java +++ b/prov/src/main/jdk1.3/org/bouncycastle/jcajce/provider/asymmetric/x509/X509CRLEntryObject.java @@ -12,7 +12,7 @@ import java.util.Set; import org.bouncycastle.asn1.ASN1Encoding; import org.bouncycastle.asn1.ASN1InputStream; import org.bouncycastle.asn1.ASN1ObjectIdentifier; -import org.bouncycastle.asn1.DEREnumerated; +import org.bouncycastle.asn1.ASN1Enumerated; import org.bouncycastle.asn1.util.ASN1Dump; import org.bouncycastle.asn1.x500.X500Name; import org.bouncycastle.asn1.x509.CRLReason; @@ -262,7 +262,7 @@ class X509CRLEntryObject extends X509CRLEntry { if (oid.equals(X509Extension.reasonCode)) { - buf.append(CRLReason.getInstance(DEREnumerated.getInstance(dIn.readObject()))).append(nl); + buf.append(CRLReason.getInstance(ASN1Enumerated.getInstance(dIn.readObject()))).append(nl); } else if (oid.equals(X509Extension.certificateIssuer)) { diff --git a/prov/src/main/jdk1.3/org/bouncycastle/jcajce/provider/asymmetric/x509/X509CRLObject.java b/prov/src/main/jdk1.3/org/bouncycastle/jcajce/provider/asymmetric/x509/X509CRLObject.java index cc1849f9..c154fd4c 100644 --- a/prov/src/main/jdk1.3/org/bouncycastle/jcajce/provider/asymmetric/x509/X509CRLObject.java +++ b/prov/src/main/jdk1.3/org/bouncycastle/jcajce/provider/asymmetric/x509/X509CRLObject.java @@ -26,7 +26,7 @@ import org.bouncycastle.asn1.ASN1Encodable; import org.bouncycastle.asn1.ASN1Encoding; import org.bouncycastle.asn1.ASN1InputStream; import org.bouncycastle.asn1.ASN1ObjectIdentifier; -import org.bouncycastle.asn1.DERInteger; +import org.bouncycastle.asn1.ASN1Integer; import org.bouncycastle.asn1.util.ASN1Dump; import org.bouncycastle.asn1.x500.X500Name; import org.bouncycastle.asn1.x509.CRLDistPoint; @@ -432,7 +432,7 @@ class X509CRLObject if (oid.equals(Extension.cRLNumber)) { buf.append( - new CRLNumber(DERInteger.getInstance( + new CRLNumber(ASN1Integer.getInstance( dIn.readObject()).getPositiveValue())) .append(nl); } @@ -440,7 +440,7 @@ class X509CRLObject { buf.append( "Base CRL: " - + new CRLNumber(DERInteger.getInstance( + + new CRLNumber(ASN1Integer.getInstance( dIn.readObject()).getPositiveValue())) .append(nl); } diff --git a/prov/src/main/jdk1.3/org/bouncycastle/jcajce/provider/asymmetric/x509/X509SignatureUtil.java b/prov/src/main/jdk1.3/org/bouncycastle/jcajce/provider/asymmetric/x509/X509SignatureUtil.java index fdb58045..390e349d 100644 --- a/prov/src/main/jdk1.3/org/bouncycastle/jcajce/provider/asymmetric/x509/X509SignatureUtil.java +++ b/prov/src/main/jdk1.3/org/bouncycastle/jcajce/provider/asymmetric/x509/X509SignatureUtil.java @@ -8,7 +8,7 @@ import java.security.SignatureException; import org.bouncycastle.asn1.ASN1Encodable; import org.bouncycastle.asn1.ASN1Null; import org.bouncycastle.asn1.DERNull; -import org.bouncycastle.asn1.DERObjectIdentifier; +import org.bouncycastle.asn1.ASN1ObjectIdentifier; import org.bouncycastle.asn1.cryptopro.CryptoProObjectIdentifiers; import org.bouncycastle.asn1.nist.NISTObjectIdentifiers; import org.bouncycastle.asn1.oiw.OIWObjectIdentifiers; @@ -75,7 +75,7 @@ class X509SignatureUtil * representations rather the the algorithm identifier (if possible). */ private static String getDigestAlgName( - DERObjectIdentifier digestAlgOID) + ASN1ObjectIdentifier digestAlgOID) { if (PKCSObjectIdentifiers.md5.equals(digestAlgOID)) { diff --git a/prov/src/main/jdk1.3/org/bouncycastle/jce/PKCS10CertificationRequest.java b/prov/src/main/jdk1.3/org/bouncycastle/jce/PKCS10CertificationRequest.java index b7e7a087..bac5ee7c 100644 --- a/prov/src/main/jdk1.3/org/bouncycastle/jce/PKCS10CertificationRequest.java +++ b/prov/src/main/jdk1.3/org/bouncycastle/jce/PKCS10CertificationRequest.java @@ -26,7 +26,7 @@ import org.bouncycastle.asn1.ASN1Sequence; import org.bouncycastle.asn1.ASN1Set; import org.bouncycastle.asn1.DERBitString; import org.bouncycastle.asn1.DERNull; -import org.bouncycastle.asn1.DERObjectIdentifier; +import org.bouncycastle.asn1.ASN1ObjectIdentifier; import org.bouncycastle.asn1.cryptopro.CryptoProObjectIdentifiers; import org.bouncycastle.asn1.nist.NISTObjectIdentifiers; import org.bouncycastle.asn1.oiw.OIWObjectIdentifiers; @@ -78,13 +78,13 @@ public class PKCS10CertificationRequest static { - algorithms.put("MD2WITHRSAENCRYPTION", new DERObjectIdentifier("1.2.840.113549.1.1.2")); - algorithms.put("MD2WITHRSA", new DERObjectIdentifier("1.2.840.113549.1.1.2")); - algorithms.put("MD5WITHRSAENCRYPTION", new DERObjectIdentifier("1.2.840.113549.1.1.4")); - algorithms.put("MD5WITHRSA", new DERObjectIdentifier("1.2.840.113549.1.1.4")); - algorithms.put("RSAWITHMD5", new DERObjectIdentifier("1.2.840.113549.1.1.4")); - algorithms.put("SHA1WITHRSAENCRYPTION", new DERObjectIdentifier("1.2.840.113549.1.1.5")); - algorithms.put("SHA1WITHRSA", new DERObjectIdentifier("1.2.840.113549.1.1.5")); + algorithms.put("MD2WITHRSAENCRYPTION", new ASN1ObjectIdentifier("1.2.840.113549.1.1.2")); + algorithms.put("MD2WITHRSA", new ASN1ObjectIdentifier("1.2.840.113549.1.1.2")); + algorithms.put("MD5WITHRSAENCRYPTION", new ASN1ObjectIdentifier("1.2.840.113549.1.1.4")); + algorithms.put("MD5WITHRSA", new ASN1ObjectIdentifier("1.2.840.113549.1.1.4")); + algorithms.put("RSAWITHMD5", new ASN1ObjectIdentifier("1.2.840.113549.1.1.4")); + algorithms.put("SHA1WITHRSAENCRYPTION", new ASN1ObjectIdentifier("1.2.840.113549.1.1.5")); + algorithms.put("SHA1WITHRSA", new ASN1ObjectIdentifier("1.2.840.113549.1.1.5")); algorithms.put("SHA224WITHRSAENCRYPTION", PKCSObjectIdentifiers.sha224WithRSAEncryption); algorithms.put("SHA224WITHRSA", PKCSObjectIdentifiers.sha224WithRSAEncryption); algorithms.put("SHA256WITHRSAENCRYPTION", PKCSObjectIdentifiers.sha256WithRSAEncryption); @@ -98,15 +98,15 @@ public class PKCS10CertificationRequest algorithms.put("SHA256WITHRSAANDMGF1", PKCSObjectIdentifiers.id_RSASSA_PSS); algorithms.put("SHA384WITHRSAANDMGF1", PKCSObjectIdentifiers.id_RSASSA_PSS); algorithms.put("SHA512WITHRSAANDMGF1", PKCSObjectIdentifiers.id_RSASSA_PSS); - algorithms.put("RSAWITHSHA1", new DERObjectIdentifier("1.2.840.113549.1.1.5")); + algorithms.put("RSAWITHSHA1", new ASN1ObjectIdentifier("1.2.840.113549.1.1.5")); algorithms.put("RIPEMD128WITHRSAENCRYPTION", TeleTrusTObjectIdentifiers.rsaSignatureWithripemd128); algorithms.put("RIPEMD128WITHRSA", TeleTrusTObjectIdentifiers.rsaSignatureWithripemd128); algorithms.put("RIPEMD160WITHRSAENCRYPTION", TeleTrusTObjectIdentifiers.rsaSignatureWithripemd160); algorithms.put("RIPEMD160WITHRSA", TeleTrusTObjectIdentifiers.rsaSignatureWithripemd160); algorithms.put("RIPEMD256WITHRSAENCRYPTION", TeleTrusTObjectIdentifiers.rsaSignatureWithripemd256); algorithms.put("RIPEMD256WITHRSA", TeleTrusTObjectIdentifiers.rsaSignatureWithripemd256); - algorithms.put("SHA1WITHDSA", new DERObjectIdentifier("1.2.840.10040.4.3")); - algorithms.put("DSAWITHSHA1", new DERObjectIdentifier("1.2.840.10040.4.3")); + algorithms.put("SHA1WITHDSA", new ASN1ObjectIdentifier("1.2.840.10040.4.3")); + algorithms.put("DSAWITHSHA1", new ASN1ObjectIdentifier("1.2.840.10040.4.3")); algorithms.put("SHA224WITHDSA", NISTObjectIdentifiers.dsa_with_sha224); algorithms.put("SHA256WITHDSA", NISTObjectIdentifiers.dsa_with_sha256); algorithms.put("SHA384WITHDSA", NISTObjectIdentifiers.dsa_with_sha384); @@ -126,7 +126,7 @@ public class PKCS10CertificationRequest // // reverse mappings // - oids.put(new DERObjectIdentifier("1.2.840.113549.1.1.5"), "SHA1WITHRSA"); + oids.put(new ASN1ObjectIdentifier("1.2.840.113549.1.1.5"), "SHA1WITHRSA"); oids.put(PKCSObjectIdentifiers.sha224WithRSAEncryption, "SHA224WITHRSA"); oids.put(PKCSObjectIdentifiers.sha256WithRSAEncryption, "SHA256WITHRSA"); oids.put(PKCSObjectIdentifiers.sha384WithRSAEncryption, "SHA384WITHRSA"); @@ -134,9 +134,9 @@ public class PKCS10CertificationRequest oids.put(CryptoProObjectIdentifiers.gostR3411_94_with_gostR3410_94, "GOST3411WITHGOST3410"); oids.put(CryptoProObjectIdentifiers.gostR3411_94_with_gostR3410_2001, "GOST3411WITHECGOST3410"); - oids.put(new DERObjectIdentifier("1.2.840.113549.1.1.4"), "MD5WITHRSA"); - oids.put(new DERObjectIdentifier("1.2.840.113549.1.1.2"), "MD2WITHRSA"); - oids.put(new DERObjectIdentifier("1.2.840.10040.4.3"), "SHA1WITHDSA"); + oids.put(new ASN1ObjectIdentifier("1.2.840.113549.1.1.4"), "MD5WITHRSA"); + oids.put(new ASN1ObjectIdentifier("1.2.840.113549.1.1.2"), "MD2WITHRSA"); + oids.put(new ASN1ObjectIdentifier("1.2.840.10040.4.3"), "SHA1WITHDSA"); oids.put(X9ObjectIdentifiers.ecdsa_with_SHA1, "SHA1WITHECDSA"); oids.put(X9ObjectIdentifiers.ecdsa_with_SHA224, "SHA224WITHECDSA"); oids.put(X9ObjectIdentifiers.ecdsa_with_SHA256, "SHA256WITHECDSA"); @@ -260,13 +260,13 @@ public class PKCS10CertificationRequest InvalidKeyException, SignatureException { String algorithmName = Strings.toUpperCase(signatureAlgorithm); - DERObjectIdentifier sigOID = (DERObjectIdentifier)algorithms.get(algorithmName); + ASN1ObjectIdentifier sigOID = (ASN1ObjectIdentifier)algorithms.get(algorithmName); if (sigOID == null) { try { - sigOID = new DERObjectIdentifier(algorithmName); + sigOID = new ASN1ObjectIdentifier(algorithmName); } catch (Exception e) { @@ -533,7 +533,7 @@ public class PKCS10CertificationRequest } private static String getDigestAlgName( - DERObjectIdentifier digestAlgOID) + ASN1ObjectIdentifier digestAlgOID) { if (PKCSObjectIdentifiers.md5.equals(digestAlgOID)) { diff --git a/prov/src/main/jdk1.3/org/bouncycastle/jce/cert/X509CRLSelector.java b/prov/src/main/jdk1.3/org/bouncycastle/jce/cert/X509CRLSelector.java index c1b809c0..b489b9eb 100644 --- a/prov/src/main/jdk1.3/org/bouncycastle/jce/cert/X509CRLSelector.java +++ b/prov/src/main/jdk1.3/org/bouncycastle/jce/cert/X509CRLSelector.java @@ -16,7 +16,7 @@ import org.bouncycastle.asn1.ASN1InputStream; import org.bouncycastle.asn1.ASN1Object; import org.bouncycastle.asn1.ASN1OctetString; import org.bouncycastle.asn1.ASN1Sequence; -import org.bouncycastle.asn1.DERInteger; +import org.bouncycastle.asn1.ASN1Integer; import org.bouncycastle.asn1.x509.X509Extensions; import org.bouncycastle.asn1.x509.X509Name; import org.bouncycastle.jce.PrincipalUtil; @@ -562,7 +562,7 @@ public class X509CRLSelector implements CRLSelector ((ASN1OctetString)derInputStream.readObject()) .getOctets()); derInputStream = new ASN1InputStream(inStream); - BigInteger crlNumber = ((DERInteger)derInputStream.readObject()) + BigInteger crlNumber = ((ASN1Integer)derInputStream.readObject()) .getPositiveValue(); if (minCRL != null && minCRL.compareTo(crlNumber) > 0) { diff --git a/prov/src/main/jdk1.3/org/bouncycastle/jce/provider/CertPathValidatorUtilities.java b/prov/src/main/jdk1.3/org/bouncycastle/jce/provider/CertPathValidatorUtilities.java index ef6ee4df..436ec61c 100644 --- a/prov/src/main/jdk1.3/org/bouncycastle/jce/provider/CertPathValidatorUtilities.java +++ b/prov/src/main/jdk1.3/org/bouncycastle/jce/provider/CertPathValidatorUtilities.java @@ -42,10 +42,10 @@ import org.bouncycastle.asn1.ASN1OctetString; import org.bouncycastle.asn1.ASN1OutputStream; import org.bouncycastle.asn1.ASN1Primitive; import org.bouncycastle.asn1.ASN1Sequence; -import org.bouncycastle.asn1.DEREnumerated; +import org.bouncycastle.asn1.ASN1Enumerated; import org.bouncycastle.asn1.DERGeneralizedTime; import org.bouncycastle.asn1.DERIA5String; -import org.bouncycastle.asn1.DERObjectIdentifier; +import org.bouncycastle.asn1.ASN1ObjectIdentifier; import org.bouncycastle.asn1.DERSequence; import org.bouncycastle.asn1.isismtt.ISISMTTObjectIdentifiers; import org.bouncycastle.asn1.x509.AlgorithmIdentifier; @@ -477,7 +477,7 @@ catch (Exception e) protected static boolean processCertD1i( int index, List[] policyNodes, - DERObjectIdentifier pOid, + ASN1ObjectIdentifier pOid, Set pq) { List policyNodeVec = policyNodes[index - 1]; @@ -512,7 +512,7 @@ catch (Exception e) protected static void processCertD1ii( int index, List[] policyNodes, - DERObjectIdentifier _poid, + ASN1ObjectIdentifier _poid, Set _pq) { List policyNodeVec = policyNodes[index - 1]; @@ -1008,12 +1008,12 @@ catch (Exception e) } } - DEREnumerated reasonCode = null; + ASN1Enumerated reasonCode = null; if (crl_entry.hasExtensions()) { try { - reasonCode = DEREnumerated + reasonCode = ASN1Enumerated .getInstance(CertPathValidatorUtilities .getExtensionValue(crl_entry, X509Extension.reasonCode.getId())); diff --git a/prov/src/main/jdk1.3/org/bouncycastle/jce/provider/JDKAlgorithmParameters.java b/prov/src/main/jdk1.3/org/bouncycastle/jce/provider/JDKAlgorithmParameters.java index fb97b1d0..4a99d9a0 100644 --- a/prov/src/main/jdk1.3/org/bouncycastle/jce/provider/JDKAlgorithmParameters.java +++ b/prov/src/main/jdk1.3/org/bouncycastle/jce/provider/JDKAlgorithmParameters.java @@ -14,7 +14,7 @@ import org.bouncycastle.asn1.ASN1EncodableVector; import org.bouncycastle.asn1.ASN1InputStream; import org.bouncycastle.asn1.ASN1OctetString; import org.bouncycastle.asn1.ASN1Sequence; -import org.bouncycastle.asn1.DERInteger; +import org.bouncycastle.asn1.ASN1Integer; import org.bouncycastle.asn1.DEROctetString; import org.bouncycastle.asn1.DEROutputStream; import org.bouncycastle.asn1.DERSequence; @@ -547,7 +547,7 @@ public abstract class JDKAlgorithmParameters v.add(new DEROctetString(currentSpec.getDerivationV())); v.add(new DEROctetString(currentSpec.getEncodingV())); - v.add(new DERInteger(currentSpec.getMacKeySize())); + v.add(new ASN1Integer(currentSpec.getMacKeySize())); dOut.writeObject(new DERSequence(v)); dOut.close(); @@ -608,7 +608,7 @@ public abstract class JDKAlgorithmParameters this.currentSpec = new IESParameterSpec( ((ASN1OctetString)s.getObjectAt(0)).getOctets(), ((ASN1OctetString)s.getObjectAt(0)).getOctets(), - ((DERInteger)s.getObjectAt(0)).getValue().intValue()); + ((ASN1Integer)s.getObjectAt(0)).getValue().intValue()); } catch (ClassCastException e) { diff --git a/prov/src/main/jdk1.3/org/bouncycastle/jce/provider/PKIXCertPathValidatorSpi.java b/prov/src/main/jdk1.3/org/bouncycastle/jce/provider/PKIXCertPathValidatorSpi.java index 58d3f2d9..50f113b9 100644 --- a/prov/src/main/jdk1.3/org/bouncycastle/jce/provider/PKIXCertPathValidatorSpi.java +++ b/prov/src/main/jdk1.3/org/bouncycastle/jce/provider/PKIXCertPathValidatorSpi.java @@ -21,7 +21,7 @@ import java.util.Set; import org.bouncycastle.jce.X509Principal; import org.bouncycastle.asn1.ASN1Encodable; -import org.bouncycastle.asn1.DERObjectIdentifier; +import org.bouncycastle.asn1.ASN1ObjectIdentifier; import org.bouncycastle.asn1.x509.AlgorithmIdentifier; import org.bouncycastle.jce.exception.ExtCertPathValidatorException; import org.bouncycastle.x509.ExtendedPKIXParameters; @@ -218,7 +218,7 @@ public class PKIXCertPathValidatorSpi throw new ExtCertPathValidatorException( "Algorithm identifier of public key of trust anchor could not be read.", e, certPath, -1); } - DERObjectIdentifier workingPublicKeyAlgorithm = workingAlgId.getObjectId(); + ASN1ObjectIdentifier workingPublicKeyAlgorithm = workingAlgId.getObjectId(); ASN1Encodable workingPublicKeyParameters = workingAlgId.getParameters(); // diff --git a/prov/src/main/jdk1.3/org/bouncycastle/jce/provider/RFC3280CertPathUtilities.java b/prov/src/main/jdk1.3/org/bouncycastle/jce/provider/RFC3280CertPathUtilities.java index 933bf15a..8d6066ec 100644 --- a/prov/src/main/jdk1.3/org/bouncycastle/jce/provider/RFC3280CertPathUtilities.java +++ b/prov/src/main/jdk1.3/org/bouncycastle/jce/provider/RFC3280CertPathUtilities.java @@ -34,8 +34,8 @@ import org.bouncycastle.asn1.ASN1InputStream; import org.bouncycastle.asn1.ASN1Primitive; import org.bouncycastle.asn1.ASN1Sequence; import org.bouncycastle.asn1.ASN1TaggedObject; -import org.bouncycastle.asn1.DERInteger; -import org.bouncycastle.asn1.DERObjectIdentifier; +import org.bouncycastle.asn1.ASN1Integer; +import org.bouncycastle.asn1.ASN1ObjectIdentifier; import org.bouncycastle.asn1.DERSequence; import org.bouncycastle.asn1.x509.BasicConstraints; import org.bouncycastle.asn1.x509.CRLDistPoint; @@ -905,8 +905,8 @@ public class RFC3280CertPathUtilities for (int j = 0; j < mappings.size(); j++) { ASN1Sequence mapping = (ASN1Sequence)mappings.getObjectAt(j); - String id_p = ((DERObjectIdentifier)mapping.getObjectAt(0)).getId(); - String sd_p = ((DERObjectIdentifier)mapping.getObjectAt(1)).getId(); + String id_p = ((ASN1ObjectIdentifier)mapping.getObjectAt(0)).getId(); + String sd_p = ((ASN1ObjectIdentifier)mapping.getObjectAt(1)).getId(); Set tmp; if (!m_idp.containsKey(id_p)) @@ -1084,14 +1084,14 @@ public class RFC3280CertPathUtilities for (int j = 0; j < mappings.size(); j++) { - DERObjectIdentifier issuerDomainPolicy = null; - DERObjectIdentifier subjectDomainPolicy = null; + ASN1ObjectIdentifier issuerDomainPolicy = null; + ASN1ObjectIdentifier subjectDomainPolicy = null; try { ASN1Sequence mapping = DERSequence.getInstance(mappings.getObjectAt(j)); - issuerDomainPolicy = DERObjectIdentifier.getInstance(mapping.getObjectAt(0)); - subjectDomainPolicy = DERObjectIdentifier.getInstance(mapping.getObjectAt(1)); + issuerDomainPolicy = ASN1ObjectIdentifier.getInstance(mapping.getObjectAt(0)); + subjectDomainPolicy = ASN1ObjectIdentifier.getInstance(mapping.getObjectAt(1)); } catch (Exception e) { @@ -1298,7 +1298,7 @@ public class RFC3280CertPathUtilities while (e.hasMoreElements()) { PolicyInformation pInfo = PolicyInformation.getInstance(e.nextElement()); - DERObjectIdentifier pOid = pInfo.getPolicyIdentifier(); + ASN1ObjectIdentifier pOid = pInfo.getPolicyIdentifier(); pols.add(pOid.getId()); @@ -1377,9 +1377,9 @@ public class RFC3280CertPathUtilities { _policy = (String)_tmp; } - else if (_tmp instanceof DERObjectIdentifier) + else if (_tmp instanceof ASN1ObjectIdentifier) { - _policy = ((DERObjectIdentifier)_tmp).getId(); + _policy = ((ASN1ObjectIdentifier)_tmp).getId(); } else { @@ -1579,7 +1579,7 @@ public class RFC3280CertPathUtilities ASN1TaggedObject constraint = ASN1TaggedObject.getInstance(policyConstraints.nextElement()); if (constraint.getTagNo() == 0) { - tmpInt = DERInteger.getInstance(constraint, false).getValue().intValue(); + tmpInt = ASN1Integer.getInstance(constraint, false).getValue().intValue(); if (tmpInt < explicitPolicy) { return tmpInt; @@ -1633,7 +1633,7 @@ public class RFC3280CertPathUtilities ASN1TaggedObject constraint = ASN1TaggedObject.getInstance(policyConstraints.nextElement()); if (constraint.getTagNo() == 1) { - tmpInt = DERInteger.getInstance(constraint, false).getValue().intValue(); + tmpInt = ASN1Integer.getInstance(constraint, false).getValue().intValue(); if (tmpInt < policyMapping) { return tmpInt; @@ -2045,10 +2045,10 @@ public class RFC3280CertPathUtilities // // (j) // - DERInteger iap = null; + ASN1Integer iap = null; try { - iap = DERInteger.getInstance(CertPathValidatorUtilities.getExtensionValue(cert, + iap = ASN1Integer.getInstance(CertPathValidatorUtilities.getExtensionValue(cert, RFC3280CertPathUtilities.INHIBIT_ANY_POLICY)); } catch (Exception e) @@ -2351,7 +2351,7 @@ public class RFC3280CertPathUtilities case 0: try { - tmpInt = DERInteger.getInstance(constraint, false).getValue().intValue(); + tmpInt = ASN1Integer.getInstance(constraint, false).getValue().intValue(); } catch (Exception e) { diff --git a/prov/src/main/jdk1.3/org/bouncycastle/jce/provider/X509CRLEntryObject.java b/prov/src/main/jdk1.3/org/bouncycastle/jce/provider/X509CRLEntryObject.java index 08322d1d..37371002 100644 --- a/prov/src/main/jdk1.3/org/bouncycastle/jce/provider/X509CRLEntryObject.java +++ b/prov/src/main/jdk1.3/org/bouncycastle/jce/provider/X509CRLEntryObject.java @@ -12,7 +12,7 @@ import java.util.Set; import org.bouncycastle.asn1.ASN1Encoding; import org.bouncycastle.asn1.ASN1InputStream; import org.bouncycastle.asn1.ASN1ObjectIdentifier; -import org.bouncycastle.asn1.DEREnumerated; +import org.bouncycastle.asn1.ASN1Enumerated; import org.bouncycastle.asn1.util.ASN1Dump; import org.bouncycastle.asn1.x500.X500Name; import org.bouncycastle.asn1.x509.CRLReason; @@ -262,7 +262,7 @@ public class X509CRLEntryObject extends X509CRLEntry { if (oid.equals(X509Extension.reasonCode)) { - buf.append(CRLReason.getInstance(DEREnumerated.getInstance(dIn.readObject()))).append(nl); + buf.append(CRLReason.getInstance(ASN1Enumerated.getInstance(dIn.readObject()))).append(nl); } else if (oid.equals(X509Extension.certificateIssuer)) { diff --git a/prov/src/main/jdk1.3/org/bouncycastle/jce/provider/X509CRLObject.java b/prov/src/main/jdk1.3/org/bouncycastle/jce/provider/X509CRLObject.java index 5824c9f8..23422bef 100644 --- a/prov/src/main/jdk1.3/org/bouncycastle/jce/provider/X509CRLObject.java +++ b/prov/src/main/jdk1.3/org/bouncycastle/jce/provider/X509CRLObject.java @@ -26,7 +26,7 @@ import org.bouncycastle.asn1.ASN1Encodable; import org.bouncycastle.asn1.ASN1Encoding; import org.bouncycastle.asn1.ASN1InputStream; import org.bouncycastle.asn1.ASN1ObjectIdentifier; -import org.bouncycastle.asn1.DERInteger; +import org.bouncycastle.asn1.ASN1Integer; import org.bouncycastle.asn1.util.ASN1Dump; import org.bouncycastle.asn1.x500.X500Name; import org.bouncycastle.asn1.x509.CRLDistPoint; @@ -432,7 +432,7 @@ public class X509CRLObject if (oid.equals(Extension.cRLNumber)) { buf.append( - new CRLNumber(DERInteger.getInstance( + new CRLNumber(ASN1Integer.getInstance( dIn.readObject()).getPositiveValue())) .append(nl); } @@ -440,7 +440,7 @@ public class X509CRLObject { buf.append( "Base CRL: " - + new CRLNumber(DERInteger.getInstance( + + new CRLNumber(ASN1Integer.getInstance( dIn.readObject()).getPositiveValue())) .append(nl); } diff --git a/prov/src/main/jdk1.3/org/bouncycastle/ocsp/BasicOCSPResp.java b/prov/src/main/jdk1.3/org/bouncycastle/ocsp/BasicOCSPResp.java index a968282d..ebccccba 100644 --- a/prov/src/main/jdk1.3/org/bouncycastle/ocsp/BasicOCSPResp.java +++ b/prov/src/main/jdk1.3/org/bouncycastle/ocsp/BasicOCSPResp.java @@ -26,7 +26,7 @@ import org.bouncycastle.asn1.ASN1Encodable; import org.bouncycastle.asn1.ASN1Encoding; import org.bouncycastle.asn1.ASN1OutputStream; import org.bouncycastle.asn1.ASN1Sequence; -import org.bouncycastle.asn1.DERObjectIdentifier; +import org.bouncycastle.asn1.ASN1ObjectIdentifier; import org.bouncycastle.asn1.ocsp.BasicOCSPResponse; import org.bouncycastle.asn1.ocsp.ResponseData; import org.bouncycastle.asn1.ocsp.SingleResponse; @@ -144,7 +144,7 @@ public class BasicOCSPResp while (e.hasMoreElements()) { - DERObjectIdentifier oid = (DERObjectIdentifier)e.nextElement(); + ASN1ObjectIdentifier oid = (ASN1ObjectIdentifier)e.nextElement(); X509Extension ext = extensions.getExtension(oid); if (critical == ext.isCritical()) @@ -173,7 +173,7 @@ public class BasicOCSPResp if (exts != null) { - X509Extension ext = exts.getExtension(new DERObjectIdentifier(oid)); + X509Extension ext = exts.getExtension(new ASN1ObjectIdentifier(oid)); if (ext != null) { diff --git a/prov/src/main/jdk1.3/org/bouncycastle/ocsp/OCSPReqGenerator.java b/prov/src/main/jdk1.3/org/bouncycastle/ocsp/OCSPReqGenerator.java index 7288fd7d..f4d01dc9 100644 --- a/prov/src/main/jdk1.3/org/bouncycastle/ocsp/OCSPReqGenerator.java +++ b/prov/src/main/jdk1.3/org/bouncycastle/ocsp/OCSPReqGenerator.java @@ -18,7 +18,7 @@ import org.bouncycastle.asn1.ASN1Primitive; import org.bouncycastle.asn1.ASN1Sequence; import org.bouncycastle.asn1.DERBitString; import org.bouncycastle.asn1.DERNull; -import org.bouncycastle.asn1.DERObjectIdentifier; +import org.bouncycastle.asn1.ASN1ObjectIdentifier; import org.bouncycastle.asn1.DERSequence; import org.bouncycastle.asn1.ocsp.OCSPRequest; import org.bouncycastle.asn1.ocsp.Request; @@ -115,7 +115,7 @@ public class OCSPReqGenerator } private OCSPReq generateRequest( - DERObjectIdentifier signingAlgorithm, + ASN1ObjectIdentifier signingAlgorithm, PrivateKey key, X509Certificate[] chain, String provider, @@ -270,7 +270,7 @@ public class OCSPReqGenerator try { - DERObjectIdentifier oid = OCSPUtil.getAlgorithmOID(signingAlgorithm); + ASN1ObjectIdentifier oid = OCSPUtil.getAlgorithmOID(signingAlgorithm); return generateRequest(oid, key, chain, provider, random); } diff --git a/prov/src/main/jdk1.3/org/bouncycastle/ocsp/OCSPUtil.java b/prov/src/main/jdk1.3/org/bouncycastle/ocsp/OCSPUtil.java index 8cbd4bac..69e86437 100644 --- a/prov/src/main/jdk1.3/org/bouncycastle/ocsp/OCSPUtil.java +++ b/prov/src/main/jdk1.3/org/bouncycastle/ocsp/OCSPUtil.java @@ -1,7 +1,7 @@ package org.bouncycastle.ocsp; import org.bouncycastle.asn1.DERNull; -import org.bouncycastle.asn1.DERObjectIdentifier; +import org.bouncycastle.asn1.ASN1ObjectIdentifier; import org.bouncycastle.asn1.cryptopro.CryptoProObjectIdentifiers; import org.bouncycastle.asn1.nist.NISTObjectIdentifiers; import org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers; @@ -102,21 +102,21 @@ class OCSPUtil noParams.add(NISTObjectIdentifiers.dsa_with_sha256); } - static DERObjectIdentifier getAlgorithmOID( + static ASN1ObjectIdentifier getAlgorithmOID( String algorithmName) { algorithmName = Strings.toUpperCase(algorithmName); if (algorithms.containsKey(algorithmName)) { - return (DERObjectIdentifier)algorithms.get(algorithmName); + return (ASN1ObjectIdentifier)algorithms.get(algorithmName); } - return new DERObjectIdentifier(algorithmName); + return new ASN1ObjectIdentifier(algorithmName); } static String getAlgorithmName( - DERObjectIdentifier oid) + ASN1ObjectIdentifier oid) { if (oids.containsKey(oid)) { @@ -127,7 +127,7 @@ class OCSPUtil } static AlgorithmIdentifier getSigAlgID( - DERObjectIdentifier sigOid) + ASN1ObjectIdentifier sigOid) { if (noParams.contains(sigOid)) { diff --git a/prov/src/main/jdk1.3/org/bouncycastle/x509/X509CRLStoreSelector.java b/prov/src/main/jdk1.3/org/bouncycastle/x509/X509CRLStoreSelector.java index 4e953a0b..a0e28805 100644 --- a/prov/src/main/jdk1.3/org/bouncycastle/x509/X509CRLStoreSelector.java +++ b/prov/src/main/jdk1.3/org/bouncycastle/x509/X509CRLStoreSelector.java @@ -1,6 +1,6 @@ package org.bouncycastle.x509; -import org.bouncycastle.asn1.DERInteger; +import org.bouncycastle.asn1.ASN1Integer; import org.bouncycastle.asn1.x509.X509Extensions; import org.bouncycastle.util.Arrays; import org.bouncycastle.util.Selector; @@ -96,14 +96,14 @@ public class X509CRLStoreSelector return false; } X509CRL crl = (X509CRL)obj; - DERInteger dci = null; + ASN1Integer dci = null; try { byte[] bytes = crl .getExtensionValue(X509Extensions.DeltaCRLIndicator.getId()); if (bytes != null) { - dci = DERInteger.getInstance(X509ExtensionUtil + dci = ASN1Integer.getInstance(X509ExtensionUtil .fromExtensionValue(bytes)); } } diff --git a/prov/src/main/jdk1.3/org/bouncycastle/x509/X509Util.java b/prov/src/main/jdk1.3/org/bouncycastle/x509/X509Util.java index 6149da86..945d122d 100644 --- a/prov/src/main/jdk1.3/org/bouncycastle/x509/X509Util.java +++ b/prov/src/main/jdk1.3/org/bouncycastle/x509/X509Util.java @@ -22,7 +22,7 @@ import org.bouncycastle.asn1.ASN1Encodable; import org.bouncycastle.asn1.ASN1Encoding; import org.bouncycastle.asn1.ASN1Integer; import org.bouncycastle.asn1.DERNull; -import org.bouncycastle.asn1.DERObjectIdentifier; +import org.bouncycastle.asn1.ASN1ObjectIdentifier; import org.bouncycastle.asn1.cryptopro.CryptoProObjectIdentifiers; import org.bouncycastle.asn1.nist.NISTObjectIdentifiers; import org.bouncycastle.asn1.oiw.OIWObjectIdentifiers; @@ -134,21 +134,21 @@ class X509Util new ASN1Integer(1)); } - static DERObjectIdentifier getAlgorithmOID( + static ASN1ObjectIdentifier getAlgorithmOID( String algorithmName) { algorithmName = Strings.toUpperCase(algorithmName); if (algorithms.containsKey(algorithmName)) { - return (DERObjectIdentifier)algorithms.get(algorithmName); + return (ASN1ObjectIdentifier)algorithms.get(algorithmName); } - return new DERObjectIdentifier(algorithmName); + return new ASN1ObjectIdentifier(algorithmName); } static AlgorithmIdentifier getSigAlgID( - DERObjectIdentifier sigOid, + ASN1ObjectIdentifier sigOid, String algorithmName) { if (noParams.contains(sigOid)) @@ -204,7 +204,7 @@ class X509Util } static byte[] calculateSignature( - DERObjectIdentifier sigOid, + ASN1ObjectIdentifier sigOid, String sigName, PrivateKey key, SecureRandom random, @@ -235,7 +235,7 @@ class X509Util } static byte[] calculateSignature( - DERObjectIdentifier sigOid, + ASN1ObjectIdentifier sigOid, String sigName, String provider, PrivateKey key, diff --git a/prov/src/main/jdk1.3/org/bouncycastle/x509/X509V1CertificateGenerator.java b/prov/src/main/jdk1.3/org/bouncycastle/x509/X509V1CertificateGenerator.java index 20dd3dc4..e33587b6 100644 --- a/prov/src/main/jdk1.3/org/bouncycastle/x509/X509V1CertificateGenerator.java +++ b/prov/src/main/jdk1.3/org/bouncycastle/x509/X509V1CertificateGenerator.java @@ -22,7 +22,7 @@ import org.bouncycastle.asn1.ASN1InputStream; import org.bouncycastle.asn1.ASN1Integer; import org.bouncycastle.asn1.ASN1Sequence; import org.bouncycastle.asn1.DERBitString; -import org.bouncycastle.asn1.DERObjectIdentifier; +import org.bouncycastle.asn1.ASN1ObjectIdentifier; import org.bouncycastle.asn1.DERSequence; import org.bouncycastle.asn1.x509.AlgorithmIdentifier; import org.bouncycastle.asn1.x509.SubjectPublicKeyInfo; @@ -40,7 +40,7 @@ import org.bouncycastle.jce.provider.X509CertificateObject; public class X509V1CertificateGenerator { private V1TBSCertificateGenerator tbsGen; - private DERObjectIdentifier sigOID; + private ASN1ObjectIdentifier sigOID; private AlgorithmIdentifier sigAlgId; private String signatureAlgorithm; diff --git a/prov/src/main/jdk1.3/org/bouncycastle/x509/X509V2CRLGenerator.java b/prov/src/main/jdk1.3/org/bouncycastle/x509/X509V2CRLGenerator.java index 27a8ef5a..d6a8b923 100644 --- a/prov/src/main/jdk1.3/org/bouncycastle/x509/X509V2CRLGenerator.java +++ b/prov/src/main/jdk1.3/org/bouncycastle/x509/X509V2CRLGenerator.java @@ -24,7 +24,7 @@ import org.bouncycastle.asn1.ASN1Integer; import org.bouncycastle.asn1.ASN1ObjectIdentifier; import org.bouncycastle.asn1.ASN1Sequence; import org.bouncycastle.asn1.DERBitString; -import org.bouncycastle.asn1.DERObjectIdentifier; +import org.bouncycastle.asn1.ASN1ObjectIdentifier; import org.bouncycastle.asn1.DERSequence; import org.bouncycastle.asn1.x509.AlgorithmIdentifier; import org.bouncycastle.asn1.x509.CertificateList; @@ -45,7 +45,7 @@ import org.bouncycastle.jce.provider.X509CRLObject; public class X509V2CRLGenerator { private V2TBSCertListGenerator tbsGen; - private DERObjectIdentifier sigOID; + private ASN1ObjectIdentifier sigOID; private AlgorithmIdentifier sigAlgId; private String signatureAlgorithm; private X509ExtensionsGenerator extGenerator; @@ -178,14 +178,14 @@ public class X509V2CRLGenerator boolean critical, ASN1Encodable value) { - this.addExtension(new DERObjectIdentifier(oid), critical, value); + this.addExtension(new ASN1ObjectIdentifier(oid), critical, value); } /** * add a given extension field for the standard extensions tag (tag 0) */ public void addExtension( - DERObjectIdentifier oid, + ASN1ObjectIdentifier oid, boolean critical, ASN1Encodable value) { @@ -200,14 +200,14 @@ public class X509V2CRLGenerator boolean critical, byte[] value) { - this.addExtension(new DERObjectIdentifier(oid), critical, value); + this.addExtension(new ASN1ObjectIdentifier(oid), critical, value); } /** * add a given extension field for the standard extensions tag (tag 0) */ public void addExtension( - DERObjectIdentifier oid, + ASN1ObjectIdentifier oid, boolean critical, byte[] value) { diff --git a/prov/src/main/jdk1.3/org/bouncycastle/x509/X509V3CertificateGenerator.java b/prov/src/main/jdk1.3/org/bouncycastle/x509/X509V3CertificateGenerator.java index dee501db..7d58db5f 100644 --- a/prov/src/main/jdk1.3/org/bouncycastle/x509/X509V3CertificateGenerator.java +++ b/prov/src/main/jdk1.3/org/bouncycastle/x509/X509V3CertificateGenerator.java @@ -22,7 +22,7 @@ import org.bouncycastle.asn1.ASN1InputStream; import org.bouncycastle.asn1.ASN1Integer; import org.bouncycastle.asn1.ASN1ObjectIdentifier; import org.bouncycastle.asn1.DERBitString; -import org.bouncycastle.asn1.DERObjectIdentifier; +import org.bouncycastle.asn1.ASN1ObjectIdentifier; import org.bouncycastle.asn1.DERSequence; import org.bouncycastle.asn1.x509.AlgorithmIdentifier; import org.bouncycastle.asn1.x509.SubjectPublicKeyInfo; @@ -42,7 +42,7 @@ import org.bouncycastle.x509.extension.X509ExtensionUtil; public class X509V3CertificateGenerator { private V3TBSCertificateGenerator tbsGen; - private DERObjectIdentifier sigOID; + private ASN1ObjectIdentifier sigOID; private AlgorithmIdentifier sigAlgId; private String signatureAlgorithm; private X509ExtensionsGenerator extGenerator; @@ -192,14 +192,14 @@ public class X509V3CertificateGenerator boolean critical, ASN1Encodable value) { - this.addExtension(new DERObjectIdentifier(oid), critical, value); + this.addExtension(new ASN1ObjectIdentifier(oid), critical, value); } /** * add a given extension field for the standard extensions tag (tag 3) */ public void addExtension( - DERObjectIdentifier oid, + ASN1ObjectIdentifier oid, boolean critical, ASN1Encodable value) { @@ -216,14 +216,14 @@ public class X509V3CertificateGenerator boolean critical, byte[] value) { - this.addExtension(new DERObjectIdentifier(oid), critical, value); + this.addExtension(new ASN1ObjectIdentifier(oid), critical, value); } /** * add a given extension field for the standard extensions tag (tag 3) */ public void addExtension( - DERObjectIdentifier oid, + ASN1ObjectIdentifier oid, boolean critical, byte[] value) { @@ -266,7 +266,7 @@ public class X509V3CertificateGenerator * @throws CertificateParsingException if the extension cannot be extracted. */ public void copyAndAddExtension( - DERObjectIdentifier oid, + ASN1ObjectIdentifier oid, boolean critical, X509Certificate cert) throws CertificateParsingException diff --git a/prov/src/main/jdk1.4/org/bouncycastle/jcajce/provider/asymmetric/ec/BCECPublicKey.java b/prov/src/main/jdk1.4/org/bouncycastle/jcajce/provider/asymmetric/ec/BCECPublicKey.java index 1dfbe954..b03b23dc 100644 --- a/prov/src/main/jdk1.4/org/bouncycastle/jcajce/provider/asymmetric/ec/BCECPublicKey.java +++ b/prov/src/main/jdk1.4/org/bouncycastle/jcajce/provider/asymmetric/ec/BCECPublicKey.java @@ -9,7 +9,7 @@ import org.bouncycastle.asn1.ASN1OctetString; import org.bouncycastle.asn1.ASN1Primitive; import org.bouncycastle.asn1.DERBitString; import org.bouncycastle.asn1.DERNull; -import org.bouncycastle.asn1.DERObjectIdentifier; +import org.bouncycastle.asn1.ASN1ObjectIdentifier; import org.bouncycastle.asn1.DEROctetString; import org.bouncycastle.asn1.x509.AlgorithmIdentifier; import org.bouncycastle.asn1.x509.SubjectPublicKeyInfo; @@ -241,11 +241,11 @@ public class BCECPublicKey X962Parameters params = null; if (ecSpec instanceof ECNamedCurveParameterSpec) { - DERObjectIdentifier curveOid = ECUtil.getNamedCurveOid(((ECNamedCurveParameterSpec)ecSpec).getName()); + ASN1ObjectIdentifier curveOid = ECUtil.getNamedCurveOid(((ECNamedCurveParameterSpec)ecSpec).getName()); if (curveOid == null) { - curveOid = new DERObjectIdentifier(((ECNamedCurveParameterSpec)ecSpec).getName()); + curveOid = new ASN1ObjectIdentifier(((ECNamedCurveParameterSpec)ecSpec).getName()); } params = new X962Parameters(curveOid); } diff --git a/prov/src/main/jdk1.4/org/bouncycastle/jcajce/provider/asymmetric/ec/KeyAgreementSpi.java b/prov/src/main/jdk1.4/org/bouncycastle/jcajce/provider/asymmetric/ec/KeyAgreementSpi.java index a13b5bfe..200ff350 100644 --- a/prov/src/main/jdk1.4/org/bouncycastle/jcajce/provider/asymmetric/ec/KeyAgreementSpi.java +++ b/prov/src/main/jdk1.4/org/bouncycastle/jcajce/provider/asymmetric/ec/KeyAgreementSpi.java @@ -15,7 +15,7 @@ import javax.crypto.SecretKey; import javax.crypto.ShortBufferException; import javax.crypto.spec.SecretKeySpec; -import org.bouncycastle.asn1.DERObjectIdentifier; +import org.bouncycastle.asn1.ASN1ObjectIdentifier; import org.bouncycastle.asn1.nist.NISTObjectIdentifiers; import org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers; import org.bouncycastle.asn1.x9.X9IntegerConverter; @@ -185,7 +185,7 @@ public class KeyAgreementSpi int keySize = ((Integer)algorithms.get(algorithm)).intValue(); - DHKDFParameters params = new DHKDFParameters(new DERObjectIdentifier(algorithm), keySize, secret); + DHKDFParameters params = new DHKDFParameters(new ASN1ObjectIdentifier(algorithm), keySize, secret); byte[] keyBytes = new byte[keySize / 8]; kdf.init(params); diff --git a/prov/src/main/jdk1.4/org/bouncycastle/jcajce/provider/asymmetric/ec/SignatureSpi.java b/prov/src/main/jdk1.4/org/bouncycastle/jcajce/provider/asymmetric/ec/SignatureSpi.java index 6ef6340a..1bb7d3b4 100644 --- a/prov/src/main/jdk1.4/org/bouncycastle/jcajce/provider/asymmetric/ec/SignatureSpi.java +++ b/prov/src/main/jdk1.4/org/bouncycastle/jcajce/provider/asymmetric/ec/SignatureSpi.java @@ -11,7 +11,7 @@ import org.bouncycastle.asn1.ASN1EncodableVector; import org.bouncycastle.asn1.ASN1Encoding; import org.bouncycastle.asn1.ASN1Primitive; import org.bouncycastle.asn1.ASN1Sequence; -import org.bouncycastle.asn1.DERInteger; +import org.bouncycastle.asn1.ASN1Integer; import org.bouncycastle.asn1.DERSequence; import org.bouncycastle.asn1.x509.SubjectPublicKeyInfo; import org.bouncycastle.crypto.CipherParameters; @@ -270,8 +270,8 @@ public class SignatureSpi { ASN1EncodableVector v = new ASN1EncodableVector(); - v.add(new DERInteger(r)); - v.add(new DERInteger(s)); + v.add(new ASN1Integer(r)); + v.add(new ASN1Integer(s)); return new DERSequence(v).getEncoded(ASN1Encoding.DER); } @@ -283,8 +283,8 @@ public class SignatureSpi ASN1Sequence s = (ASN1Sequence)ASN1Primitive.fromByteArray(encoding); BigInteger[] sig = new BigInteger[2]; - sig[0] = ((DERInteger)s.getObjectAt(0)).getValue(); - sig[1] = ((DERInteger)s.getObjectAt(1)).getValue(); + sig[0] = ((ASN1Integer)s.getObjectAt(0)).getValue(); + sig[1] = ((ASN1Integer)s.getObjectAt(1)).getValue(); return sig; } diff --git a/prov/src/main/jdk1.4/org/bouncycastle/jcajce/provider/asymmetric/ecgost/BCECGOST3410PublicKey.java b/prov/src/main/jdk1.4/org/bouncycastle/jcajce/provider/asymmetric/ecgost/BCECGOST3410PublicKey.java index 0ca373c9..8d33fd90 100644 --- a/prov/src/main/jdk1.4/org/bouncycastle/jcajce/provider/asymmetric/ecgost/BCECGOST3410PublicKey.java +++ b/prov/src/main/jdk1.4/org/bouncycastle/jcajce/provider/asymmetric/ecgost/BCECGOST3410PublicKey.java @@ -12,7 +12,7 @@ import org.bouncycastle.asn1.ASN1Primitive; import org.bouncycastle.asn1.ASN1Sequence; import org.bouncycastle.asn1.DERBitString; import org.bouncycastle.asn1.DERNull; -import org.bouncycastle.asn1.DERObjectIdentifier; +import org.bouncycastle.asn1.ASN1ObjectIdentifier; import org.bouncycastle.asn1.DEROctetString; import org.bouncycastle.asn1.cryptopro.CryptoProObjectIdentifiers; import org.bouncycastle.asn1.cryptopro.ECGOST3410NamedCurves; @@ -320,11 +320,11 @@ public class BCECGOST3410PublicKey X962Parameters params = null; if (ecSpec instanceof ECNamedCurveParameterSpec) { - DERObjectIdentifier curveOid = ECUtil.getNamedCurveOid(((ECNamedCurveParameterSpec)ecSpec).getName()); + ASN1ObjectIdentifier curveOid = ECUtil.getNamedCurveOid(((ECNamedCurveParameterSpec)ecSpec).getName()); if (curveOid == null) { - curveOid = new DERObjectIdentifier(((ECNamedCurveParameterSpec)ecSpec).getName()); + curveOid = new ASN1ObjectIdentifier(((ECNamedCurveParameterSpec)ecSpec).getName()); } params = new X962Parameters(curveOid); } diff --git a/prov/src/main/jdk1.4/org/bouncycastle/jce/provider/CertPathValidatorUtilities.java b/prov/src/main/jdk1.4/org/bouncycastle/jce/provider/CertPathValidatorUtilities.java index c4a0f139..4e15de41 100644 --- a/prov/src/main/jdk1.4/org/bouncycastle/jce/provider/CertPathValidatorUtilities.java +++ b/prov/src/main/jdk1.4/org/bouncycastle/jce/provider/CertPathValidatorUtilities.java @@ -44,10 +44,10 @@ import org.bouncycastle.asn1.ASN1OctetString; import org.bouncycastle.asn1.ASN1OutputStream; import org.bouncycastle.asn1.ASN1Primitive; import org.bouncycastle.asn1.ASN1Sequence; -import org.bouncycastle.asn1.DEREnumerated; +import org.bouncycastle.asn1.ASN1Enumerated; import org.bouncycastle.asn1.DERGeneralizedTime; import org.bouncycastle.asn1.DERIA5String; -import org.bouncycastle.asn1.DERObjectIdentifier; +import org.bouncycastle.asn1.ASN1ObjectIdentifier; import org.bouncycastle.asn1.DERSequence; import org.bouncycastle.asn1.isismtt.ISISMTTObjectIdentifiers; import org.bouncycastle.asn1.x509.AlgorithmIdentifier; @@ -456,7 +456,7 @@ public class CertPathValidatorUtilities protected static boolean processCertD1i( int index, List[] policyNodes, - DERObjectIdentifier pOid, + ASN1ObjectIdentifier pOid, Set pq) { List policyNodeVec = policyNodes[index - 1]; @@ -491,7 +491,7 @@ public class CertPathValidatorUtilities protected static void processCertD1ii( int index, List[] policyNodes, - DERObjectIdentifier _poid, + ASN1ObjectIdentifier _poid, Set _pq) { List policyNodeVec = policyNodes[index - 1]; @@ -1030,12 +1030,12 @@ public class CertPathValidatorUtilities } } - DEREnumerated reasonCode = null; + ASN1Enumerated reasonCode = null; if (crl_entry.hasExtensions()) { try { - reasonCode = DEREnumerated + reasonCode = ASN1Enumerated .getInstance(CertPathValidatorUtilities .getExtensionValue(crl_entry, X509Extension.reasonCode.getId())); diff --git a/prov/src/main/jdk1.4/org/bouncycastle/jce/provider/X509SignatureUtil.java b/prov/src/main/jdk1.4/org/bouncycastle/jce/provider/X509SignatureUtil.java index a640cb5c..9aca7ede 100644 --- a/prov/src/main/jdk1.4/org/bouncycastle/jce/provider/X509SignatureUtil.java +++ b/prov/src/main/jdk1.4/org/bouncycastle/jce/provider/X509SignatureUtil.java @@ -8,7 +8,7 @@ import java.security.SignatureException; import org.bouncycastle.asn1.ASN1Encodable; import org.bouncycastle.asn1.ASN1Null; import org.bouncycastle.asn1.DERNull; -import org.bouncycastle.asn1.DERObjectIdentifier; +import org.bouncycastle.asn1.ASN1ObjectIdentifier; import org.bouncycastle.asn1.cryptopro.CryptoProObjectIdentifiers; import org.bouncycastle.asn1.nist.NISTObjectIdentifiers; import org.bouncycastle.asn1.oiw.OIWObjectIdentifiers; @@ -75,7 +75,7 @@ class X509SignatureUtil * representations rather the the algorithm identifier (if possible). */ private static String getDigestAlgName( - DERObjectIdentifier digestAlgOID) + ASN1ObjectIdentifier digestAlgOID) { if (PKCSObjectIdentifiers.md5.equals(digestAlgOID)) { diff --git a/prov/src/main/jdk1.4/org/bouncycastle/x509/X509CRLStoreSelector.java b/prov/src/main/jdk1.4/org/bouncycastle/x509/X509CRLStoreSelector.java index 1ef5c61a..41701ed5 100644 --- a/prov/src/main/jdk1.4/org/bouncycastle/x509/X509CRLStoreSelector.java +++ b/prov/src/main/jdk1.4/org/bouncycastle/x509/X509CRLStoreSelector.java @@ -1,6 +1,6 @@ package org.bouncycastle.x509; -import org.bouncycastle.asn1.DERInteger; +import org.bouncycastle.asn1.ASN1Integer; import org.bouncycastle.asn1.x509.X509Extensions; import org.bouncycastle.util.Arrays; import org.bouncycastle.util.Selector; @@ -96,14 +96,14 @@ public class X509CRLStoreSelector return false; } X509CRL crl = (X509CRL)obj; - DERInteger dci = null; + ASN1Integer dci = null; try { byte[] bytes = crl .getExtensionValue(X509Extensions.DeltaCRLIndicator.getId()); if (bytes != null) { - dci = DERInteger.getInstance(X509ExtensionUtil + dci = ASN1Integer.getInstance(X509ExtensionUtil .fromExtensionValue(bytes)); } } diff --git a/prov/src/test/java/org/bouncycastle/jce/provider/test/CertTest.java b/prov/src/test/java/org/bouncycastle/jce/provider/test/CertTest.java index 7977f1c1..25bb3525 100644 --- a/prov/src/test/java/org/bouncycastle/jce/provider/test/CertTest.java +++ b/prov/src/test/java/org/bouncycastle/jce/provider/test/CertTest.java @@ -38,10 +38,10 @@ import javax.security.auth.x500.X500Principal; import org.bouncycastle.asn1.ASN1Encodable; import org.bouncycastle.asn1.ASN1EncodableVector; +import org.bouncycastle.asn1.ASN1Enumerated; import org.bouncycastle.asn1.ASN1InputStream; +import org.bouncycastle.asn1.ASN1ObjectIdentifier; import org.bouncycastle.asn1.ASN1Primitive; -import org.bouncycastle.asn1.DEREnumerated; -import org.bouncycastle.asn1.DERObjectIdentifier; import org.bouncycastle.asn1.DEROctetString; import org.bouncycastle.asn1.DERSequence; import org.bouncycastle.asn1.DERSet; @@ -1737,7 +1737,7 @@ public class CertTest /** * we generate a self signed certificate for the sake of testing - SHA224withECDSA */ - private void createECCert(String algorithm, DERObjectIdentifier algOid) + private void createECCert(String algorithm, ASN1ObjectIdentifier algOid) throws Exception { ECCurve.Fp curve = new ECCurve.Fp( @@ -1933,7 +1933,7 @@ public class CertTest if (ext != null) { - DEREnumerated reasonCode = (DEREnumerated)X509ExtensionUtil.fromExtensionValue(ext); + ASN1Enumerated reasonCode = (ASN1Enumerated)X509ExtensionUtil.fromExtensionValue(ext); if (reasonCode.getValue().intValue() != CRLReason.privilegeWithdrawn) { @@ -2018,7 +2018,7 @@ public class CertTest if (ext != null) { - DEREnumerated reasonCode = (DEREnumerated)X509ExtensionUtil.fromExtensionValue(ext); + ASN1Enumerated reasonCode = (ASN1Enumerated)X509ExtensionUtil.fromExtensionValue(ext); if (reasonCode.getValue().intValue() != CRLReason.privilegeWithdrawn) { @@ -2103,7 +2103,7 @@ public class CertTest if (ext != null) { - DEREnumerated reasonCode = (DEREnumerated)X509ExtensionUtil.fromExtensionValue(ext); + ASN1Enumerated reasonCode = (ASN1Enumerated)X509ExtensionUtil.fromExtensionValue(ext); if (reasonCode.getValue().intValue() != CRLReason.privilegeWithdrawn) { @@ -2352,7 +2352,7 @@ public class CertTest certGen.setPublicKey(pubKey); certGen.setSignatureAlgorithm("MD5WithRSAEncryption"); - certGen.copyAndAddExtension(new DERObjectIdentifier("2.5.29.15"), true, baseCert); + certGen.copyAndAddExtension(new ASN1ObjectIdentifier("2.5.29.15"), true, baseCert); certGen.copyAndAddExtension("2.5.29.37", false, baseCert); X509Certificate cert = certGen.generate(privKey, "BC"); diff --git a/prov/src/test/java/org/bouncycastle/jce/provider/test/DSATest.java b/prov/src/test/java/org/bouncycastle/jce/provider/test/DSATest.java index e0478997..3e2ebd41 100644 --- a/prov/src/test/java/org/bouncycastle/jce/provider/test/DSATest.java +++ b/prov/src/test/java/org/bouncycastle/jce/provider/test/DSATest.java @@ -25,10 +25,10 @@ import java.security.spec.PKCS8EncodedKeySpec; import java.security.spec.X509EncodedKeySpec; import org.bouncycastle.asn1.ASN1InputStream; +import org.bouncycastle.asn1.ASN1Integer; +import org.bouncycastle.asn1.ASN1ObjectIdentifier; import org.bouncycastle.asn1.ASN1Primitive; import org.bouncycastle.asn1.ASN1Sequence; -import org.bouncycastle.asn1.DERInteger; -import org.bouncycastle.asn1.DERObjectIdentifier; import org.bouncycastle.asn1.eac.EACObjectIdentifiers; import org.bouncycastle.asn1.teletrust.TeleTrusTObjectIdentifiers; import org.bouncycastle.asn1.x9.X9ObjectIdentifiers; @@ -191,7 +191,7 @@ public class DSATest signer.init(false, keyParams); - if (!signer.verifySignature(dummySha1, DERInteger.getInstance(derSig.getObjectAt(0)).getValue(), DERInteger.getInstance(derSig.getObjectAt(1)).getValue())) + if (!signer.verifySignature(dummySha1, ASN1Integer.getInstance(derSig.getObjectAt(0)).getValue(), ASN1Integer.getInstance(derSig.getObjectAt(1)).getValue())) { fail("NONEwithDSA not really NONE!"); } @@ -474,7 +474,7 @@ public class DSATest } } - private void testECDSA239bitBinary(String algorithm, DERObjectIdentifier oid) + private void testECDSA239bitBinary(String algorithm, ASN1ObjectIdentifier oid) throws Exception { byte[] kData = BigIntegers.asUnsignedByteArray(new BigInteger("171278725565216523967285789236956265265265235675811949404040041670216363")); @@ -971,8 +971,8 @@ public class DSATest BigInteger[] sig = new BigInteger[2]; - sig[0] = ((DERInteger)s.getObjectAt(0)).getValue(); - sig[1] = ((DERInteger)s.getObjectAt(1)).getValue(); + sig[0] = ((ASN1Integer)s.getObjectAt(0)).getValue(); + sig[1] = ((ASN1Integer)s.getObjectAt(1)).getValue(); return sig; } diff --git a/prov/src/test/java/org/bouncycastle/jce/provider/test/ECDSA5Test.java b/prov/src/test/java/org/bouncycastle/jce/provider/test/ECDSA5Test.java index 24354c80..5b256a47 100644 --- a/prov/src/test/java/org/bouncycastle/jce/provider/test/ECDSA5Test.java +++ b/prov/src/test/java/org/bouncycastle/jce/provider/test/ECDSA5Test.java @@ -31,10 +31,10 @@ import java.security.spec.PKCS8EncodedKeySpec; import java.security.spec.X509EncodedKeySpec; import org.bouncycastle.asn1.ASN1InputStream; +import org.bouncycastle.asn1.ASN1Integer; import org.bouncycastle.asn1.ASN1ObjectIdentifier; import org.bouncycastle.asn1.ASN1Primitive; import org.bouncycastle.asn1.ASN1Sequence; -import org.bouncycastle.asn1.DERInteger; import org.bouncycastle.asn1.pkcs.PrivateKeyInfo; import org.bouncycastle.asn1.sec.SECObjectIdentifiers; import org.bouncycastle.asn1.teletrust.TeleTrusTObjectIdentifiers; @@ -819,8 +819,8 @@ public class ECDSA5Test BigInteger[] sig = new BigInteger[2]; - sig[0] = ((DERInteger)s.getObjectAt(0)).getValue(); - sig[1] = ((DERInteger)s.getObjectAt(1)).getValue(); + sig[0] = ((ASN1Integer)s.getObjectAt(0)).getValue(); + sig[1] = ((ASN1Integer)s.getObjectAt(1)).getValue(); return sig; } diff --git a/prov/src/test/java/org/bouncycastle/jce/provider/test/ECNRTest.java b/prov/src/test/java/org/bouncycastle/jce/provider/test/ECNRTest.java index dc60a5c7..74695060 100644 --- a/prov/src/test/java/org/bouncycastle/jce/provider/test/ECNRTest.java +++ b/prov/src/test/java/org/bouncycastle/jce/provider/test/ECNRTest.java @@ -11,8 +11,8 @@ import java.security.Security; import java.security.Signature; import org.bouncycastle.asn1.ASN1InputStream; +import org.bouncycastle.asn1.ASN1Integer; import org.bouncycastle.asn1.ASN1Sequence; -import org.bouncycastle.asn1.DERInteger; import org.bouncycastle.jce.provider.BouncyCastleProvider; import org.bouncycastle.jce.spec.ECParameterSpec; import org.bouncycastle.jce.spec.ECPrivateKeySpec; @@ -218,8 +218,8 @@ public class ECNRTest BigInteger[] sig = new BigInteger[2]; - sig[0] = ((DERInteger)s.getObjectAt(0)).getValue(); - sig[1] = ((DERInteger)s.getObjectAt(1)).getValue(); + sig[0] = ((ASN1Integer)s.getObjectAt(0)).getValue(); + sig[1] = ((ASN1Integer)s.getObjectAt(1)).getValue(); return sig; } diff --git a/prov/src/test/java/org/bouncycastle/jce/provider/test/PKCS10CertRequestTest.java b/prov/src/test/java/org/bouncycastle/jce/provider/test/PKCS10CertRequestTest.java index 35139c57..115aa3ff 100644 --- a/prov/src/test/java/org/bouncycastle/jce/provider/test/PKCS10CertRequestTest.java +++ b/prov/src/test/java/org/bouncycastle/jce/provider/test/PKCS10CertRequestTest.java @@ -14,7 +14,7 @@ import java.security.spec.RSAPublicKeySpec; import java.util.Hashtable; import java.util.Vector; -import org.bouncycastle.asn1.DERObjectIdentifier; +import org.bouncycastle.asn1.ASN1ObjectIdentifier; import org.bouncycastle.asn1.DEROctetString; import org.bouncycastle.asn1.DERSet; import org.bouncycastle.asn1.cryptopro.CryptoProObjectIdentifiers; @@ -145,7 +145,7 @@ public class PKCS10CertRequestTest /* * we generate a self signed certificate for the sake of testing - SHA224withECDSA */ - private void createECRequest(String algorithm, DERObjectIdentifier algOid, DERObjectIdentifier curveOid) + private void createECRequest(String algorithm, ASN1ObjectIdentifier algOid, ASN1ObjectIdentifier curveOid) throws Exception { ECNamedCurveParameterSpec spec = ECNamedCurveTable.getParameterSpec(curveOid.getId()); @@ -217,7 +217,7 @@ public class PKCS10CertRequestTest } } - private void createECRequest(String algorithm, DERObjectIdentifier algOid) + private void createECRequest(String algorithm, ASN1ObjectIdentifier algOid) throws Exception { ECCurve.Fp curve = new ECCurve.Fp( @@ -521,7 +521,7 @@ public class PKCS10CertRequestTest createECRequest("SHA384withECDSA", X9ObjectIdentifiers.ecdsa_with_SHA384); createECRequest("SHA512withECDSA", X9ObjectIdentifiers.ecdsa_with_SHA512); - createECRequest("SHA1withECDSA", X9ObjectIdentifiers.ecdsa_with_SHA1, new DERObjectIdentifier("1.3.132.0.34")); + createECRequest("SHA1withECDSA", X9ObjectIdentifiers.ecdsa_with_SHA1, new ASN1ObjectIdentifier("1.3.132.0.34")); createECGOSTRequest(); diff --git a/prov/src/test/java/org/bouncycastle/jce/provider/test/PSSTest.java b/prov/src/test/java/org/bouncycastle/jce/provider/test/PSSTest.java index c886c392..44d18abd 100644 --- a/prov/src/test/java/org/bouncycastle/jce/provider/test/PSSTest.java +++ b/prov/src/test/java/org/bouncycastle/jce/provider/test/PSSTest.java @@ -14,7 +14,7 @@ import java.security.spec.PSSParameterSpec; import java.security.spec.RSAPrivateCrtKeySpec; import java.security.spec.RSAPublicKeySpec; -import org.bouncycastle.asn1.DERObjectIdentifier; +import org.bouncycastle.asn1.ASN1ObjectIdentifier; import org.bouncycastle.asn1.nist.NISTObjectIdentifiers; import org.bouncycastle.asn1.x509.X509ObjectIdentifiers; import org.bouncycastle.jce.provider.BouncyCastleProvider; @@ -201,7 +201,7 @@ public class PSSTest rawModeTest("SHA512withRSA/PSS", NISTObjectIdentifiers.id_sha512, priv2048Key, pub2048Key, random); } - private void rawModeTest(String sigName, DERObjectIdentifier digestOID, + private void rawModeTest(String sigName, ASN1ObjectIdentifier digestOID, PrivateKey privKey, PublicKey pubKey, SecureRandom random) throws Exception { byte[] sampleMessage = new byte[1000 + random.nextInt(100)]; diff --git a/prov/src/test/jdk1.3/org/bouncycastle/jce/provider/test/CertTest.java b/prov/src/test/jdk1.3/org/bouncycastle/jce/provider/test/CertTest.java index 1f34764a..7b38b720 100644 --- a/prov/src/test/jdk1.3/org/bouncycastle/jce/provider/test/CertTest.java +++ b/prov/src/test/jdk1.3/org/bouncycastle/jce/provider/test/CertTest.java @@ -2,8 +2,8 @@ package org.bouncycastle.jce.provider.test; import org.bouncycastle.asn1.ASN1EncodableVector; import org.bouncycastle.asn1.ASN1InputStream; -import org.bouncycastle.asn1.DEREnumerated; -import org.bouncycastle.asn1.DERObjectIdentifier; +import org.bouncycastle.asn1.ASN1Enumerated; +import org.bouncycastle.asn1.ASN1ObjectIdentifier; import org.bouncycastle.asn1.DEROctetString; import org.bouncycastle.asn1.DERSequence; import org.bouncycastle.asn1.DERSet; @@ -1555,7 +1555,7 @@ public class CertTest /** * we generate a self signed certificate for the sake of testing - SHA224withECDSA */ - private void createECCert(String algorithm, DERObjectIdentifier algOid) + private void createECCert(String algorithm, ASN1ObjectIdentifier algOid) throws Exception { ECCurve.Fp curve = new ECCurve.Fp( @@ -1751,7 +1751,7 @@ public class CertTest if (ext != null) { - DEREnumerated reasonCode = (DEREnumerated)X509ExtensionUtil.fromExtensionValue(ext); + ASN1Enumerated reasonCode = (ASN1Enumerated)X509ExtensionUtil.fromExtensionValue(ext); if (reasonCode.getValue().intValue() != CRLReason.privilegeWithdrawn) { @@ -1836,7 +1836,7 @@ public class CertTest if (ext != null) { - DEREnumerated reasonCode = (DEREnumerated)X509ExtensionUtil.fromExtensionValue(ext); + ASN1Enumerated reasonCode = (ASN1Enumerated)X509ExtensionUtil.fromExtensionValue(ext); if (reasonCode.getValue().intValue() != CRLReason.privilegeWithdrawn) { @@ -1921,7 +1921,7 @@ public class CertTest if (ext != null) { - DEREnumerated reasonCode = (DEREnumerated)X509ExtensionUtil.fromExtensionValue(ext); + ASN1Enumerated reasonCode = (ASN1Enumerated)X509ExtensionUtil.fromExtensionValue(ext); if (reasonCode.getValue().intValue() != CRLReason.privilegeWithdrawn) { @@ -2171,7 +2171,7 @@ public class CertTest certGen.setPublicKey(pubKey); certGen.setSignatureAlgorithm("MD5WithRSAEncryption"); - certGen.copyAndAddExtension(new DERObjectIdentifier("2.5.29.15"), true, baseCert); + certGen.copyAndAddExtension(new ASN1ObjectIdentifier("2.5.29.15"), true, baseCert); certGen.copyAndAddExtension("2.5.29.37", false, baseCert); X509Certificate cert = certGen.generate(privKey, "BC"); |