Home / Class/ Algorithms Class — netty Architecture

Algorithms Class — netty Architecture

Architecture documentation for the Algorithms class in Algorithms.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  dcf50d07_6753_86d5_e2c9_9f306827a5a9["Algorithms"]
  575f0d48_25ed_f797_199a_2c583d61b50f["Algorithms.java"]
  dcf50d07_6753_86d5_e2c9_9f306827a5a9 -->|defined in| 575f0d48_25ed_f797_199a_2c583d61b50f
  a59fe695_c3c4_98d8_412c_fd6608612d6b["Algorithms()"]
  dcf50d07_6753_86d5_e2c9_9f306827a5a9 -->|method| a59fe695_c3c4_98d8_412c_fd6608612d6b
  3957707b_efe4_326e_4c73_20a688ee2d78["String()"]
  dcf50d07_6753_86d5_e2c9_9f306827a5a9 -->|method| 3957707b_efe4_326e_4c73_20a688ee2d78
  5bb370b9_b80c_b2d6_54a5_8a4cd40744c8["KeyPairGenerator()"]
  dcf50d07_6753_86d5_e2c9_9f306827a5a9 -->|method| 5bb370b9_b80c_b2d6_54a5_8a4cd40744c8
  ffce939f_5a6b_e3d6_6383_ad3444ff9b1c["Signature()"]
  dcf50d07_6753_86d5_e2c9_9f306827a5a9 -->|method| ffce939f_5a6b_e3d6_6383_ad3444ff9b1c
  1bebbf10_9c6d_4e98_57fb_56ba8461672a["Provider()"]
  dcf50d07_6753_86d5_e2c9_9f306827a5a9 -->|method| 1bebbf10_9c6d_4e98_57fb_56ba8461672a

Relationship Graph

Source Code

pkitesting/src/main/java/io/netty/pkitesting/Algorithms.java lines 29–140

final class Algorithms {
    private static Provider bouncyCastle;

    private Algorithms() {
    }

    static String oidForAlgorithmName(String algorithmIdentifier) {
        // See the Java Security Standard Algorithm Names documentation for names and links to RFCs.
        // https://docs.oracle.com/en/java/javase/22/docs/specs/security/standard-names.html#signature-algorithms
        switch (algorithmIdentifier.toLowerCase(Locale.ROOT)) {
            case "sha256withecdsa":
                return "1.2.840.10045.4.3.2";
            case "sha384withecdsa":
                return "1.2.840.10045.4.3.3";
            case "sha256withrsa":
                return "1.2.840.113549.1.1.11";
            case "sha384withrsa":
                return "1.2.840.113549.1.1.12";
            case "ed25519":
                return "1.3.101.112";
            case "ed448":
                return "1.3.101.113";
            case "ml-dsa-44":
                return "2.16.840.1.101.3.4.3.17";
            case "ml-dsa-65":
                return "2.16.840.1.101.3.4.3.18";
            case "ml-dsa-87":
                return "2.16.840.1.101.3.4.3.19";
            case "slh-dsa-sha2-128s":
                return "2.16.840.1.101.3.4.3.20";
            case "slh-dsa-sha2-128f":
                return "2.16.840.1.101.3.4.3.21";
            case "slh-dsa-shake-128s":
                return "2.16.840.1.101.3.4.3.22";
            case "slh-dsa-shake-128f":
                return "2.16.840.1.101.3.4.3.23";
            case "slh-dsa-sha2-192s":
                return "2.16.840.1.101.3.4.3.24";
            case "slh-dsa-sha2-192f":
                return "2.16.840.1.101.3.4.3.25";
            case "slh-dsa-shake-192s":
                return "2.16.840.1.101.3.4.3.26";
            case "slh-dsa-shake-192f":
                return "2.16.840.1.101.3.4.3.27";
            case "slh-dsa-sha2-256s":
                return "2.16.840.1.101.3.4.3.28";
            case "slh-dsa-sha2-256f":
                return "2.16.840.1.101.3.4.3.29";
            case "slh-dsa-shake-256s":
                return "2.16.840.1.101.3.4.3.30";
            case "slh-dsa-shake-256f":
                return "2.16.840.1.101.3.4.3.31";
            default:
                throw new UnsupportedOperationException("Algorithm not supported: " + algorithmIdentifier);
        }
    }

    static KeyPairGenerator keyPairGenerator(String keyType, AlgorithmParameterSpec spec,
            SecureRandom rng, Provider provider) throws GeneralSecurityException {
        try {
            KeyPairGenerator keyGen;
            if (provider == null) {
                keyGen = KeyPairGenerator.getInstance(keyType);
            } else {
                keyGen = KeyPairGenerator.getInstance(keyType, provider);
            }
            try {
                keyGen.initialize(spec, rng);
            } catch (UnsupportedOperationException ignore) {
                // The key generators for some algorithms, in some providers, don't support key gen initialization.
            }
            return keyGen;
        } catch (GeneralSecurityException e) {
            if (provider != null) {
                 // Don't fall back to BouncyCastle if we were explicitly told to use a specific provider.
                throw e;
            }
            try {
                KeyPairGenerator keyGen = KeyPairGenerator.getInstance(keyType, bouncyCastle());
                keyGen.initialize(spec, rng);
                return keyGen;

Frequently Asked Questions

What is the Algorithms class?
Algorithms is a class in the netty codebase, defined in pkitesting/src/main/java/io/netty/pkitesting/Algorithms.java.
Where is Algorithms defined?
Algorithms is defined in pkitesting/src/main/java/io/netty/pkitesting/Algorithms.java at line 29.

Analyze Your Own Codebase

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

Try Supermodel Free