mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-05-09 23:51:34 +08:00
fix code
This commit is contained in:
parent
10d84af86a
commit
7468032a8d
@ -49,6 +49,7 @@ import java.security.PrivateKey;
|
|||||||
import java.security.PublicKey;
|
import java.security.PublicKey;
|
||||||
import java.security.spec.ECPublicKeySpec;
|
import java.security.spec.ECPublicKeySpec;
|
||||||
import java.security.spec.KeySpec;
|
import java.security.spec.KeySpec;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 椭圆曲线EC(Elliptic Curves)密钥参数相关工具类封装
|
* 椭圆曲线EC(Elliptic Curves)密钥参数相关工具类封装
|
||||||
@ -339,7 +340,9 @@ public class ECKeyUtil {
|
|||||||
if (null == d) {
|
if (null == d) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return toPrivateParams(BigIntegers.fromUnsignedByteArray(SecureUtil.decode(d)), domainParameters);
|
return toPrivateParams(
|
||||||
|
BigIntegers.fromUnsignedByteArray(Objects.requireNonNull(SecureUtil.decode(d))),
|
||||||
|
domainParameters);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -0,0 +1,28 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2024 Hutool Team and hutool.cn
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.dromara.hutool.crypto.asymmetric;
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
public class Issue3728Test {
|
||||||
|
@Test
|
||||||
|
void sm2Test() {
|
||||||
|
String publicKey="04beab9c2b800c03263b2d9cfcc832eb6827d5b62dc2ec7f8503c8832799af13b057d6b5bf5bc6c144753f3aa8b6cef8acb00a379a4fbed2f90c546fc2b4586bb0";
|
||||||
|
String privateKey="3920cfc4828339b34da62b97b44d49d3a9c7dc84d9e6732d4b18f681a339519c";
|
||||||
|
final SM2 sm2 = new SM2(privateKey, publicKey);
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user