public class ASN1Util
extends java.lang.Object
Constructor and Description |
---|
ASN1Util() |
Modifier and Type | Method and Description |
---|---|
static ASN1Value |
decode(ASN1Template template,
byte[] encoded) |
static ASN1Value |
decode(Tag implicitTag,
ASN1Template template,
byte[] encoded) |
static byte[] |
encode(ASN1Value val) |
static byte[] |
encode(Tag implicitTag,
ASN1Value val) |
static byte[] |
getECCurveBytesByX509PublicKeyBytes(byte[] X509PubKeyBytes,
boolean withHeader)
returns the ECC curve byte array given the X509 public key byte array
|
static java.lang.String |
getOIDdescription(byte[] oidBA)
getOIDdescription() returns a text description of the OID
from OID byte array
the OID byte array is expected to be without the OID Tag (6) and size
(together 2 bytes)
|
static void |
readFully(byte[] bytes,
java.io.InputStream istream)
Fills a byte array with bytes from an input stream.
|
public static byte[] encode(ASN1Value val)
public static ASN1Value decode(ASN1Template template, byte[] encoded) throws InvalidBERException
InvalidBERException
public static ASN1Value decode(Tag implicitTag, ASN1Template template, byte[] encoded) throws InvalidBERException
InvalidBERException
public static void readFully(byte[] bytes, java.io.InputStream istream) throws java.io.IOException
bytes
- A byte array which will be filled up.istream
- The input stream from which to read the bytes.java.io.IOException
- If an IOException occurs reading from the
stream, or EOF is reached before the byte array is filled.public static byte[] getECCurveBytesByX509PublicKeyBytes(byte[] X509PubKeyBytes, boolean withHeader) throws java.lang.IllegalArgumentException, java.lang.ArrayIndexOutOfBoundsException, java.lang.NullPointerException
X509PubKeyBytes
- byte array of an X509PubKeywithHeader
- tells if the return byes should inclulde the tag and size header or notjava.lang.IllegalArgumentException
java.lang.ArrayIndexOutOfBoundsException
java.lang.NullPointerException
public static java.lang.String getOIDdescription(byte[] oidBA)
oidBA
- OID byte array.