phax commented on code in PR #234: URL: https://github.com/apache/santuario-xml-security-java/pull/234#discussion_r1383700636
########## src/test/java/org/apache/xml/security/testutils/KeyTestUtils.java: ########## @@ -0,0 +1,125 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.apache.xml.security.testutils; + +import org.apache.xml.security.utils.KeyUtils; + +import java.io.IOException; +import java.io.InputStream; +import java.security.*; +import java.security.spec.ECGenParameterSpec; +import java.security.spec.InvalidParameterSpecException; +import java.security.spec.X509EncodedKeySpec; +import java.util.Base64; + + +/** + * The class provides testing utility methods to test XMLSEC functionality with various JDK version. Where possible + * we use JDK provided algorithm implementations. However, some algorithms are not supported in lower JDK versions. For example + * XDH keys were supported from JDK 11, EdDSA keys from JDK 16, etc. To ensure tests are executed for various JDK versions, + * we need to know which algorithms are supported from particular JDK version. + * + * If the existing JDK security providers do not support the algorithm, the class provides auxiliary security provider (BouncyCastle) to the test + * xmlsec functionality. + * + */ +public class KeyTestUtils { + /** + * The enum of the prepared test keys in resource folder <code>KEY_RESOURCE_PATH</code>. + */ + public enum TestKeys { + DSA("dsa.key", "DSA", "1.2.840.10040.4.1"), + RSA("rsa.key", "RSA", "1.2.840.113549.1.1.1"), + EC("ec.key", "EC", "1.2.840.10045.2.1"), + X25519("x25519.key", "XDH", "1.3.101.110"), + ED25519("ed25519.key", "EdDSA", "1.3.101.112"); + + String filename; Review Comment: can all be `private` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@santuario.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org