Buggy code:
public class SelfSignedSslEngineSource implements SslEngineSource { private static final Logger LOG = LoggerFactory . getLogger ( SelfSignedSslEngineSource . class ) ; private static final String ALIAS = "littleproxy" ; private static final String PASSWORD = "Be<seq2seq4repair_space>Your<seq2seq4repair_space>Own<seq2seq4repair_space>Lantern" ; private static final String PROTOCOL = "TLS" ; private static final String KEYSTORETYPE = "jks" ; private final File keyStoreFile ; private final boolean trustAllServers ; private final boolean sendCerts ; private SSLContext sslContext ; private KeyStore keyStore ; public SelfSignedSslEngineSource ( String keyStorePath , boolean trustAllServers , boolean sendCerts ) { } public SelfSignedSslEngineSource ( String keyStorePath ) { } public SelfSignedSslEngineSource ( boolean trustAllServers ) { } public SelfSignedSslEngineSource ( boolean trustAllServers , boolean sendCerts ) { } public SelfSignedSslEngineSource ( ) { } @ Override public SSLEngine newSslEngine ( ) { } public SSLEngine newSslEngine ( SSLSession remoteServerSslSession ) { try { X509Certificate [ ] remoteServerCertChain = remoteServerSslSession . getPeerCertificateChain ( ) ; X509CertImpl remoteServerCert = new X509CertImpl ( remoteServerCertChain [ 0 ] . getEncoded ( ) ) ; X509CertInfo remoteServerCertInfo = ( ( X509CertInfo ) ( remoteServerCert . get ( ( ( ( X509CertImpl . NAME ) + "." ) + ( X509CertImpl . INFO ) ) ) ) ) ; iaik . x509 . X509Certificate remoteServerCertificate = new iaik . x509 . X509Certificate ( remoteServerCertChain [ 0 ] . getEncoded ( ) ) ; SSLContext dynamicSslContext = SSLContext . getInstance ( "SSL" ) ; X509CertImpl caCert = new X509CertImpl ( keyStore . getCertificate ( SelfSignedSslEngineSource . ALIAS ) . getEncoded ( ) ) ; PrivateKey caPrivateKey = ( ( PrivateKey ) ( keyStore . getKey ( SelfSignedSslEngineSource . ALIAS , SelfSignedSslEngineSource . PASSWORD . toCharArray ( ) ) ) ) ; PublicKey caPublicKey = caCert . getPublicKey ( ) ; X509CertInfo caCertInfo = ( ( X509CertInfo ) ( caCert . get ( ( ( ( X509CertImpl . NAME ) + "." ) + ( X509CertImpl . INFO ) ) ) ) ) ; X500Name issuer = ( ( X500Name ) ( caCertInfo . get ( ( ( ( X509CertInfo . SUBJECT ) + "." ) + ( CertificateIssuerName . DN_NAME ) ) ) ) ) ; remoteServerCertInfo . set ( X509CertInfo . VERSION , new CertificateVersion ( CertificateVersion . V3 ) ) ; remoteServerCertInfo . set ( ( ( ( X509CertInfo . ISSUER ) + "." ) + ( CertificateSubjectName . DN_NAME ) ) , issuer ) ; remoteServerCertInfo . set ( X509CertInfo . KEY , new CertificateX509Key ( caPublicKey ) ) ; X509CertImpl newCert = new X509CertImpl ( remoteServerCertInfo ) ; <START_BUG> String sigAlgName = "MD5WithRSA" ; <END_BUG> newCert . sign ( caPrivateKey , sigAlgName ) ; AlgorithmId sigAlgid = ( ( AlgorithmId ) ( newCert . get ( X509CertImpl . SIG_ALG ) ) ) ; remoteServerCertInfo . set ( ( ( ( CertificateAlgorithmId . NAME ) + "." ) + ( CertificateAlgorithmId . ALGORITHM ) ) , sigAlgid ) ; CertificateExtensions extensions = ( ( CertificateExtensions ) ( remoteServerCertInfo . get ( X509CertInfo . EXTENSIONS ) ) ) ; Enumeration < Extension > elements = extensions . getElements ( ) ; CertificateExtensions newExtensions = new CertificateExtensions ( ) ; while ( ( elements != null ) && ( elements . hasMoreElements ( ) ) ) { Extension ext = elements . nextElement ( ) ; if ( ext instanceof SubjectAlternativeNameExtension ) { newExtensions . set ( SubjectAlternativeNameExtension . NAME , ext ) ; } } newExtensions . set ( SubjectKeyIdentifierExtension . NAME , new SubjectKeyIdentifierExtension ( new KeyIdentifier ( caPublicKey ) . getIdentifier ( ) ) ) ; remoteServerCertInfo . set ( X509CertInfo . EXTENSIONS , newExtensions ) ; newCert = new X509CertImpl ( remoteServerCertInfo ) ; newCert . sign ( caPrivateKey , sigAlgName ) ; KeyStore serverKeyStore = KeyStore . getInstance ( SelfSignedSslEngineSource . KEYSTORETYPE ) ; serverKeyStore . load ( null , SelfSignedSslEngineSource . PASSWORD . toCharArray ( ) ) ; serverKeyStore . setCertificateEntry ( SelfSignedSslEngineSource . ALIAS , newCert ) ; serverKeyStore . setKeyEntry ( SelfSignedSslEngineSource . ALIAS , caPrivateKey , SelfSignedSslEngineSource . PASSWORD . toCharArray ( ) , new Certificate [ ] { newCert } ) ; final KeyManagerFactory keyManagerFactory = KeyManagerFactory . getInstance ( KeyManagerFactory . getDefaultAlgorithm ( ) ) ; keyManagerFactory . init ( serverKeyStore , SelfSignedSslEngineSource . PASSWORD . toCharArray ( ) ) ; dynamicSslContext . init ( keyManagerFactory . getKeyManagers ( ) , new TrustManager [ ] { new SelfSignedSslEngineSource . TrustEveryone ( ) } , null ) ; return dynamicSslContext . createSSLEngine ( ) ; } catch ( Exception e ) { throw new RuntimeException ( "newSslEngine" , e ) ; } } public SSLEngine _newSslEngine ( SSLSession remoteServerSslSession ) { } public SSLContext getSslContext ( ) { } private void initializeKeyStore ( ) { } private void initializeSSLContext ( ) { } private String nativeCall ( final String ... commands ) { } private static class TrustEveryone implements X509TrustManager { public void checkClientTrusted ( java . security . cert . X509Certificate [ ] chain , String authenticationType ) { } public void checkServerTrusted ( java . security . cert . X509Certificate [ ] chain , String authenticationType ) { } public java . security . cert . X509Certificate [ ] getAcceptedIssuers ( ) { } } }

Fix:
String sigAlgName = "SHA1withDSA" ;