Class Asn1Object
java.lang.Object
org.jenkinsci.main.modules.instance_identity.pem.Asn1Object
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class)
public class Asn1Object
extends Object
An ASN.1 TLV. The object is not parsed. It can only handle integers and strings.
- Author:
- zhang
-
Field Details
-
type
protected final int type -
length
protected final int length -
value
protected final byte[] value -
tag
protected final int tag
-
-
Constructor Details
-
Asn1Object
public Asn1Object(int tag, int length, byte[] value) Construct a ASN.1 TLV. The TLV could be either a constructed or primitive entity.The first byte in DER encoding is made of following fields,
------------------------------------------------- |Bit 8|Bit 7|Bit 6|Bit 5|Bit 4|Bit 3|Bit 2|Bit 1| ------------------------------------------------- | Class | CF | + Type | -------------------------------------------------
- Class: Universal, Application, Context or Private
- CF: Constructed flag. If 1, the field is constructed.
- Type: This is actually called tag in ASN.1. It indicates data type (Integer, String) or a construct (sequence, choice, set).
- Parameters:
tag
- Tag or Identifierlength
- Length of the fieldvalue
- Encoded octet string for the field.
-
-
Method Details
-
getType
public int getType() -
getLength
public int getLength() -
getValue
public byte[] getValue() -
isConstructed
public boolean isConstructed() -
getParser
For constructed field, return a parser for its content.- Returns:
- A parser for the construct.
- Throws:
IOException
- if problems parsing
-
getInteger
Get the value as integer- Returns:
- the integer
- Throws:
IOException
- if problems parsing
-
getString
Get value as string. Most strings are treated as Latin-1.- Returns:
- value as string
- Throws:
IOException
- if problems parsing
-