Skip to content

Conversation

LucasLi1024
Copy link
Contributor

(crud): crud adapt new condition data structure. (#709)

作者: LucasLi
日期: Tue Jan 5 11:43:33 2023 +0800

@LucasLi1024 LucasLi1024 force-pushed the release-3.3.0 branch 2 times, most recently from 8387881 to 16a95bd Compare February 16, 2023 02:39
this.cryptoSuite = new CryptoSuite(CryptoType.SM_TYPE, configOption);

// init hsm crypto suite
if(configOption.getCryptoMaterialConfig() != null && configOption.getCryptoMaterialConfig().getUseSmCrypto()) {
Copy link
Member

@bxq2011hust bxq2011hust Feb 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if(configOption.getCryptoMaterialConfig() != null && configOption.getCryptoMaterialConfig().getUseSmCrypto()) {
if(configOption.getCryptoMaterialConfig() != null && configOption.getCryptoMaterialConfig().getEnableHsm()) {

Copy link
Contributor Author

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()) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里应该再保持原本逻辑的基础上,在国密的分支判断是否使用密码机,来创建CryptoSuite

Copy link
Contributor Author

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;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
private Boolean hsmEnable = false;
private Boolean enableHsm = false;

Copy link
Contributor Author

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");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
String hsmEnable = (String) cryptoMaterialProperty.get("hsmEnable");
String enableHsm = (String) cryptoMaterialProperty.get("enableHsm");

Copy link
Contributor Author

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;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
private CryptoKeyPair keyPairFactory;
private CryptoKeyPair hsmSM2KeyPair;

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

has rename to keyPair

@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);
Copy link
Collaborator

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

/**
* Create key pair from a private key string
*
* @param hexedPrivateKey a hex string of private key

Check notice

Code scanning / CodeQL

Spurious Javadoc @param tags

@param tag "hexedPrivateKey" does not match any actual parameter of method "loadHsmKeyPair()".
作者:  LucasLi
Date:  Thu Feb 16 20:00:33 2023 +0800
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

} 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

Potential uncaught 'java.lang.NumberFormatException'.
@codecov
Copy link

codecov bot commented Feb 16, 2023

Codecov Report

❗ No coverage uploaded for pull request base (release-3.3.0@a2d6b01). Click here to learn what that means.
Patch has no changes to coverable lines.

❗ Current head 3f0257b differs from pull request most recent head 38a9ec0. Consider uploading reports for the commit 38a9ec0 to get more accurate results

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.
📢 Do you have feedback about the report comment? Let us know in this issue.

@LucasLi1024 LucasLi1024 merged commit 147c2e8 into FISCO-BCOS:release-3.3.0 Feb 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants