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
-
-
Constructor Summary
Constructors Constructor Description Asn1Object(int tag, int length, byte[] value)
Construct a ASN.1 TLV.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description BigInteger
getInteger()
Get the value as integerint
getLength()
DerParser
getParser()
For constructed field, return a parser for its content.String
getString()
Get value as string.int
getType()
byte[]
getValue()
boolean
isConstructed()
-
-
-
Constructor Detail
-
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 Detail
-
getType
public int getType()
-
getLength
public int getLength()
-
getValue
public byte[] getValue()
-
isConstructed
public boolean isConstructed()
-
getParser
public DerParser getParser() throws IOException
For constructed field, return a parser for its content.- Returns:
- A parser for the construct.
- Throws:
IOException
- if problems parsing
-
getInteger
public BigInteger getInteger() throws IOException
Get the value as integer- Returns:
- the integer
- Throws:
IOException
- if problems parsing
-
getString
public String getString() throws IOException
Get value as string. Most strings are treated as Latin-1.- Returns:
- value as string
- Throws:
IOException
- if problems parsing
-
-