ramu11 commented on code in PR #30945: URL: https://github.com/apache/camel/pull/30945#discussion_r4718936045
########## components/camel-pqc/src/main/java/org/apache/camel/component/pqc/BouncyCastlePqcCompatibility.java: ########## @@ -0,0 +1,466 @@ +/* + * 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.camel.component.pqc; + +import java.lang.reflect.Array; +import java.lang.reflect.Constructor; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.security.GeneralSecurityException; +import java.security.PrivateKey; +import java.security.spec.AlgorithmParameterSpec; + +/** + * Isolates the LMS/HSS and XMSS/XMSSMT JCA API package changes between Bouncy Castle releases. + * + * <p> + * BC 1.86 exposes these parameter specs and stateful-key interfaces in the legacy {@code org.bouncycastle.pqc.jcajce} + * packages. BC 1.87 also exposes the current {@code org.bouncycastle.jcajce} types and deprecates the legacy aliases. + * This class keeps those version-specific names out of the component's compile-time dependencies. It prefers the + * current API and falls back to the legacy API only when the current type is unavailable. + * </p> + * + * <p> + * Reflection is deliberately limited to this compatibility boundary. Runtime BC classes are resolved with the + * application context class loader first, then the component class loader, so a platform BOM can supply the runtime + * implementation. The adapter does not retain resolved BC classes in global caches. Stateful-key accessors use + * {@link ClassValue} so their lifetime follows the key class. Callers use ordinary {@link AlgorithmParameterSpec} and Review Comment: Addressed. Updated the Javadoc to clarify that parameter-spec classes are resolved on demand without global caching, while stateful-key accessors are cached using `ClassValue`, with entries following the lifetime of the key implementation class. -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
