Return-Path: Delivered-To: apmail-incubator-harmony-commits-archive@www.apache.org Received: (qmail 13671 invoked from network); 9 Jun 2006 08:12:24 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 9 Jun 2006 08:12:24 -0000 Received: (qmail 9757 invoked by uid 500); 9 Jun 2006 08:12:20 -0000 Delivered-To: apmail-incubator-harmony-commits-archive@incubator.apache.org Received: (qmail 9673 invoked by uid 500); 9 Jun 2006 08:12:19 -0000 Mailing-List: contact harmony-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: harmony-dev@incubator.apache.org Delivered-To: mailing list harmony-commits@incubator.apache.org Received: (qmail 9638 invoked by uid 99); 9 Jun 2006 08:12:19 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 09 Jun 2006 01:12:19 -0700 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [140.211.166.113] (HELO eris.apache.org) (140.211.166.113) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 09 Jun 2006 01:12:18 -0700 Received: by eris.apache.org (Postfix, from userid 65534) id 86C031A983A; Fri, 9 Jun 2006 01:11:58 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r412971 - in /incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/asn1: ASN1StringType.java BerInputStream.java DerInputStream.java Date: Fri, 09 Jun 2006 08:11:57 -0000 To: harmony-commits@incubator.apache.org From: smishura@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20060609081158.86C031A983A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: smishura Date: Fri Jun 9 01:11:55 2006 New Revision: 412971 URL: http://svn.apache.org/viewvc?rev=412971&view=rev Log: Move string indentifiers verification to decoder stream Modified: incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/asn1/ASN1StringType.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/ASN1StringType.java URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/asn1/ASN1StringType.java?rev=412971&r1=412970&r2=412971&view=diff ============================================================================== --- incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/asn1/ASN1StringType.java (original) +++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/asn1/ASN1StringType.java Fri Jun 9 01:11:55 2006 @@ -101,14 +101,8 @@ } public Object decode(BerInputStream in) throws IOException { - if (!checkTag(in.tag)) { - //FIXME message: what about constr tag? - throw new ASN1Exception("ASN.1 String is expected at [" - + in.tagOffset + "]. Expected tag: " - + Integer.toHexString(id) + " but encountered tag " - + Integer.toHexString(in.tag)); - } - in.readString(); + + in.readString(this); if (in.isVerify) { return null; 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=412971&r1=412970&r2=412971&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 Fri Jun 9 01:11:55 2006 @@ -804,14 +804,18 @@ * * @throws IOException - if an I/O error occurs or the end of the stream is reached */ - public void readString() throws IOException { + public void readString(ASN1StringType type) throws IOException { //FIXME check string content - if ((tag & ASN1Constants.PC_CONSTRUCTED) == 0) { + if (tag == type.id) { readContent(); - } else { + } else if (tag == type.constrId) { throw new ASN1Exception("Decoding constructed ASN.1 string " + " type is not provided"); + } else { + throw new ASN1Exception( + "ASN.1 string type 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=412971&r1=412970&r2=412971&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 Fri Jun 9 01:11:55 2006 @@ -146,13 +146,13 @@ /** * @see org.apache.harmony.security.asn1.BerInputStream#readString() */ - public void readString() throws IOException { + public void readString(ASN1StringType type) throws IOException { - if ((tag & ASN1Constants.PC_CONSTRUCTED) != 0) { - throw new ASN1Exception( - "DER: ASN.1 string type MUST have primitive encoding"); + if (tag == type.constrId) { + throw new ASN1Exception("ASN.1 string: constructed identifier at [" + + tagOffset + "]. Not valid for DER."); } - super.readString(); + super.readString(type); } /**