public static byte[] encrypt(ECPublicKeyParameters pubKeyParameters, byte[] srcData)
        throws InvalidCipherTextException {
        SM2Engine engine = new SM2Engine();
        ParametersWithRandom pwr = new ParametersWithRandom(pubKeyParameters, new SecureRandom());
        engine.init(true, pwr);
        return engine.processBlock(srcData, 0, srcData.length);
    }
public static byte [ ] encrypt ( ECPublicKeyParameters pubKeyParameters , byte [ ] srcData ) throws InvalidCipherTextException { SM2Engine engine = new SM2Engine ( ) ; ParametersWithRandom pwr = new ParametersWithRandom ( pubKeyParameters , new SecureRandom ( ) ) ; engine . init ( true , pwr ) ; return engine . processBlock ( srcData , 0 , srcData . length ) ; }
ECC公钥加密

@param pubKeyParameters ECC公钥
@param srcData          源数据
@return SM2密文，实际包含三部分：ECC公钥、真正的密文、公钥和原文的SM3-HASH值
@throws InvalidCipherTextException