Class StandardSm2Engine

java.lang.Object
cn.sinozg.applet.common.core.model.StandardSm2Engine

public class StandardSm2Engine extends Object
Since:
2024-12-03 13:55
Author:
xieyubin
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private int
     
    private final org.bouncycastle.crypto.Digest
     
    private org.bouncycastle.crypto.params.ECKeyParameters
     
    private org.bouncycastle.crypto.params.ECDomainParameters
     
    private boolean
     
    private final org.bouncycastle.crypto.engines.SM2Engine.Mode
     
    private SecureRandom
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
    StandardSm2Engine(org.bouncycastle.crypto.Digest digest)
     
    StandardSm2Engine(org.bouncycastle.crypto.Digest digest, org.bouncycastle.crypto.engines.SM2Engine.Mode mode)
     
    StandardSm2Engine(org.bouncycastle.crypto.engines.SM2Engine.Mode mode)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    private void
    addFieldElement(org.bouncycastle.crypto.Digest digest, org.bouncycastle.math.ec.ECFieldElement v)
     
    private byte[]
    convertToAsn1(org.bouncycastle.math.ec.ECPoint c1P, byte[] c2, byte[] c3)
     
    protected org.bouncycastle.math.ec.ECMultiplier
     
    private byte[]
    decrypt(byte[] in, int inOff, int inLen)
    解密
    private byte[]
    encrypt(byte[] in, int inOff, int inLen)
    加密
    int
    getOutputSize(int inputLen)
     
    void
    init(boolean forEncryption, org.bouncycastle.crypto.CipherParameters param)
     
    private void
    kdf(org.bouncycastle.crypto.Digest digest, org.bouncycastle.math.ec.ECPoint c1, byte[] encData)
     
    private BigInteger
     
    private boolean
    notEncrypted(byte[] encData, byte[] in, int inOff)
     
    byte[]
    processBlock(byte[] in, int inOff, int inLen)
     
    private void
    xor(byte[] data, byte[] kdfOut, int dOff, int dRemaining)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • digest

      private final org.bouncycastle.crypto.Digest digest
    • mode

      private final org.bouncycastle.crypto.engines.SM2Engine.Mode mode
    • forEncryption

      private boolean forEncryption
    • ecKey

      private org.bouncycastle.crypto.params.ECKeyParameters ecKey
    • ecParams

      private org.bouncycastle.crypto.params.ECDomainParameters ecParams
    • curveLength

      private int curveLength
    • random

      private SecureRandom random
  • Constructor Details

    • StandardSm2Engine

      public StandardSm2Engine()
    • StandardSm2Engine

      public StandardSm2Engine(org.bouncycastle.crypto.engines.SM2Engine.Mode mode)
    • StandardSm2Engine

      public StandardSm2Engine(org.bouncycastle.crypto.Digest digest)
    • StandardSm2Engine

      public StandardSm2Engine(org.bouncycastle.crypto.Digest digest, org.bouncycastle.crypto.engines.SM2Engine.Mode mode)
  • Method Details

    • init

      public void init(boolean forEncryption, org.bouncycastle.crypto.CipherParameters param)
    • processBlock

      public byte[] processBlock(byte[] in, int inOff, int inLen) throws org.bouncycastle.crypto.InvalidCipherTextException
      Throws:
      org.bouncycastle.crypto.InvalidCipherTextException
    • getOutputSize

      public int getOutputSize(int inputLen)
    • createBasePointMultiplier

      protected org.bouncycastle.math.ec.ECMultiplier createBasePointMultiplier()
    • encrypt

      private byte[] encrypt(byte[] in, int inOff, int inLen)
      加密
      Parameters:
      in -
      inOff -
      inLen -
      Returns:
    • decrypt

      private byte[] decrypt(byte[] in, int inOff, int inLen) throws org.bouncycastle.crypto.InvalidCipherTextException
      解密
      Parameters:
      in -
      inOff -
      inLen -
      Returns:
      Throws:
      org.bouncycastle.crypto.InvalidCipherTextException
    • notEncrypted

      private boolean notEncrypted(byte[] encData, byte[] in, int inOff)
    • kdf

      private void kdf(org.bouncycastle.crypto.Digest digest, org.bouncycastle.math.ec.ECPoint c1, byte[] encData)
    • xor

      private void xor(byte[] data, byte[] kdfOut, int dOff, int dRemaining)
    • nextK

      private BigInteger nextK()
    • addFieldElement

      private void addFieldElement(org.bouncycastle.crypto.Digest digest, org.bouncycastle.math.ec.ECFieldElement v)
    • convertToAsn1

      private byte[] convertToAsn1(org.bouncycastle.math.ec.ECPoint c1P, byte[] c2, byte[] c3)