mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 06:45:07 +02:00
8237218: Support NIST Curves verification in java implementation
Reviewed-by: ascarpino
This commit is contained in:
parent
2596e83a34
commit
533649b8ca
5 changed files with 378 additions and 39 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2006, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2006, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -34,6 +34,17 @@ import java.util.Arrays;
|
|||
|
||||
public final class ECUtil {
|
||||
|
||||
// Used by SunEC
|
||||
public static byte[] sArray(BigInteger s, ECParameterSpec params) {
|
||||
byte[] arr = s.toByteArray();
|
||||
ArrayUtil.reverse(arr);
|
||||
int byteLength = (params.getOrder().bitLength() + 7) / 8;
|
||||
byte[] arrayS = new byte[byteLength];
|
||||
int length = Math.min(byteLength, arr.length);
|
||||
System.arraycopy(arr, 0, arrayS, 0, length);
|
||||
return arrayS;
|
||||
}
|
||||
|
||||
// Used by SunPKCS11 and SunJSSE.
|
||||
public static ECPoint decodePoint(byte[] data, EllipticCurve curve)
|
||||
throws IOException {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue