Class SM9Engine

java.lang.Object
org.bouncycastle.crypto.engines.SM9Engine

public class SM9Engine extends Object
The SM9 public key encryption algorithm (GM/T 0044.4-2016, clause 7). Two data-encapsulation methods are supported: a KDF-based stream cipher (SM9Engine.Mode.STREAM) and SM4 in ECB mode with PKCS#7 padding (SM9Engine.Mode.SM4). The ciphertext is C = C1 || C3 || C2, where C1 is the G1 point [r]Q_B encoded as x||y, C3 = MAC(K2, C2), and C2 is the encapsulated message.

Usage follows the SM2Engine pattern: construct with the desired mode, init(true, new ParametersWithRandom(recipientKey, random)) to encrypt or init(false, userKey) to decrypt, then processBlock(byte[], int, int).