Home / File/ JdkDelegatingPrivateKeyMethod.java — netty Source File

JdkDelegatingPrivateKeyMethod.java — netty Source File

Architecture documentation for JdkDelegatingPrivateKeyMethod.java, a java file in the netty codebase.

Entity Profile

Relationship Graph

Source Code

/*
 * Copyright 2025 The Netty Project
 *
 * The Netty Project 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:
 *
 *   https://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 io.netty.handler.ssl;

import io.netty.internal.tcnative.SSLPrivateKeyMethod;
import io.netty.util.collection.IntCollections;
import io.netty.util.collection.IntObjectHashMap;
import io.netty.util.collection.IntObjectMap;
import io.netty.util.internal.ObjectUtil;
import io.netty.util.internal.logging.InternalLogger;
import io.netty.util.internal.logging.InternalLoggerFactory;

import java.security.InvalidAlgorithmParameterException;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.security.PrivateKey;
import java.security.Provider;
import java.security.Security;
import java.security.Signature;
import java.security.spec.MGF1ParameterSpec;
import java.security.spec.PSSParameterSpec;
import java.util.Objects;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;

/**
 * Implementation of {@link OpenSslAsyncPrivateKeyMethod} that delegates cryptographic operations
 * to JDK signature providers for keys that cannot be accessed directly by OpenSSL.
 */
final class JdkDelegatingPrivateKeyMethod implements SSLPrivateKeyMethod {

    private static final InternalLogger logger =
            InternalLoggerFactory.getInstance(JdkDelegatingPrivateKeyMethod.class);

    private static final IntObjectMap<String> SSL_TO_JDK_SIGNATURE_ALGORITHM;
    private static final ConcurrentMap<CacheKey, String> PROVIDER_CACHE = new ConcurrentHashMap<>();

    static {
        IntObjectMap<String> algorithmMap = new IntObjectHashMap<>();

        // RSA PKCS#1 signatures
        algorithmMap.put(OpenSslAsyncPrivateKeyMethod.SSL_SIGN_RSA_PKCS1_SHA1, "SHA1withRSA");
        algorithmMap.put(OpenSslAsyncPrivateKeyMethod.SSL_SIGN_RSA_PKCS1_SHA256, "SHA256withRSA");
        algorithmMap.put(OpenSslAsyncPrivateKeyMethod.SSL_SIGN_RSA_PKCS1_SHA384, "SHA384withRSA");
        algorithmMap.put(OpenSslAsyncPrivateKeyMethod.SSL_SIGN_RSA_PKCS1_SHA512, "SHA512withRSA");
        algorithmMap.put(OpenSslAsyncPrivateKeyMethod.SSL_SIGN_RSA_PKCS1_MD5_SHA1, "MD5andSHA1withRSA");

// ... (216 more lines)

Domain

Subdomains

Frequently Asked Questions

What does JdkDelegatingPrivateKeyMethod.java do?
JdkDelegatingPrivateKeyMethod.java is a source file in the netty codebase, written in java. It belongs to the Buffer domain, Allocators subdomain.
Where is JdkDelegatingPrivateKeyMethod.java in the architecture?
JdkDelegatingPrivateKeyMethod.java is located at handler/src/main/java/io/netty/handler/ssl/JdkDelegatingPrivateKeyMethod.java (domain: Buffer, subdomain: Allocators, directory: handler/src/main/java/io/netty/handler/ssl).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free