You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by sm...@apache.org on 2006/06/05 08:48:32 UTC
svn commit: r411691 - in
/incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/asn1:
ASN1Constants.java BerInputStream.java DerInputStream.java
Author: smishura
Date: Sun Jun 4 23:48:32 2006
New Revision: 411691
URL: http://svn.apache.org/viewvc?rev=411691&view=rev
Log:
Adding constructed identifiers to constants
Modified:
incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/asn1/ASN1Constants.java
incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/asn1/BerInputStream.java
incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/asn1/DerInputStream.java
Modified: incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/asn1/ASN1Constants.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/asn1/ASN1Constants.java?rev=411691&r1=411690&r2=411691&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/asn1/ASN1Constants.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/asn1/ASN1Constants.java Sun Jun 4 23:48:32 2006
@@ -59,7 +59,7 @@
int TAG_UTF8STRING = 12;
int TAG_RELATIVEOID = 13;
int TAG_SEQUENCE = 16;
- int TAG_SEQENCEOF = TAG_SEQUENCE;
+ int TAG_SEQUENCEOF = TAG_SEQUENCE;
int TAG_SET = 17;
int TAG_SETOF = TAG_SET;
int TAG_NUMERICSTRING = 18;
@@ -76,6 +76,16 @@
int TAG_GENERALSTRING = 27;
int TAG_UNIVERSALSTRING = 28;
int TAG_BMPSTRING = 30;
+
+ int TAG_C_BITSTRING = TAG_BITSTRING | PC_CONSTRUCTED;
+ int TAG_C_OCTETSTRING = TAG_OCTETSTRING | PC_CONSTRUCTED;
+ int TAG_C_UTF8STRING = TAG_UTF8STRING | PC_CONSTRUCTED;
+ int TAG_C_SEQUENCE = TAG_SEQUENCE | PC_CONSTRUCTED;
+ int TAG_C_SEQUENCEOF = TAG_SEQUENCEOF | PC_CONSTRUCTED;
+ int TAG_C_SET = TAG_SET | PC_CONSTRUCTED;
+ int TAG_C_SETOF = TAG_SETOF | PC_CONSTRUCTED;
+ int TAG_C_UTCTIME = TAG_UTCTIME | PC_CONSTRUCTED;
+ int TAG_C_GENERALIZEDTIME = TAG_GENERALIZEDTIME | PC_CONSTRUCTED;
/**
* Not from the ASN.1 specs. For implementation purposes.
Modified: incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/asn1/BerInputStream.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/asn1/BerInputStream.java?rev=411691&r1=411690&r2=411691&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/asn1/BerInputStream.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/asn1/BerInputStream.java Sun Jun 4 23:48:32 2006
@@ -273,7 +273,7 @@
+ "]. For empty string unused bits MUST be 0");
}
- } else if (tag == (ASN1Constants.TAG_BITSTRING | ASN1Constants.PC_CONSTRUCTED)) {
+ } else if (tag == ASN1Constants.TAG_C_BITSTRING) {
throw new ASN1Exception("Decoding constructed ASN.1 bitstring "
+ " type is not provided");
} else {
@@ -420,7 +420,7 @@
}
// FIXME check all values for valid numbers!!!
- } else if (tag == (ASN1Constants.TAG_GENERALIZEDTIME | ASN1Constants.PC_CONSTRUCTED)) {
+ } else if (tag == ASN1Constants.TAG_C_GENERALIZEDTIME) {
throw new ASN1Exception(
"Decoding constructed ASN.1 GeneralizedTime"
+ " type is not provided");
@@ -488,7 +488,7 @@
}
// FIXME check all time values for valid numbers!!!
- } else if (tag == (ASN1Constants.TAG_UTCTIME | ASN1Constants.PC_CONSTRUCTED)) {
+ } else if (tag == ASN1Constants.TAG_C_UTCTIME) {
throw new ASN1Exception("Decoding constructed ASN.1 UTCTime"
+ " type is not provided");
} else {
@@ -561,7 +561,7 @@
if (tag == ASN1Constants.TAG_OCTETSTRING) {
readContent();
- } else if (tag == (ASN1Constants.TAG_OCTETSTRING | ASN1Constants.PC_CONSTRUCTED)) {
+ } else if (tag == ASN1Constants.TAG_C_OCTETSTRING) {
throw new ASN1Exception("Decoding constructed ASN.1 octet string "
+ " type is not provided");
} else {
@@ -629,7 +629,7 @@
*/
public void readSequence(ASN1Sequence sequence) throws IOException {
- if (tag != (ASN1Constants.TAG_SEQUENCE | ASN1Constants.PC_CONSTRUCTED)) {
+ if (tag != ASN1Constants.TAG_C_SEQUENCE) {
throw new ASN1Exception(
"ASN.1 sequence identifier is expected at [" + tagOffset
+ "], but encountered: " + Integer.toHexString(tag));
@@ -722,7 +722,7 @@
*/
public void readSequenceOf(ASN1SequenceOf sequenceOf) throws IOException {
- if (tag != (ASN1Constants.TAG_SEQENCEOF | ASN1Constants.PC_CONSTRUCTED)) {
+ if (tag != ASN1Constants.TAG_C_SEQUENCEOF) {
throw new ASN1Exception(
"ASN.1 sequenceOf identifier is expected at [" + tagOffset
+ "], but encountered: " + Integer.toHexString(tag));
@@ -739,7 +739,7 @@
*/
public void readSet(ASN1Set set) throws IOException {
- if (tag != (ASN1Constants.TAG_SET | ASN1Constants.PC_CONSTRUCTED)) {
+ if (tag != ASN1Constants.TAG_C_SET) {
throw new ASN1Exception("ASN.1 set identifier is expected at ["
+ tagOffset + "], but encountered: "
+ Integer.toHexString(tag));
@@ -756,7 +756,7 @@
*/
public void readSetOf(ASN1SetOf setOf) throws IOException {
- if (tag != (ASN1Constants.TAG_SETOF | ASN1Constants.PC_CONSTRUCTED)) {
+ if (tag != ASN1Constants.TAG_C_SETOF) {
throw new ASN1Exception("ASN.1 setOf identifier is expected at ["
+ tagOffset + "], but encountered: "
+ Integer.toHexString(tag));
Modified: incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/asn1/DerInputStream.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/asn1/DerInputStream.java?rev=411691&r1=411690&r2=411691&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/asn1/DerInputStream.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/asn1/DerInputStream.java Sun Jun 4 23:48:32 2006
@@ -81,7 +81,7 @@
*/
public void readBitString() throws IOException {
- if ((tag & ASN1Constants.PC_CONSTRUCTED) != 0) {
+ if (tag == ASN1Constants.TAG_C_BITSTRING) {
throw new ASN1Exception(
"DER: ASN.1 Bitstring type MUST have primitive encoding");
}
@@ -109,7 +109,7 @@
*/
public void readOctetString() throws IOException {
- if ((tag & ASN1Constants.PC_CONSTRUCTED) != 0) {
+ if (tag == ASN1Constants.TAG_C_OCTETSTRING) {
throw new ASN1Exception(
"ASN.1 octetstring: constructed identifier at ["
+ tagOffset + "]. Not valid for DER.");
@@ -160,7 +160,7 @@
*/
public void readUTCTime() throws IOException {
- if ((tag & ASN1Constants.PC_CONSTRUCTED) != 0) {
+ if (tag == ASN1Constants.TAG_C_UTCTIME) {
// It is a string type and it can be encoded as primitive or constructed.
throw new ASN1Exception(
"ASN.1 UTCTime: constructed identifier at [" + tagOffset
@@ -182,7 +182,7 @@
*/
public void readGeneralizedTime() throws IOException {
- if ((tag & ASN1Constants.PC_CONSTRUCTED) != 0) {
+ if (tag == ASN1Constants.TAG_C_GENERALIZEDTIME) {
// It is a string type and it can be encoded as primitive or constructed.
throw new ASN1Exception(
"ASN.1 GeneralizedTime: constructed identifier at ["