8318096: Introduce AsymmetricKey interface with a getParams method

Reviewed-by: darcy, mullan, ascarpino
This commit is contained in:
Weijun Wang 2023-10-26 22:43:06 +00:00
parent 4a142c3b08
commit 9123961aaa
18 changed files with 313 additions and 20 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2023, 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
@ -25,6 +25,7 @@
package javax.crypto.interfaces;
import javax.crypto.spec.DHParameterSpec;
import java.math.BigInteger;
/**
@ -56,4 +57,18 @@ public interface DHPrivateKey extends DHKey, java.security.PrivateKey {
* @return the private value, <code>x</code>
*/
BigInteger getX();
/**
* {@inheritDoc java.security.AsymmetricKey}
*
* @implSpec
* The default implementation returns {@code null}.
*
* @return {@inheritDoc java.security.AsymmetricKey}
* @since 22
*/
@Override
default DHParameterSpec getParams() {
return null;
}
}

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2023, 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
@ -25,6 +25,7 @@
package javax.crypto.interfaces;
import javax.crypto.spec.DHParameterSpec;
import java.math.BigInteger;
/**
@ -56,4 +57,18 @@ public interface DHPublicKey extends DHKey, java.security.PublicKey {
* @return the public value, <code>y</code>
*/
BigInteger getY();
/**
* {@inheritDoc java.security.AsymmetricKey}
*
* @implSpec
* The default implementation returns {@code null}.
*
* @return {@inheritDoc java.security.AsymmetricKey}
* @since 22
*/
@Override
default DHParameterSpec getParams() {
return null;
}
}