91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 8KB
    文件類型: .rar
    金幣: 2
    下載: 1 次
    發(fā)布日期: 2021-06-17
  • 語(yǔ)言: Java
  • 標(biāo)簽: 國(guó)密??

資源簡(jiǎn)介

java 國(guó)密算法sm2、sm3 詳細(xì)使用參考:https://blog.csdn.net/weixin_30512027/article/details/86013878

資源截圖

代碼片段和文件信息

package?com.lysj.property.core.util.sm;

import?java.io.ByteArrayOutputStream;
import?java.io.File;
import?java.io.FileInputStream;
import?java.io.FileOutputStream;
import?java.io.IOException;
import?java.io.objectInputStream;
import?java.io.objectOutputStream;
import?java.io.Serializable;
import?java.io.UnsupportedEncodingException;
import?java.math.BigInteger;
import?java.security.SecureRandom;
import?java.util.Arrays;

import?org.bouncycastle.crypto.params.ECDomainParameters;
import?org.bouncycastle.math.ec.ECCurve;
import?org.bouncycastle.math.ec.ECPoint;

/**
?*?SM2公鑰加密算法實(shí)現(xiàn)?包括?-簽名驗(yàn)簽?-密鑰交換?-公鑰加密私鑰解密
?*?
?*?@author?Potato
?*
?*/
public?class?SM2?{
private?static?BigInteger?n?=?new?BigInteger(
“FFFFFFFE“?+?“FFFFFFFF“?+?“FFFFFFFF“?+?“FFFFFFFF“?+?“7203DF6B“?+?“21C6052B“?+?“53BBF409“?+?“39D54123“?16);
private?static?BigInteger?p?=?new?BigInteger(
“FFFFFFFE“?+?“FFFFFFFF“?+?“FFFFFFFF“?+?“FFFFFFFF“?+?“FFFFFFFF“?+?“00000000“?+?“FFFFFFFF“?+?“FFFFFFFF“?16);
private?static?BigInteger?a?=?new?BigInteger(
“FFFFFFFE“?+?“FFFFFFFF“?+?“FFFFFFFF“?+?“FFFFFFFF“?+?“FFFFFFFF“?+?“00000000“?+?“FFFFFFFF“?+?“FFFFFFFC“?16);
private?static?BigInteger?b?=?new?BigInteger(
“28E9FA9E“?+?“9D9F5E34“?+?“4D5A9E4B“?+?“CF6509A7“?+?“F39789F5“?+?“15AB8F92“?+?“DDBCBD41“?+?“4D940E93“?16);
private?static?BigInteger?gx?=?new?BigInteger(
“32C4AE2C“?+?“1F198119“?+?“5F990446“?+?“6A39C994“?+?“8FE30BBF“?+?“F2660BE1“?+?“715A4589“?+?“334C74C7“?16);
private?static?BigInteger?gy?=?new?BigInteger(
“BC3736A2“?+?“F4F6779C“?+?“59BDCEE3“?+?“6B692153“?+?“D0A9877C“?+?“C62A4740“?+?“02DF32E5“?+?“2139F0A0“?16);
private?static?ECDomainParameters?ecc_bc_spec;
private?static?int?w?=?(int)?Math.ceil(n.bitLength()?*?1.0?/?2)?-?1;
private?static?BigInteger?_2w?=?new?BigInteger(“2“).pow(w);
private?static?final?int?DIGEST_LENGTH?=?32;

private?static?SecureRandom?random?=?new?SecureRandom();
private?static?ECCurve.Fp?curve;
private?static?ECPoint?G;
private?boolean?debug?=?false;

public?boolean?isDebug()?{
return?debug;
}

public?void?setDebug(boolean?debug)?{
this.debug?=?debug;
}

/**
?*?以16進(jìn)制打印字節(jié)數(shù)組
?*?
?*?@param?b
?*/
public?static?void?printHexString(byte[]?b)?{
for?(int?i?=?0;?i? String?hex?=?Integer.toHexString(b[i]?&?0xFF);
if?(hex.length()?==?1)?{
hex?=?‘0‘?+?hex;
}
System.out.print(hex.toUpperCase());
}
System.out.println();
}

/**
?*?隨機(jī)數(shù)生成器
?*?
?*?@param?max
?*?@return
?*/
private?static?BigInteger?random(BigInteger?max)?{

BigInteger?r?=?new?BigInteger(256?random);
//?int?count?=?1;

while?(r.compareTo(max)?>=?0)?{
r?=?new?BigInteger(128?random);
//?count++;
}

//?System.out.println(“count:?“?+?count);
return?r;
}

/**
?*?判斷字節(jié)數(shù)組是否全0
?*?
?*?@param?buffer
?*?@return
?*/
private?boolean?allZero(byte[]?buffer)?{
for?(int?i?=?0;?i? if?(buffer[i]?!=?0)

?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----

?????文件????????535??2019-01-07?16:24??SM2KeyPair.java

?????文件???????7531??2019-01-07?17:09??SM3.java

?????文件??????24405??2019-01-07?16:24??SM2.java

-----------?---------??----------?-----??----

????????????????32471????????????????????3


評(píng)論

共有 條評(píng)論

相關(guān)資源