public class SM9Cipher extends ASN1Object
SM9Cipher ::= SEQUENCE {
enType INTEGER, -- data-encapsulation type (see below)
C1 BIT STRING, -- the point C1 = [r]Q_B of G1, uncompressed (0x04||x||y)
C3 OCTET STRING, -- the MAC value C3 (32 bytes)
C2 OCTET STRING -- the encapsulated message C2
}
The field order and types (enType INTEGER, C1 BIT STRING, C3/C2 OCTET STRING)
have been cross-checked against the GmSSL and gmsm (emmansun) reference
implementations of GM/T 0080-2020. The GM/T 0080-2020 data-encapsulation type
values are 0 = KDF stream cipher (XOR), 1 = SM4-ECB, 2 = SM4-CBC, 4 = SM4-OFB,
8 = SM4-CFB; BouncyCastle implements the stream (EN_TYPE_STREAM) and
SM4-ECB (EN_TYPE_SM4) modes and rejects the others as unsupported.| Modifier and Type | Field and Description |
|---|---|
static int |
EN_TYPE_SM4
GM/T 0080-2020 data-encapsulation type 1: SM4 in ECB mode.
|
static int |
EN_TYPE_STREAM
GM/T 0080-2020 data-encapsulation type 0: the KDF-based stream cipher (XOR).
|
| Constructor and Description |
|---|
SM9Cipher(int enType,
byte[] c1,
byte[] c3,
byte[] c2) |
| Modifier and Type | Method and Description |
|---|---|
byte[] |
getC1() |
byte[] |
getC2() |
byte[] |
getC3() |
int |
getEnType() |
static SM9Cipher |
getInstance(java.lang.Object o) |
ASN1Primitive |
toASN1Primitive()
Method providing a primitive representation of this object suitable for encoding.
|
encodeTo, encodeTo, equals, getEncoded, getEncoded, hasEncodedTagValue, hashCodepublic static final int EN_TYPE_STREAM
public static final int EN_TYPE_SM4
public static SM9Cipher getInstance(java.lang.Object o)
public int getEnType()
public byte[] getC1()
public byte[] getC3()
public byte[] getC2()
public ASN1Primitive toASN1Primitive()
ASN1ObjecttoASN1Primitive in interface ASN1EncodabletoASN1Primitive in class ASN1Object