io.netty.handler.ssl.util.SelfSignedCertificate.class Maven / Gradle / Ivy
???? 2L /io/netty/handler/ssl/util/SelfSignedCertificate java/lang/Object SelfSignedCertificate.java logger /Lio/netty/util/internal/logging/InternalLogger; DEFAULT_NOT_BEFORE Ljava/util/Date; DEFAULT_NOT_AFTER certificate Ljava/io/File;
privateKey cert $Ljava/security/cert/X509Certificate; key Ljava/security/PrivateKey; ()V 'java/security/cert/CertificateException
#(Ljava/util/Date;Ljava/util/Date;)V
this 1Lio/netty/handler/ssl/util/SelfSignedCertificate; example.com 5(Ljava/lang/String;Ljava/util/Date;Ljava/util/Date;)V !
" notBefore notAfter (Ljava/lang/String;)V fqdn Ljava/lang/String; 3io/netty/handler/ssl/util/ThreadLocalInsecureRandom ) current ()Ljava/security/SecureRandom; + ,
* - R(Ljava/lang/String;Ljava/security/SecureRandom;ILjava/util/Date;Ljava/util/Date;)V /
0 2(Ljava/lang/String;Ljava/security/SecureRandom;I)V random Ljava/security/SecureRandom; bits I &java/security/NoSuchAlgorithmException 7 java/lang/Throwable 9 java/io/IOException ; java/lang/Exception =
? RSA A java/security/KeyPairGenerator C getInstance 4(Ljava/lang/String;)Ljava/security/KeyPairGenerator; E F
D G
initialize (ILjava/security/SecureRandom;)V I J
D K generateKeyPair ()Ljava/security/KeyPair; M N
D O java/lang/String Q java/security/SecureRandom S java/util/Date U java/lang/Error W (Ljava/lang/Throwable;)V Y
X Z java/security/KeyPair \ 8io/netty/handler/ssl/util/OpenJdkSelfSignedCertGenerator ^ generate z(Ljava/lang/String;Ljava/security/KeyPair;Ljava/security/SecureRandom;Ljava/util/Date;Ljava/util/Date;)[Ljava/lang/String; ` a
_ b d KFailed to generate a self-signed X.509 certificate using sun.security.x509: f -io/netty/util/internal/logging/InternalLogger h debug *(Ljava/lang/String;Ljava/lang/Throwable;)V j k i l =io/netty/handler/ssl/util/BouncyCastleSelfSignedCertGenerator n
o b GFailed to generate a self-signed X.509 certificate using Bouncy Castle: q ^No provider succeeded to generate a self-signed certificate. See debug log for the root cause. s k
u [Ljava/lang/String; w java/io/File y &
z { }
getPrivate ()Ljava/security/PrivateKey; ? ?
] ? ? java/io/FileInputStream ? (Ljava/io/File;)V ?
? ? X509 ? %java/security/cert/CertificateFactory ? ;(Ljava/lang/String;)Ljava/security/cert/CertificateFactory; E ?
? ? generateCertificate 7(Ljava/io/InputStream;)Ljava/security/cert/Certificate; ? ?
? ? "java/security/cert/X509Certificate ? ? close ?
? ? java/lang/StringBuilder ?
? ? Failed to close a file: ? append -(Ljava/lang/String;)Ljava/lang/StringBuilder; ? ?
? ? -(Ljava/lang/Object;)Ljava/lang/StringBuilder; ? ?
? ? toString ()Ljava/lang/String; ? ?
? ? warn ? k i ? /java/security/cert/CertificateEncodingException ?
? Z keyGen Ljava/security/KeyPairGenerator; keypair Ljava/security/KeyPair; e (Ljava/security/NoSuchAlgorithmException; paths t2 Ljava/lang/Throwable; t Ljava/io/IOException; Ljava/lang/Exception; certificateInput Ljava/io/FileInputStream; ()Ljava/io/File; &()Ljava/security/cert/X509Certificate; delete
safeDelete ? ?
? newSelfSignedCertificate e(Ljava/lang/String;Ljava/security/PrivateKey;Ljava/security/cert/X509Certificate;)[Ljava/lang/String; java/security/PrivateKey ?
getEncoded ()[B ? ? ? ? io/netty/buffer/Unpooled ?
wrappedBuffer ([B)Lio/netty/buffer/ByteBuf; ? ?
? ? $io/netty/handler/codec/base64/Base64 ? encode 5(Lio/netty/buffer/ByteBuf;Z)Lio/netty/buffer/ByteBuf; ? ?
? ? -----BEGIN PRIVATE KEY-----
? io/netty/util/CharsetUtil ? US_ASCII Ljava/nio/charset/Charset; ? ? ? ? io/netty/buffer/ByteBuf ? .(Ljava/nio/charset/Charset;)Ljava/lang/String; ? ?
? ?
-----END PRIVATE KEY-----
? release ()Z ? ?
? ? keyutil_ ? (C)Ljava/lang/StringBuilder; ? ?
? ? .key ? createTempFile 4(Ljava/lang/String;Ljava/lang/String;)Ljava/io/File; ? ?
z ? deleteOnExit ?
z ? java/io/FileOutputStream ?
? ? getBytes (Ljava/nio/charset/Charset;)[B
R java/io/OutputStream write ([B)V
? safeClose '(Ljava/io/File;Ljava/io/OutputStream;)V
? ? -----BEGIN CERTIFICATE-----
-----END CERTIFICATE-----
.crt getPath ?
z keyText
encodedBuf Lio/netty/buffer/ByteBuf; certText
wrappedBuf keyFile keyOut Ljava/io/OutputStream; certFile certOut ? ?
z# Failed to delete a file: % ? & i' 4io/netty/util/internal/logging/InternalLoggerFactory* B(Ljava/lang/Class;)Lio/netty/util/internal/logging/InternalLogger; E,
+- /io.netty.selfSignedCertificate.defaultNotBefore/ java/lang/System1 currentTimeMillis ()J34
25 W?, )io/netty/util/internal/SystemPropertyUtil9 getLong (Ljava/lang/String;J)J;<
:= (J)V ?
V@ .io.netty.selfSignedCertificate.defaultNotAfterB ?w?? Code LocalVariableTable LineNumberTable
Exceptions
StackMapTable
SourceFile 1
F 9 *? ? ? ? G H
O
PI F K * +,? #? G $ % H
X YI &