Package org.mozilla.jss.asn1
Class ASN1Util
java.lang.Object
org.mozilla.jss.asn1.ASN1Util
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ASN1Value
decode
(ASN1Template template, byte[] encoded) static ASN1Value
decode
(Tag implicitTag, ASN1Template template, byte[] encoded) static byte[]
static byte[]
static byte[]
getECCurveBytesByX509PublicKeyBytes
(byte[] X509PubKeyBytes, boolean withHeader) returns the ECC curve byte array given the X509 public key byte arraystatic 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)private static String
getTagDescriptionByOid
(byte[] oidBA) get OID description JNI methodstatic void
readFully
(byte[] bytes, InputStream istream) Fills a byte array with bytes from an input stream.
-
Constructor Details
-
ASN1Util
public ASN1Util()
-
-
Method Details
-
encode
-
encode
-
decode
- Throws:
InvalidBERException
-
decode
public static ASN1Value decode(Tag implicitTag, ASN1Template template, byte[] encoded) throws InvalidBERException - Throws:
InvalidBERException
-
readFully
Fills a byte array with bytes from an input stream. This method keeps reading until the array is filled, an IOException occurs, or EOF is reached. The byte array will be completely filled unless an exception is thrown.- Parameters:
bytes
- A byte array which will be filled up.istream
- The input stream from which to read the bytes.- Throws:
IOException
- If an IOException occurs reading from the stream, or EOF is reached before the byte array is filled.
-
getECCurveBytesByX509PublicKeyBytes
public static byte[] getECCurveBytesByX509PublicKeyBytes(byte[] X509PubKeyBytes, boolean withHeader) throws IllegalArgumentException, ArrayIndexOutOfBoundsException, NullPointerException returns the ECC curve byte array given the X509 public key byte array- Parameters:
X509PubKeyBytes
- byte array of an X509PubKeywithHeader
- tells if the return byes should inclulde the tag and size header or not- Returns:
- ECC curve byte array.
- Throws:
IllegalArgumentException
ArrayIndexOutOfBoundsException
NullPointerException
-
getOIDdescription
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)- Parameters:
oidBA
- OID byte array.- Returns:
- OID description.
-
getTagDescriptionByOid
get OID description JNI method
-