Skip to content

Commit

Permalink
1.更新README.md文件中对象池配置文件说明;
Browse files Browse the repository at this point in the history
2.优化包结构,移出const包,将其中的SM4ModeAndPaddingEnum移到sm4包中,将Const移到utils包中。

Signed-off-by: xiaohui249 <[email protected]>
  • Loading branch information
xiaohui249 committed Aug 28, 2022
1 parent 0c3dd64 commit e3b4e21
Show file tree
Hide file tree
Showing 15 changed files with 14 additions and 16 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
sm2EnginePool.returnObject(sm2Engine);
```
具体对象池的配置参考如下文件:
`SM2Pool.properties`, `SM3Pool.properties`, `SM4Pool.properties`
`pool-config.yaml`,
我们目前尚未使用统一的对象池,而是根据不同密码学算法使用不同的对象池。
这里是考虑到不同算法的执行效率并不相同,因此例如sm2+sm3的操作:
我们可以考虑用一个数量更小的sm3对象池,来对接一个sm2对象池,来实现摘要(SM3)签名(SM2)这一密码学实现。
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/twgc/gm/pool/SM2EnginePool.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import org.apache.commons.pool2.impl.GenericObjectPool;
import org.bouncycastle.crypto.engines.SM2Engine;
import twgc.gm.consts.Const;
import twgc.gm.utils.Const;

/**
* @author Sean
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/twgc/gm/pool/SM2PoolConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
import java.util.Map;

import org.apache.commons.pool2.impl.GenericObjectPoolConfig;
import twgc.gm.consts.Const;
import twgc.gm.utils.ConfigLoader;
import twgc.gm.utils.Const;

public class SM2PoolConfig extends GenericObjectPoolConfig {

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/twgc/gm/pool/SM3DigestPool.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import org.apache.commons.pool2.impl.GenericObjectPool;
import org.bouncycastle.crypto.digests.SM3Digest;
import twgc.gm.consts.Const;
import twgc.gm.utils.Const;
/**
* @author Sean
* @Description: SM3Digest对象池
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/twgc/gm/pool/SM3PoolConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
import java.util.Map;

import org.apache.commons.pool2.impl.GenericObjectPoolConfig;
import twgc.gm.consts.Const;
import twgc.gm.utils.ConfigLoader;
import twgc.gm.utils.Const;

public class SM3PoolConfig extends GenericObjectPoolConfig {

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/twgc/gm/pool/SM4CipherPool.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import java.io.IOException;

import org.apache.commons.pool2.impl.GenericObjectPool;
import twgc.gm.consts.Const;
import twgc.gm.sm4.SM4Cipher;
import twgc.gm.utils.Const;


/**
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/twgc/gm/pool/SM4PoolConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
import java.util.Map;

import org.apache.commons.pool2.impl.GenericObjectPoolConfig;
import twgc.gm.consts.Const;
import twgc.gm.utils.ConfigLoader;
import twgc.gm.utils.Const;

public class SM4PoolConfig extends GenericObjectPoolConfig {

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/twgc/gm/sm2/SM2Util.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@
import org.bouncycastle.util.io.pem.PemObject;
import org.bouncycastle.util.io.pem.PemReader;
import org.bouncycastle.util.io.pem.PemWriter;
import twgc.gm.consts.Const;
import twgc.gm.random.SecureRandomFactory;
import twgc.gm.utils.Const;

/**
* @author SamYuan; 吴仙杰
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/twgc/gm/sm2/SM2X509CertFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import org.bouncycastle.operator.OperatorCreationException;
import org.bouncycastle.operator.jcajce.JcaContentSignerBuilder;
import org.bouncycastle.pkcs.PKCS10CertificationRequest;
import twgc.gm.consts.Const;
import twgc.gm.utils.Const;

/**
* @author liqs
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/twgc/gm/sm2sm3/SM2SM3Util.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

import org.bouncycastle.crypto.digests.SM3Digest;
import org.bouncycastle.jce.provider.BouncyCastleProvider;
import twgc.gm.consts.Const;
import twgc.gm.random.SecureRandomFactory;
import twgc.gm.sm3.SM3Util;
import twgc.gm.utils.Const;

public class SM2SM3Util {
private Signature signature;
Expand Down
1 change: 0 additions & 1 deletion src/main/java/twgc/gm/sm4/SM4Cipher.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import javax.crypto.NoSuchPaddingException;

import org.bouncycastle.jce.provider.BouncyCastleProvider;
import twgc.gm.consts.SM4ModeAndPaddingEnum;


/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package twgc.gm.consts;
package twgc.gm.sm4;

/**
* @author Sean
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package twgc.gm.consts;
package twgc.gm.utils;

public class Const {
private Const() {
Expand Down
3 changes: 1 addition & 2 deletions src/test/java/SM4InterationTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@
import org.junit.Assert;
import org.junit.Test;

import twgc.gm.consts.SM4ModeAndPaddingEnum;
import twgc.gm.pool.SM4CipherPool;
import twgc.gm.sm4.SM4Cipher;
import twgc.gm.sm4.SM4ModeAndPaddingEnum;
import twgc.gm.sm4.SM4Util;



public class SM4InterationTest {

@Test
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/SM4UtilTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;
import twgc.gm.consts.SM4ModeAndPaddingEnum;
import twgc.gm.pool.SM4CipherPool;
import twgc.gm.sm4.SM4Cipher;
import twgc.gm.sm4.SM4ModeAndPaddingEnum;
import twgc.gm.sm4.SM4Util;

/**
Expand Down

0 comments on commit e3b4e21

Please sign in to comment.