Skip to content

Commit 6b90b05

Browse files
committed
8297878: KEM: Implementation
Reviewed-by: ascarpino, mullan
1 parent 21af8ba commit 6b90b05

File tree

12 files changed

+2324
-21
lines changed

12 files changed

+2324
-21
lines changed

src/java.base/share/classes/com/sun/crypto/provider/DHKEM.java

Lines changed: 395 additions & 0 deletions
Large diffs are not rendered by default.

src/java.base/share/classes/com/sun/crypto/provider/SunJCE.java

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1997, 2022, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -74,6 +74,10 @@
7474
*
7575
* - HMAC-MD5, HMAC-SHA1, HMAC with SHA2 family and SHA3 family of digests
7676
*
77+
* - JCEKS KeyStore
78+
*
79+
* - DHKEM
80+
*
7781
*/
7882

7983
public final class SunJCE extends Provider {
@@ -743,6 +747,15 @@ void putEntries() {
743747
ps("KeyStore", "JCEKS",
744748
"com.sun.crypto.provider.JceKeyStore");
745749

750+
/*
751+
* KEMs
752+
*/
753+
attrs.clear();
754+
attrs.put("ImplementedIn", "Software");
755+
attrs.put("SupportedKeyClasses", "java.security.interfaces.ECKey" +
756+
"|java.security.interfaces.XECKey");
757+
ps("KEM", "DHKEM", "com.sun.crypto.provider.DHKEM", null, attrs);
758+
746759
/*
747760
* SSL/TLS mechanisms
748761
*

src/java.base/share/classes/java/security/Provider.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1996, 2022, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1996, 2023, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -1599,6 +1599,7 @@ private static void addEngine(String name, boolean sp, String paramName) {
15991599
addEngine("KeyAgreement", true, null);
16001600
addEngine("KeyGenerator", false, null);
16011601
addEngine("SecretKeyFactory", false, null);
1602+
addEngine("KEM", true, null);
16021603
// JSSE
16031604
addEngine("KeyManagerFactory", false, null);
16041605
addEngine("SSLContext", false, null);
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
/*
2+
* Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved.
3+
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4+
*
5+
* This code is free software; you can redistribute it and/or modify it
6+
* under the terms of the GNU General Public License version 2 only, as
7+
* published by the Free Software Foundation. Oracle designates this
8+
* particular file as subject to the "Classpath" exception as provided
9+
* by Oracle in the LICENSE file that accompanied this code.
10+
*
11+
* This code is distributed in the hope that it will be useful, but WITHOUT
12+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13+
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14+
* version 2 for more details (a copy is included in the LICENSE file that
15+
* accompanied this code).
16+
*
17+
* You should have received a copy of the GNU General Public License version
18+
* 2 along with this work; if not, write to the Free Software Foundation,
19+
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20+
*
21+
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22+
* or visit www.oracle.com if you need additional information or have any
23+
* questions.
24+
*/
25+
package javax.crypto;
26+
27+
import java.security.GeneralSecurityException;
28+
29+
/**
30+
* An exception that is thrown by the
31+
* {@link javax.crypto.KEM.Decapsulator#decapsulate} method to denote an
32+
* error during decapsulation.
33+
*
34+
* @since 21
35+
*/
36+
public class DecapsulateException extends GeneralSecurityException {
37+
38+
@java.io.Serial
39+
private static final long serialVersionUID = 21L;
40+
41+
/**
42+
* Creates a {@code DecapsulateException} with the specified
43+
* detail message.
44+
*
45+
* @param message the detail message (which is saved for later retrieval
46+
* by the {@link #getMessage()} method).
47+
*/
48+
public DecapsulateException(String message) {
49+
super(message);
50+
}
51+
52+
/**
53+
* Creates a {@code DecapsulateException} with the specified
54+
* detail message and cause.
55+
*
56+
* @param message the detail message (which is saved for later retrieval
57+
* by the {@link #getMessage()} method).
58+
* @param cause the cause (which is saved for later retrieval by the
59+
* {@link #getCause()} method). (A {@code null} value is permitted,
60+
* and indicates that the cause is nonexistent or unknown.)
61+
*/
62+
public DecapsulateException(String message, Throwable cause) {
63+
super(message, cause);
64+
}
65+
}

0 commit comments

Comments
 (0)