Class DerParser
- java.lang.Object
-
- org.jenkinsci.main.modules.instance_identity.pem.DerParser
-
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public class DerParser extends Object
A bare-minimum ASN.1 DER decoder, just having enough functions to decode PKCS#1 private keys. Especially, it doesn't handle explicitly tagged types with an outer tag.This parser can only handle one layer. To parse nested constructs, get a new parser for each layer using
Asn1Object.getParser()
.There are many DER decoders in JRE but using them will tie this program to a specific JCE/JVM.
- Author:
- zhang
-
-
Field Summary
Fields Modifier and Type Field Description static int
ANY
static int
APPLICATION
static int
BIT_STRING
static int
BMP_STRING
static int
BOOLEAN
static int
CONSTRUCTED
static int
CONTEXT
static int
ENUMERATED
static int
GENERAL_STRING
static int
GENERALIZED_TIME
static int
GRAPHIC_STRING
static int
IA5_STRING
protected InputStream
in
static int
INTEGER
static int
ISO646_STRING
static int
NULL
static int
NUMERIC_STRING
static int
OBJECT_IDENTIFIER
static int
OCTET_STRING
static int
PRINTABLE_STRING
static int
PRIVATE
static int
REAL
static int
RELATIVE_OID
static int
SEQUENCE
static int
SET
static int
T61_STRING
static int
UNIVERSAL
static int
UNIVERSAL_STRING
static int
UTC_TIME
static int
UTF8_STRING
static int
VIDEOTEX_STRING
-
Constructor Summary
Constructors Constructor Description DerParser(byte[] bytes)
Create a new DER decoder from a byte array.DerParser(InputStream in)
Create a new DER decoder from an input stream.
-
-
-
Field Detail
-
UNIVERSAL
public static final int UNIVERSAL
- See Also:
- Constant Field Values
-
APPLICATION
public static final int APPLICATION
- See Also:
- Constant Field Values
-
CONTEXT
public static final int CONTEXT
- See Also:
- Constant Field Values
-
PRIVATE
public static final int PRIVATE
- See Also:
- Constant Field Values
-
CONSTRUCTED
public static final int CONSTRUCTED
- See Also:
- Constant Field Values
-
ANY
public static final int ANY
- See Also:
- Constant Field Values
-
BOOLEAN
public static final int BOOLEAN
- See Also:
- Constant Field Values
-
INTEGER
public static final int INTEGER
- See Also:
- Constant Field Values
-
BIT_STRING
public static final int BIT_STRING
- See Also:
- Constant Field Values
-
OCTET_STRING
public static final int OCTET_STRING
- See Also:
- Constant Field Values
-
NULL
public static final int NULL
- See Also:
- Constant Field Values
-
OBJECT_IDENTIFIER
public static final int OBJECT_IDENTIFIER
- See Also:
- Constant Field Values
-
REAL
public static final int REAL
- See Also:
- Constant Field Values
-
ENUMERATED
public static final int ENUMERATED
- See Also:
- Constant Field Values
-
RELATIVE_OID
public static final int RELATIVE_OID
- See Also:
- Constant Field Values
-
SEQUENCE
public static final int SEQUENCE
- See Also:
- Constant Field Values
-
SET
public static final int SET
- See Also:
- Constant Field Values
-
NUMERIC_STRING
public static final int NUMERIC_STRING
- See Also:
- Constant Field Values
-
PRINTABLE_STRING
public static final int PRINTABLE_STRING
- See Also:
- Constant Field Values
-
T61_STRING
public static final int T61_STRING
- See Also:
- Constant Field Values
-
VIDEOTEX_STRING
public static final int VIDEOTEX_STRING
- See Also:
- Constant Field Values
-
IA5_STRING
public static final int IA5_STRING
- See Also:
- Constant Field Values
-
GRAPHIC_STRING
public static final int GRAPHIC_STRING
- See Also:
- Constant Field Values
-
ISO646_STRING
public static final int ISO646_STRING
- See Also:
- Constant Field Values
-
GENERAL_STRING
public static final int GENERAL_STRING
- See Also:
- Constant Field Values
-
UTF8_STRING
public static final int UTF8_STRING
- See Also:
- Constant Field Values
-
UNIVERSAL_STRING
public static final int UNIVERSAL_STRING
- See Also:
- Constant Field Values
-
BMP_STRING
public static final int BMP_STRING
- See Also:
- Constant Field Values
-
UTC_TIME
public static final int UTC_TIME
- See Also:
- Constant Field Values
-
GENERALIZED_TIME
public static final int GENERALIZED_TIME
- See Also:
- Constant Field Values
-
in
protected final InputStream in
-
-
Constructor Detail
-
DerParser
public DerParser(InputStream in) throws IOException
Create a new DER decoder from an input stream.- Parameters:
in
- The DER encoded stream- Throws:
IOException
- if problems parsing
-
DerParser
public DerParser(byte[] bytes) throws IOException
Create a new DER decoder from a byte array.- Parameters:
bytes
- the encoded bytes- Throws:
IOException
- if problems parsing
-
-
Method Detail
-
read
public Asn1Object read() throws IOException
Read next object. If it's constructed, the value holds encoded content and it should be parsed by a new parser fromAsn1Object.getParser
.- Returns:
- parsed object
- Throws:
IOException
- if problems parsing
-
-