Class JdkDelegatingPrivateKeyMethod

java.lang.Object
io.netty.handler.ssl.JdkDelegatingPrivateKeyMethod
All Implemented Interfaces:
io.netty.internal.tcnative.SSLPrivateKeyMethod

final class JdkDelegatingPrivateKeyMethod extends java.lang.Object implements io.netty.internal.tcnative.SSLPrivateKeyMethod
Implementation of OpenSslAsyncPrivateKeyMethod that delegates cryptographic operations to JDK signature providers for keys that cannot be accessed directly by OpenSSL.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    private static final class 
     
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private static final InternalLogger
     
    private final java.security.PrivateKey
     
    private final java.lang.String
     
    private static final java.util.concurrent.ConcurrentMap<JdkDelegatingPrivateKeyMethod.CacheKey, java.lang.String>
     
    private static final IntObjectMap<java.lang.String>
     

    Fields inherited from interface io.netty.internal.tcnative.SSLPrivateKeyMethod

    SSL_SIGN_ECDSA_SECP256R1_SHA256, SSL_SIGN_ECDSA_SECP384R1_SHA384, SSL_SIGN_ECDSA_SECP521R1_SHA512, SSL_SIGN_ECDSA_SHA1, SSL_SIGN_ED25519, SSL_SIGN_RSA_PKCS1_MD5_SHA1, SSL_SIGN_RSA_PKCS1_SHA1, SSL_SIGN_RSA_PKCS1_SHA256, SSL_SIGN_RSA_PKCS1_SHA384, SSL_SIGN_RSA_PKCS1_SHA512, SSL_SIGN_RSA_PSS_RSAE_SHA256, SSL_SIGN_RSA_PSS_RSAE_SHA384, SSL_SIGN_RSA_PSS_RSAE_SHA512
  • Constructor Summary

    Constructors
    Constructor
    Description
    JdkDelegatingPrivateKeyMethod(java.security.PrivateKey privateKey)
    Creates a new JDK delegating async private key method.
  • Method Summary

    Modifier and Type
    Method
    Description
    private static void
    configureOpenSslAlgorithmParameters(java.security.Signature signature, int opensslAlgorithm)
     
    private static void
    configurePssParameters(java.security.Signature signature, java.security.spec.MGF1ParameterSpec mgfSpec, int saltLength)
     
    private java.security.Signature
    createSignature(int opensslAlgorithm)
     
    byte[]
    decrypt(long ssl, byte[] input)
     
    private java.security.Signature
    findCompatibleSignature(int opensslAlgorithm, java.lang.String jdkAlgorithm)
     
    byte[]
    sign(long ssl, int signatureAlgorithm, byte[] input)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • logger

      private static final InternalLogger logger
    • SSL_TO_JDK_SIGNATURE_ALGORITHM

      private static final IntObjectMap<java.lang.String> SSL_TO_JDK_SIGNATURE_ALGORITHM
    • PROVIDER_CACHE

      private static final java.util.concurrent.ConcurrentMap<JdkDelegatingPrivateKeyMethod.CacheKey, java.lang.String> PROVIDER_CACHE
    • privateKey

      private final java.security.PrivateKey privateKey
    • privateKeyTypeName

      private final java.lang.String privateKeyTypeName
  • Constructor Details

    • JdkDelegatingPrivateKeyMethod

      JdkDelegatingPrivateKeyMethod(java.security.PrivateKey privateKey)
      Creates a new JDK delegating async private key method.
      Parameters:
      privateKey - the private key to use for cryptographic operations
  • Method Details

    • sign

      public byte[] sign(long ssl, int signatureAlgorithm, byte[] input) throws java.lang.Exception
      Specified by:
      sign in interface io.netty.internal.tcnative.SSLPrivateKeyMethod
      Throws:
      java.lang.Exception
    • decrypt

      public byte[] decrypt(long ssl, byte[] input)
      Specified by:
      decrypt in interface io.netty.internal.tcnative.SSLPrivateKeyMethod
    • createSignature

      private java.security.Signature createSignature(int opensslAlgorithm) throws java.security.NoSuchAlgorithmException
      Throws:
      java.security.NoSuchAlgorithmException
    • findCompatibleSignature

      private java.security.Signature findCompatibleSignature(int opensslAlgorithm, java.lang.String jdkAlgorithm) throws java.security.NoSuchAlgorithmException
      Throws:
      java.security.NoSuchAlgorithmException
    • configureOpenSslAlgorithmParameters

      private static void configureOpenSslAlgorithmParameters(java.security.Signature signature, int opensslAlgorithm) throws java.security.InvalidAlgorithmParameterException
      Throws:
      java.security.InvalidAlgorithmParameterException
    • configurePssParameters

      private static void configurePssParameters(java.security.Signature signature, java.security.spec.MGF1ParameterSpec mgfSpec, int saltLength) throws java.security.InvalidAlgorithmParameterException
      Throws:
      java.security.InvalidAlgorithmParameterException