src/java.base/share/classes/sun/security/util/DerValue.java

Print this page




  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package sun.security.util;
  27 
  28 import java.io.*;
  29 import java.math.BigInteger;
  30 import java.util.Date;
  31 import sun.misc.IOUtils;
  32 
  33 /**
  34  * Represents a single DER-encoded value.  DER encoding rules are a subset
  35  * of the "Basic" Encoding Rules (BER), but they only support a single way
  36  * ("Definite" encoding) to encode any given value.
  37  *
  38  * <P>All DER-encoded data are triples <em>{type, length, data}</em>.  This
  39  * class represents such tagged values as they have been read (or constructed),
  40  * and provides structured access to the encoded data.
  41  *
  42  * <P>At this time, this class supports only a subset of the types of DER
  43  * data encodings which are defined.  That subset is sufficient for parsing
  44  * most X.509 certificates, and working with selected additional formats
  45  * (such as PKCS #10 certificate requests, and some kinds of PKCS #7 data).
  46  *
  47  * A note with respect to T61/Teletex strings: From RFC 1617, section 4.1.3
  48  * and RFC 5280, section 8, we assume that this kind of string will contain
  49  * ISO-8859-1 characters only.
  50  *
  51  *




  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package sun.security.util;
  27 
  28 import java.io.*;
  29 import java.math.BigInteger;
  30 import java.util.Date;

  31 
  32 /**
  33  * Represents a single DER-encoded value.  DER encoding rules are a subset
  34  * of the "Basic" Encoding Rules (BER), but they only support a single way
  35  * ("Definite" encoding) to encode any given value.
  36  *
  37  * <P>All DER-encoded data are triples <em>{type, length, data}</em>.  This
  38  * class represents such tagged values as they have been read (or constructed),
  39  * and provides structured access to the encoded data.
  40  *
  41  * <P>At this time, this class supports only a subset of the types of DER
  42  * data encodings which are defined.  That subset is sufficient for parsing
  43  * most X.509 certificates, and working with selected additional formats
  44  * (such as PKCS #10 certificate requests, and some kinds of PKCS #7 data).
  45  *
  46  * A note with respect to T61/Teletex strings: From RFC 1617, section 4.1.3
  47  * and RFC 5280, section 8, we assume that this kind of string will contain
  48  * ISO-8859-1 characters only.
  49  *
  50  *