Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -183,13 +183,16 @@ public final class SunEntries {
"sun.security.provider.DSA$SHA3_384withDSAinP1363Format");
add(p, "Signature", "SHA3-512withDSAinP1363Format",
"sun.security.provider.DSA$SHA3_512withDSAinP1363Format");
/*
* Key Pair Generator engines
*/
attrs.clear();
attrs.put("ImplementedIn", "Software");
attrs.put("KeySize", "2048"); // for DSA KPG and APG only
}

/*
* Key Pair Generator engines
*/
attrs.clear();
attrs.put("ImplementedIn", "Software");
attrs.put("KeySize", "2048"); // for DSA KPG and APG only

if (!systemFipsEnabled) {
String dsaKPGImplClass = "sun.security.provider.DSAKeyPairGenerator$";
dsaKPGImplClass += (useLegacyDSA? "Legacy" : "Current");
addWithAlias(p, "KeyPairGenerator", "DSA", dsaKPGImplClass, attrs);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,9 @@ public SunRsaSignEntries(Provider p) {
// start populating content using the specified provider
// common attribute map
HashMap<String, String> attrs = new HashMap<>(3);
if (!systemFipsEnabled) {
attrs.put("SupportedKeyClasses",
"java.security.interfaces.RSAPublicKey" +
"|java.security.interfaces.RSAPrivateKey");
}
attrs.put("SupportedKeyClasses",
"java.security.interfaces.RSAPublicKey" +
"|java.security.interfaces.RSAPrivateKey");

add(p, "KeyFactory", "RSA",
"sun.security.rsa.RSAKeyFactory$Legacy",
Expand Down
77 changes: 77 additions & 0 deletions test/jdk/sun/security/pkcs11/fips/VerifyMissingAttributes.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
/*
* Copyright (c) 2022, Red Hat, Inc.
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/

import java.security.Provider;
import java.security.Security;

/*
* @test
* @bug 9999999
* @requires (jdk.version.major >= 8)
* @run main/othervm/timeout=30 Main
* @author Martin Balao ([email protected])
*/

public final class VerifyMissingAttributes {

private static final String[] svcAlgImplementedIn = {
"AlgorithmParameterGenerator.DSA",
"AlgorithmParameters.DSA",
"CertificateFactory.X.509",
"KeyStore.JKS",
"KeyStore.CaseExactJKS",
"KeyStore.DKS",
"CertStore.Collection",
"CertStore.com.sun.security.IndexedCollection"
};

public static void main(String[] args) throws Throwable {
Provider sunProvider = Security.getProvider("SUN");
for (String svcAlg : svcAlgImplementedIn) {
String filter = svcAlg + " ImplementedIn:Software";
doQuery(sunProvider, filter);
}
if (Double.parseDouble(
System.getProperty("java.specification.version")) >= 17) {
String filter = "KeyFactory.RSASSA-PSS SupportedKeyClasses:" +
"java.security.interfaces.RSAPublicKey" +
"|java.security.interfaces.RSAPrivateKey";
doQuery(Security.getProvider("SunRsaSign"), filter);
}
System.out.println("TEST PASS - OK");
}

private static void doQuery(Provider expectedProvider, String filter)
throws Exception {
if (expectedProvider == null) {
throw new Exception("Provider not found.");
}
Provider[] providers = Security.getProviders(filter);
if (providers == null || providers.length != 1 ||
providers[0] != expectedProvider) {
throw new Exception("Failure retrieving the provider with this" +
" query: " + filter);
}
}
}