public class ASN1 extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
ASN1.TagValue
This class is used internal to the ASN.1 decoding functions.
|
| Modifier and Type | Field and Description |
|---|---|
static byte[] |
oid_ecPublicKey |
static byte[] |
Oid_Ed25519 |
static byte[] |
Oid_Ed448 |
static byte[] |
Oid_secp256r1 |
static byte[] |
Oid_secp384r1 |
static byte[] |
Oid_secp521r1 |
static byte[] |
Oid_X25519 |
static byte[] |
Oid_X448 |
| Constructor and Description |
|---|
ASN1() |
| Modifier and Type | Method and Description |
|---|---|
static byte[] |
AlgorithmIdentifier(byte[] oid,
byte[] params) |
static ASN1.TagValue |
DecodeCompound(int offset,
byte[] encoding)
Decode an array of bytes which is supposed to be an ASN.1 encoded structure.
|
static ArrayList<ASN1.TagValue> |
DecodePKCS8(byte[] encodedData)
Decode an EC PKCS#8 private key structure
|
static ArrayList<ASN1.TagValue> |
DecodeSubjectPublicKeyInfo(byte[] encoding) |
static byte[] |
EncodeEcPrivateKey(byte[] oid,
byte[] keyBytes,
byte[] spki)
Encode an EC Private key
|
static byte[] |
EncodeOctetString(byte[] data) |
static byte[] |
EncodePKCS8(byte[] algorithm,
byte[] keyBytes,
byte[] spki)
Encode a private key into a PKCS#8 private key structure.
|
static byte[] |
EncodeSignature(byte[] r,
byte[] s) |
static byte[] |
EncodeSubjectPublicKeyInfo(byte[] algorithm,
byte[] keyBytes)
Encode a subject public key info structure from an OID and the data bytes
for the key
This function assumes that we are encoding an EC Public key.d
|
public static final byte[] Oid_secp256r1
public static final byte[] Oid_secp384r1
public static final byte[] Oid_secp521r1
public static final byte[] oid_ecPublicKey
public static final byte[] Oid_X25519
public static final byte[] Oid_X448
public static final byte[] Oid_Ed25519
public static final byte[] Oid_Ed448
public static byte[] EncodeSubjectPublicKeyInfo(byte[] algorithm,
byte[] keyBytes)
throws CoseException
algorithm - - encoded Object IdentifierkeyBytes - - encoded key bytesCoseException - - ASN encoding error.public static byte[] EncodeEcPrivateKey(byte[] oid,
byte[] keyBytes,
byte[] spki)
throws CoseException
oid - - curve to usekeyBytes - - bytes of the keyspki - - optional SPKICoseException - - from lower levelpublic static ArrayList<ASN1.TagValue> DecodeSubjectPublicKeyInfo(byte[] encoding) throws CoseException
CoseExceptionpublic static ASN1.TagValue DecodeCompound(int offset, byte[] encoding) throws CoseException
offset - - starting offset in array to begin decodingencoding - - bytes of the ASN.1 encoded valueCoseException - - ASN.1 encoding errorspublic static byte[] EncodePKCS8(byte[] algorithm,
byte[] keyBytes,
byte[] spki)
throws CoseException
algorithm - - EC curve OIDkeyBytes - - raw bytes of the keyspki - - optional subject public key info structure to includeCoseException - - ASN.1 encoding errorspublic static ArrayList<ASN1.TagValue> DecodePKCS8(byte[] encodedData) throws CoseException
encodedData - bytes containing the private keyCoseException - - ASN.1 encoding errorspublic static byte[] EncodeSignature(byte[] r,
byte[] s)
throws CoseException
CoseExceptionpublic static byte[] EncodeOctetString(byte[] data)
throws CoseException
CoseExceptionpublic static byte[] AlgorithmIdentifier(byte[] oid,
byte[] params)
throws CoseException
CoseExceptionCOSE for Java documentation, generatedin 2018.