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

  • 大小: 1.11MB
    文件類型: .rar
    金幣: 2
    下載: 0 次
    發(fā)布日期: 2023-09-03
  • 語言: Java
  • 標(biāo)簽: 國密??SM2??SM3??SM4??JAVA??

資源簡介

SM2&SM3&SM4國密算法Java實(shí)現(xiàn)(含詳細(xì)測試代碼,附帶詳細(xì)國密資料)

資源截圖

代碼片段和文件信息

package?com.security.cipher.sm;

import?java.math.BigInteger;

import?org.bouncycastle.crypto.AsymmetricCipherKeyPair;
import?org.bouncycastle.crypto.params.ECPrivateKeyParameters;
import?org.bouncycastle.crypto.params.ECPublicKeyParameters;
import?org.bouncycastle.math.ec.ECPoint;

public?class?Cipher?
{
private?int?ct;
private?ECPoint?p2;
private?SM3Digest?sm3keybase;
private?SM3Digest?sm3c3;
private?byte?key[];
private?byte?keyOff;

public?Cipher()?
{
this.ct?=?1;
this.key?=?new?byte[32];
this.keyOff?=?0;
}

private?void?Reset()?
{
this.sm3keybase?=?new?SM3Digest();
this.sm3c3?=?new?SM3Digest();

byte?p[]?=?Util.byteConvert32Bytes(p2.getX().toBigInteger());
this.sm3keybase.update(p?0?p.length);
this.sm3c3.update(p?0?p.length);

p?=?Util.byteConvert32Bytes(p2.getY().toBigInteger());
this.sm3keybase.update(p?0?p.length);
this.ct?=?1;
NextKey();
}

private?void?NextKey()?
{
SM3Digest?sm3keycur?=?new?SM3Digest(this.sm3keybase);
sm3keycur.update((byte)?(ct?>>?24?&?0xff));
sm3keycur.update((byte)?(ct?>>?16?&?0xff));
sm3keycur.update((byte)?(ct?>>?8?&?0xff));
sm3keycur.update((byte)?(ct?&?0xff));
sm3keycur.doFinal(key?0);
this.keyOff?=?0;
this.ct++;
}

public?ECPoint?Init_enc(SM2?sm2?ECPoint?userKey)?
{
AsymmetricCipherKeyPair?key?=?sm2.ecc_key_pair_generator.generateKeyPair();
ECPrivateKeyParameters?ecpriv?=?(ECPrivateKeyParameters)?key.getPrivate();
ECPublicKeyParameters?ecpub?=?(ECPublicKeyParameters)?key.getPublic();
BigInteger?k?=?ecpriv.getD();
ECPoint?c1?=?ecpub.getQ();
this.p2?=?userKey.multiply(k);
Reset();
return?c1;
}

public?void?Encrypt(byte?data[])?
{
this.sm3c3.update(data?0?data.length);
for?(int?i?=?0;?i? {
if?(keyOff?==?key.length)
{
NextKey();
}
data[i]?^=?key[keyOff++];
}
}

public?void?Init_dec(BigInteger?userD?ECPoint?c1)
{
this.p2?=?c1.multiply(userD);
Reset();
}

public?void?Decrypt(byte?data[])?
{
for?(int?i?=?0;?i? {
if?(keyOff?==?key.length)
{
NextKey();
}
data[i]?^=?key[keyOff++];
}

this.sm3c3.update(data?0?data.length);
}

public?void?Dofinal(byte?c3[])?
{
byte?p[]?=?Util.byteConvert32Bytes(p2.getY().toBigInteger());
this.sm3c3.update(p?0?p.length);
this.sm3c3.doFinal(c3?0);
Reset();
}
}

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----

?????文件???????2461??2016-09-24?10:05??SM2&SM3&SM4國密算法Java實(shí)現(xiàn)(含詳細(xì)測試代碼附帶資料)\code\com\security\cipher\sm\Cipher.java

?????文件???????6354??2016-09-24?10:05??SM2&SM3&SM4國密算法Java實(shí)現(xiàn)(含詳細(xì)測試代碼附帶資料)\code\com\security\cipher\sm\SM2.java

?????文件????????401??2016-09-24?10:05??SM2&SM3&SM4國密算法Java實(shí)現(xiàn)(含詳細(xì)測試代碼附帶資料)\code\com\security\cipher\sm\SM2Result.java

?????文件???????7902??2016-09-24?10:05??SM2&SM3&SM4國密算法Java實(shí)現(xiàn)(含詳細(xì)測試代碼附帶資料)\code\com\security\cipher\sm\SM2Utils.java

?????文件???????8035??2016-09-24?10:05??SM2&SM3&SM4國密算法Java實(shí)現(xiàn)(含詳細(xì)測試代碼附帶資料)\code\com\security\cipher\sm\SM3.java

?????文件???????3003??2016-09-24?10:05??SM2&SM3&SM4國密算法Java實(shí)現(xiàn)(含詳細(xì)測試代碼附帶資料)\code\com\security\cipher\sm\SM3Digest.java

?????文件???????9784??2016-09-24?10:05??SM2&SM3&SM4國密算法Java實(shí)現(xiàn)(含詳細(xì)測試代碼附帶資料)\code\com\security\cipher\sm\SM4.java

?????文件???????4296??2016-09-24?10:05??SM2&SM3&SM4國密算法Java實(shí)現(xiàn)(含詳細(xì)測試代碼附帶資料)\code\com\security\cipher\sm\SM4Utils.java

?????文件????????245??2016-09-24?10:05??SM2&SM3&SM4國密算法Java實(shí)現(xiàn)(含詳細(xì)測試代碼附帶資料)\code\com\security\cipher\sm\SM4_Context.java

?????文件??????????0??2016-09-24?10:04??SM2&SM3&SM4國密算法Java實(shí)現(xiàn)(含詳細(xì)測試代碼附帶資料)\code\com\security\cipher\sm\tip.txt

?????文件??????17401??2016-09-24?10:05??SM2&SM3&SM4國密算法Java實(shí)現(xiàn)(含詳細(xì)測試代碼附帶資料)\code\com\security\cipher\sm\Util.java

?????文件?????945731??2016-01-07?13:19??SM2&SM3&SM4國密算法Java實(shí)現(xiàn)(含詳細(xì)測試代碼附帶資料)\SM2橢圓曲線公鑰密碼算法.pdf

?????文件??????22552??2016-01-07?13:19??SM2&SM3&SM4國密算法Java實(shí)現(xiàn)(含詳細(xì)測試代碼附帶資料)\SM2橢圓曲線公鑰密碼算法推薦曲線參數(shù).pdf

?????文件?????103677??2016-01-12?12:01??SM2&SM3&SM4國密算法Java實(shí)現(xiàn)(含詳細(xì)測試代碼附帶資料)\SM3密碼雜湊算法.pdf

?????文件?????205357??2016-01-07?13:04??SM2&SM3&SM4國密算法Java實(shí)現(xiàn)(含詳細(xì)測試代碼附帶資料)\SM4分組密碼算法.pdf

?????目錄??????????0??2017-04-05?10:47??SM2&SM3&SM4國密算法Java實(shí)現(xiàn)(含詳細(xì)測試代碼附帶資料)\code\com\security\cipher\sm

?????目錄??????????0??2017-04-05?10:47??SM2&SM3&SM4國密算法Java實(shí)現(xiàn)(含詳細(xì)測試代碼附帶資料)\code\com\security\cipher

?????目錄??????????0??2017-04-05?10:47??SM2&SM3&SM4國密算法Java實(shí)現(xiàn)(含詳細(xì)測試代碼附帶資料)\code\com\security

?????目錄??????????0??2017-04-05?10:47??SM2&SM3&SM4國密算法Java實(shí)現(xiàn)(含詳細(xì)測試代碼附帶資料)\code\com

?????目錄??????????0??2017-04-05?10:47??SM2&SM3&SM4國密算法Java實(shí)現(xiàn)(含詳細(xì)測試代碼附帶資料)\code

?????目錄??????????0??2017-06-22?09:32??SM2&SM3&SM4國密算法Java實(shí)現(xiàn)(含詳細(xì)測試代碼附帶資料)

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

??????????????1337199????????????????????21


評論

共有 條評論