Class GMProtectSigner

java.lang.Object
org.ofdrw.crypto.integrity.GMProtectSigner
All Implemented Interfaces:
ProtectSigner

public class GMProtectSigner extends Object implements ProtectSigner
以国密 SM2 和 SM3 算法实现的OFD完整性保护签名实现

签名值符合 《GB/T 35275》标准

Since:
2021-08-23 19:07:54
Author:
权观宇
  • Constructor Details

    • GMProtectSigner

      public GMProtectSigner(PrivateKey privateKey, Certificate signCert)
      完整性保护签名实现
      Parameters:
      privateKey - 版式文件合成者的签名私钥
      signCert - 版式文件合成者的公钥证书
  • Method Details

    • digestThenSign

      public byte[] digestThenSign(Path tbs) throws GeneralSecurityException, IOException
      根据 GM/T 0099 OFD完整性保护协议 执行完整性保护 7.4.3 中的 c) d) 步骤

      c) 根据签名方案,计算完整性保护文件的杂凑值; d) 根据签名方案,使用版式文件合成者的签名私钥对杂凑值进行数字签名;

      Specified by:
      digestThenSign in interface ProtectSigner
      Parameters:
      tbs - 待签名文件路径
      Returns:
      签名值应符合“GB/T 35275”标准
      Throws:
      GeneralSecurityException - 安全计算异常
      IOException - IO读写异常