-
Notifications
You must be signed in to change notification settings - Fork 61
add API for HSM #729
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add API for HSM #729
Conversation
8387881
to
16a95bd
Compare
this.cryptoSuite = new CryptoSuite(CryptoType.SM_TYPE, configOption); | ||
|
||
// init hsm crypto suite | ||
if(configOption.getCryptoMaterialConfig() != null && configOption.getCryptoMaterialConfig().getUseSmCrypto()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if(configOption.getCryptoMaterialConfig() != null && configOption.getCryptoMaterialConfig().getUseSmCrypto()) { | |
if(configOption.getCryptoMaterialConfig() != null && configOption.getCryptoMaterialConfig().getEnableHsm()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
this.cryptoSuite = new CryptoSuite(CryptoType.SM_TYPE, configOption); | ||
|
||
// init hsm crypto suite | ||
if(configOption.getCryptoMaterialConfig() != null && configOption.getCryptoMaterialConfig().getUseSmCrypto()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里应该再保持原本逻辑的基础上,在国密的分支判断是否使用密码机,来创建CryptoSuite
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
|
||
private Boolean useSmCrypto = false; | ||
private Boolean disableSsl = false; | ||
private Boolean hsmEnable = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
private Boolean hsmEnable = false; | |
private Boolean enableHsm = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
Map<String, Object> cryptoMaterialProperty = configProperty.getCryptoMaterial(); | ||
String useSMCrypto = (String) cryptoMaterialProperty.get("useSMCrypto"); | ||
String disableSsl = (String) cryptoMaterialProperty.get("disableSsl"); | ||
String hsmEnable = (String) cryptoMaterialProperty.get("hsmEnable"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
String hsmEnable = (String) cryptoMaterialProperty.get("hsmEnable"); | |
String enableHsm = (String) cryptoMaterialProperty.get("enableHsm"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
public int cryptoTypeConfig; | ||
public Signature signatureImpl; | ||
public Hash hashImpl; | ||
private CryptoKeyPair keyPairFactory; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
private CryptoKeyPair keyPairFactory; | |
private CryptoKeyPair hsmSM2KeyPair; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
has rename to keyPair
16a95bd
to
aa12cea
Compare
@Override | ||
public String signWithStringSignature(final String message, final CryptoKeyPair keyPair) { | ||
byte[] signMessageBytes = signMessage(message, keyPair); | ||
String signMessageStr = new String(signMessageBytes, 0, SIGNATURE_R_AND_S_LENGTH); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove this and use toHex() directly
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
aa12cea
to
7193586
Compare
作者: LucasLi Date: Thu Feb 16 20:00:33 2023 +0800
7193586
to
38a9ec0
Compare
Kudos, SonarCloud Quality Gate passed! |
} else if (this.cryptoTypeConfig == CryptoType.HSM_TYPE) { | ||
String hsmLibPath = this.config.getCryptoMaterialConfig().getHsmLibPath(); | ||
int hsmKeyIndex = | ||
Integer.parseInt(this.config.getCryptoMaterialConfig().getHsmKeyIndex()); |
Check notice
Code scanning / CodeQL
Missing catch of NumberFormatException
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## release-3.3.0 #729 +/- ##
================================================
Coverage ? 31.69%
Complexity ? 1504
================================================
Files ? 383
Lines ? 14009
Branches ? 1554
================================================
Hits ? 4440
Misses ? 9178
Partials ? 391 Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
(crud): crud adapt new condition data structure. (#709)
作者: LucasLi
日期: Tue Jan 5 11:43:33 2023 +0800