密钥管理修改
This commit is contained in:
parent
666cc96799
commit
65c690de48
@ -14,9 +14,10 @@ import java.util.Objects;
|
||||
@AllArgsConstructor
|
||||
public enum KeyAlg {
|
||||
|
||||
SM1(KeyCategory.SYM_KEY, "SM1", "国密SM1"),
|
||||
SM4(KeyCategory.SYM_KEY, "SM4", "国密SM4"),
|
||||
SM2(KeyCategory.ASYM_KEY, "SM2", "国密SM2"),
|
||||
SM1(KeyCategory.SYM_KEY, "SM1", "SM1"),
|
||||
SM4(KeyCategory.SYM_KEY, "SM4", "SM4"),
|
||||
SM2(KeyCategory.ASYM_KEY, "SM2", "SM2"),
|
||||
RSA(KeyCategory.ASYM_KEY, "RSA", "RSA"),
|
||||
;
|
||||
private final KeyCategory category;
|
||||
private final String code;
|
||||
|
@ -24,5 +24,16 @@ public interface SpKeyRecordMapper extends BaseMapper<KeyRecord> {
|
||||
);
|
||||
}
|
||||
|
||||
default KeyRecord selectByPubKey(String pubKey) {
|
||||
if (pubKey == null || pubKey.length() != 128) {
|
||||
return null;
|
||||
}
|
||||
return selectOne(
|
||||
new LambdaQueryWrapper<KeyRecord>()
|
||||
.eq(KeyRecord::getPubIdx, pubKey.substring(0, 8))
|
||||
.lt(KeyRecord::getPubKey, pubKey)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -18,6 +18,7 @@ public class KeyRecord {
|
||||
|
||||
private String keyIndex;
|
||||
private String keyData;
|
||||
private String pubIdx;
|
||||
private String pubKey;
|
||||
private String checkAlg;
|
||||
private String checkValue;
|
||||
|
@ -292,6 +292,7 @@ public class KeyInfoServiceImpl implements KeyInfoService {
|
||||
|
||||
byte[] pubKeyBytes = eccKey.getPubKey().getPubKeyBytes();
|
||||
record.setPubKey(Hex.toHexString(pubKeyBytes));
|
||||
record.setPubIdx(record.getPubKey().substring(0, 8));
|
||||
}
|
||||
return record;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user