64 lines
2.6 KiB
Java
64 lines
2.6 KiB
Java
package org.bouncycastle.crypto.tls;
|
|
|
|
import java.io.IOException;
|
|
|
|
/* loaded from: classes6.dex */
|
|
public abstract class DefaultTlsClient extends AbstractTlsClient {
|
|
@Override // org.bouncycastle.crypto.tls.TlsClient
|
|
public TlsKeyExchange getKeyExchange() throws IOException {
|
|
int keyExchangeAlgorithm = TlsUtils.getKeyExchangeAlgorithm(this.selectedCipherSuite);
|
|
if (keyExchangeAlgorithm == 1) {
|
|
return createRSAKeyExchange();
|
|
}
|
|
if (keyExchangeAlgorithm == 3 || keyExchangeAlgorithm == 5) {
|
|
return createDHEKeyExchange(keyExchangeAlgorithm);
|
|
}
|
|
if (keyExchangeAlgorithm == 7 || keyExchangeAlgorithm == 9) {
|
|
return createDHKeyExchange(keyExchangeAlgorithm);
|
|
}
|
|
switch (keyExchangeAlgorithm) {
|
|
case 16:
|
|
case 18:
|
|
case 20:
|
|
return createECDHKeyExchange(keyExchangeAlgorithm);
|
|
case 17:
|
|
case 19:
|
|
return createECDHEKeyExchange(keyExchangeAlgorithm);
|
|
default:
|
|
throw new TlsFatalAlert((short) 80);
|
|
}
|
|
}
|
|
|
|
@Override // org.bouncycastle.crypto.tls.TlsClient
|
|
public int[] getCipherSuites() {
|
|
return new int[]{CipherSuite.TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, CipherSuite.TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256, CipherSuite.TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, CipherSuite.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, CipherSuite.TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256, CipherSuite.TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, CipherSuite.TLS_DHE_DSS_WITH_AES_128_GCM_SHA256, 64, 50, 158, 103, 51, CipherSuite.TLS_RSA_WITH_AES_128_GCM_SHA256, 60, 47};
|
|
}
|
|
|
|
protected TlsKeyExchange createRSAKeyExchange() {
|
|
return new TlsRSAKeyExchange(this.supportedSignatureAlgorithms);
|
|
}
|
|
|
|
protected TlsKeyExchange createECDHKeyExchange(int i) {
|
|
return new TlsECDHKeyExchange(i, this.supportedSignatureAlgorithms, this.namedCurves, this.clientECPointFormats, this.serverECPointFormats);
|
|
}
|
|
|
|
protected TlsKeyExchange createECDHEKeyExchange(int i) {
|
|
return new TlsECDHEKeyExchange(i, this.supportedSignatureAlgorithms, this.namedCurves, this.clientECPointFormats, this.serverECPointFormats);
|
|
}
|
|
|
|
protected TlsKeyExchange createDHKeyExchange(int i) {
|
|
return new TlsDHKeyExchange(i, this.supportedSignatureAlgorithms, null);
|
|
}
|
|
|
|
protected TlsKeyExchange createDHEKeyExchange(int i) {
|
|
return new TlsDHEKeyExchange(i, this.supportedSignatureAlgorithms, null);
|
|
}
|
|
|
|
public DefaultTlsClient(TlsCipherFactory tlsCipherFactory) {
|
|
super(tlsCipherFactory);
|
|
}
|
|
|
|
public DefaultTlsClient() {
|
|
}
|
|
}
|