public class DEREncoder extends Object implements ASN1Encoder
Constructor and Description |
---|
DEREncoder()
Create a DER encoder.
|
Modifier and Type | Method and Description |
---|---|
void |
encodeBitString(BigInteger integer)
Encode an ASN.1 bit string where the value represents the binary form of the given
integer . |
void |
encodeBitString(BitSet bitSet)
Encode an ASN.1 bit string value.
|
void |
encodeBitString(byte[] str)
Encode an ASN.1 bit string value.
|
void |
encodeBitString(byte[] str,
int numUnusedBits)
Encode an ASN.1 bit string value.
|
void |
encodeBitString(EnumSet<?> enumSet)
Encode an enum set as an ASN.1 bit string, with each ordinal value of the set representing a single bit.
|
void |
encodeBitString(String binaryStr)
Encode an ASN.1 bit string value.
|
void |
encodeBMPString(String str)
Encode an ASN.1 BMPString string value.
|
void |
encodeBoolean(boolean value)
Encode an ASN.1
boolean value. |
void |
encodeGeneralizedTime(ZonedDateTime time)
Encode an ASN.1 GeneralizedTime type.
|
void |
encodeIA5String(byte[] str)
Encode an ASN.1 IA5 string value.
|
void |
encodeIA5String(String str)
Encode an ASN.1 IA5 string value.
|
void |
encodeImplicit(int number)
Indicate that the next encode operation should encode an ASN.1 value using
the given implicit, context-specific tag.
|
void |
encodeImplicit(int clazz,
int number)
Indicate that the next encode operation should encode an ASN.1 value using
the given implicit tag.
|
void |
encodeInteger(BigInteger integer)
Encode an ASN.1
integer value. |
void |
encodeNull()
Encode an ASN.1 null value.
|
void |
encodeObjectIdentifier(String objectIdentifier)
Encode an ASN.1 object identifier value.
|
void |
encodeOctetString(byte[] str)
Encode an ASN.1 octet string value.
|
void |
encodeOctetString(String str)
Encode an ASN.1 octet string value.
|
void |
encodePrintableString(byte[] str)
Encode an ASN.1 printable string value.
|
void |
encodePrintableString(String str)
Encode an ASN.1 printable string value.
|
void |
encodeUniversalString(String str)
Encode an ASN.1 UniversalString string value.
|
void |
encodeUTF8String(String str)
Encode an ASN.1 UTF8String string value.
|
void |
endExplicit()
Finish encoding an ASN.1 explicitly tagged element.
|
void |
endSequence()
Finish encoding an ASN.1 sequence.
|
void |
endSet()
Finish encoding an ASN.1 set.
|
void |
endSetOf()
Finish encoding an ASN.1 "set of" element.
|
void |
flush()
Flush the encoder, writing any saved ASN.1 encoded values to the target destination.
|
byte[] |
getEncoded()
Get the ASN.1 encoded bytes.
|
void |
startExplicit(int number)
Start encoding an ASN.1 explicitly tagged element.
|
void |
startExplicit(int clazz,
int number)
Start encoding an ASN.1 explicitly tagged element.
|
void |
startSequence()
Start encoding an ASN.1 sequence.
|
void |
startSet()
Start encoding an ASN.1 set.
|
void |
startSetOf()
Start encoding an ASN.1 "set of" element.
|
void |
writeEncoded(byte[] encoded)
Write an already encoded ASN.1 value to the target destination.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
encodeInteger
public void startSequence()
ASN1Encoder
ASN1Encoder.endSequence()
is called.startSequence
in interface ASN1Encoder
public void startSet()
ASN1Encoder
ASN1Encoder.endSet()
is called.startSet
in interface ASN1Encoder
public void startSetOf()
ASN1Encoder
ASN1Encoder.endSetOf()
is called.startSetOf
in interface ASN1Encoder
public void startExplicit(int number)
ASN1Encoder
ASN1Encoder.endExplicit()
is called.startExplicit
in interface ASN1Encoder
number
- the tag number for the explicit, context-specific tagpublic void startExplicit(int clazz, int number)
ASN1Encoder
ASN1Encoder.endExplicit()
is called.startExplicit
in interface ASN1Encoder
clazz
- the class for the explicit tagnumber
- the tag number for the explicit tagpublic void endSequence() throws IllegalStateException
ASN1Encoder
endSequence
in interface ASN1Encoder
IllegalStateException
- if there is no sequence to endpublic void endExplicit() throws IllegalStateException
ASN1Encoder
endExplicit
in interface ASN1Encoder
IllegalStateException
- if there is no explicitly tagged element to endpublic void endSet() throws IllegalStateException
ASN1Encoder
endSet
in interface ASN1Encoder
IllegalStateException
- if there is no set to endpublic void endSetOf() throws IllegalStateException
ASN1Encoder
endSetOf
in interface ASN1Encoder
IllegalStateException
- if there is no set to endpublic void encodeOctetString(String str)
ASN1Encoder
encodeOctetString
in interface ASN1Encoder
str
- the octet string to encodepublic void encodeOctetString(byte[] str)
ASN1Encoder
encodeOctetString
in interface ASN1Encoder
str
- the byte array containing the octet string to encodepublic void encodeIA5String(String str)
ASN1Encoder
encodeIA5String
in interface ASN1Encoder
str
- the IA5 string to encodepublic void encodeIA5String(byte[] str)
ASN1Encoder
encodeIA5String
in interface ASN1Encoder
str
- the byte array containing IA5 string to encodepublic void encodePrintableString(byte[] str)
ASN1Encoder
encodePrintableString
in interface ASN1Encoder
str
- the byte array containing the printable string to encodepublic void encodePrintableString(String str)
ASN1Encoder
encodePrintableString
in interface ASN1Encoder
str
- the printable string to encodepublic void encodeUTF8String(String str)
ASN1Encoder
encodeUTF8String
in interface ASN1Encoder
str
- the string to encodepublic void encodeBMPString(String str)
ASN1Encoder
encodeBMPString
in interface ASN1Encoder
str
- the string to encodepublic void encodeUniversalString(String str)
ASN1Encoder
encodeUniversalString
in interface ASN1Encoder
str
- the string to encodepublic void encodeBitString(byte[] str)
ASN1Encoder
encodeBitString
in interface ASN1Encoder
str
- the byte array containing the bit string to encode (all bits in the bit string will be used)public void encodeBitString(byte[] str, int numUnusedBits)
ASN1Encoder
encodeBitString
in interface ASN1Encoder
str
- the byte array containing the bit string to encodenumUnusedBits
- the number of unused bits in the byte arraypublic void encodeBitString(EnumSet<?> enumSet)
ASN1Encoder
encodeBitString
in interface ASN1Encoder
enumSet
- the enum set (must not be null
)public void encodeBitString(BitSet bitSet)
ASN1Encoder
encodeBitString
in interface ASN1Encoder
bitSet
- the bit set (must not be null
)public void encodeBitString(String binaryStr)
ASN1Encoder
encodeBitString
in interface ASN1Encoder
binaryStr
- the bit string to encode, as a binary stringpublic void encodeBitString(BigInteger integer)
ASN1Encoder
integer
.encodeBitString
in interface ASN1Encoder
integer
- the integer to encode as a binary stringpublic void encodeGeneralizedTime(ZonedDateTime time)
ASN1Encoder
encodeGeneralizedTime
in interface ASN1Encoder
time
- the time to encode (must not be null
)public void encodeObjectIdentifier(String objectIdentifier) throws ASN1Exception
ASN1Encoder
encodeObjectIdentifier
in interface ASN1Encoder
objectIdentifier
- the object identifier to encodeASN1Exception
- if the given object identifier is invalidpublic void encodeNull()
ASN1Encoder
encodeNull
in interface ASN1Encoder
public void encodeImplicit(int number)
ASN1Encoder
encodeImplicit
in interface ASN1Encoder
number
- the tag number for the implicit, context-specific tagpublic void encodeImplicit(int clazz, int number)
ASN1Encoder
encodeImplicit
in interface ASN1Encoder
clazz
- the class for the implicit tagnumber
- the tag number for the implicit tagpublic void encodeBoolean(boolean value)
ASN1Encoder
boolean
value.encodeBoolean
in interface ASN1Encoder
value
- the boolean to encodepublic void encodeInteger(BigInteger integer)
ASN1Encoder
integer
value.encodeInteger
in interface ASN1Encoder
integer
- the integer to encodepublic void writeEncoded(byte[] encoded)
ASN1Encoder
writeEncoded
in interface ASN1Encoder
encoded
- the encoded ASN.1 value to writepublic void flush()
ASN1Encoder
flush
in interface Flushable
flush
in interface ASN1Encoder
public byte[] getEncoded()
ASN1Encoder
getEncoded
in interface ASN1Encoder
Copyright © 2021 JBoss by Red Hat. All rights reserved.