mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
7.0.0.M1
This commit is contained in:
@@ -29,7 +29,7 @@ import java.security.SecureRandom;
|
||||
/**
|
||||
* 同态加密算法Paillier<br>
|
||||
* 来自:https://github.com/peterstefanov/paillier<br>
|
||||
* 来自:https://github.com/dromara/hutool/pull/3131
|
||||
* 来自:https://github.com/chinabugotech/hutool/pull/3131
|
||||
* <p>
|
||||
* 加法同态,存在有效算法+,E(x+y)=E(x)+E(y)或者 x+y=D(E(x)+E(y))成立,并且不泄漏 x 和 y。
|
||||
* 乘法同态,存在有效算法*,E(x×y)=E(x)*E(y)或者 xy=D(E(x)*E(y))成立,并且不泄漏 x 和 y。
|
||||
|
@@ -77,7 +77,7 @@ public class KeyUtilTest {
|
||||
|
||||
@Test
|
||||
public void generateSm4KeyTest(){
|
||||
// https://github.com/dromara/hutool/issues/2150
|
||||
// https://github.com/chinabugotech/hutool/issues/2150
|
||||
Assertions.assertEquals(16, KeyUtil.generateKey("sm4").getEncoded().length);
|
||||
Assertions.assertEquals(32, KeyUtil.generateKey("sm4", 256).getEncoded().length);
|
||||
}
|
||||
|
@@ -92,7 +92,7 @@ public class RSATest {
|
||||
|
||||
@Test
|
||||
public void rsaECBTest() {
|
||||
final RSA rsa = new RSA(AsymmetricAlgorithm.RSA_ECB.getValue());
|
||||
final RSA rsa = new RSA(AsymmetricAlgorithm.RSA_ECB_PKCS1.getValue());
|
||||
|
||||
// 获取私钥和公钥
|
||||
assertNotNull(rsa.getPrivateKey());
|
||||
|
@@ -94,7 +94,7 @@ public class PemUtilTest {
|
||||
@Test
|
||||
@Disabled
|
||||
public void readECPrivateKeyTest2() {
|
||||
// https://gitee.com/dromara/hutool/issues/I37Z75
|
||||
// https://gitee.com/chinabugotech/hutool/issues/I37Z75
|
||||
final byte[] d = PemUtil.readPem(FileUtil.getInputStream("d:/test/keys/priv.key"));
|
||||
final byte[] publicKey = PemUtil.readPem(FileUtil.getInputStream("d:/test/keys/pub.key"));
|
||||
|
||||
|
@@ -29,7 +29,7 @@ public class CBCBlockCipherMacEngineTest {
|
||||
|
||||
@Test
|
||||
public void SM4CMACTest(){
|
||||
// https://github.com/dromara/hutool/issues/2206
|
||||
// https://github.com/chinabugotech/hutool/issues/2206
|
||||
final byte[] key = new byte[16];
|
||||
final CipherParameters parameter = new KeyParameter(KeyUtil.generateKey("SM4", key).getEncoded());
|
||||
final Mac mac = new Mac(new SM4MacEngine(parameter));
|
||||
@@ -43,7 +43,7 @@ public class CBCBlockCipherMacEngineTest {
|
||||
|
||||
@Test
|
||||
public void SM4CMACWithIVTest(){
|
||||
// https://github.com/dromara/hutool/issues/2206
|
||||
// https://github.com/chinabugotech/hutool/issues/2206
|
||||
final byte[] key = new byte[16];
|
||||
final byte[] iv = new byte[16];
|
||||
CipherParameters parameter = new KeyParameter(KeyUtil.generateKey("SM4", key).getEncoded());
|
||||
|
@@ -102,7 +102,7 @@ public class HmacTest {
|
||||
|
||||
@Test
|
||||
public void sm4CMACTest(){
|
||||
// https://github.com/dromara/hutool/issues/2206
|
||||
// https://github.com/chinabugotech/hutool/issues/2206
|
||||
final byte[] key = new byte[16];
|
||||
final HMac mac = new HMac(HmacAlgorithm.SM4CMAC,
|
||||
KeyUtil.generateKey("SM4", key));
|
||||
|
@@ -27,7 +27,7 @@ import java.nio.file.Files;
|
||||
import java.nio.file.Paths;
|
||||
|
||||
/**
|
||||
* https://gitee.com/dromara/hutool/issues/I4EMST
|
||||
* https://gitee.com/chinabugotech/hutool/issues/I4EMST
|
||||
*/
|
||||
public class Sm4StreamTest {
|
||||
|
||||
|
Reference in New Issue
Block a user