Instantly share code, notes, and snippets.

Embed
What would you like to do?
.class Lcom/valvesoftware/android/steam/community/DevHttpsTrustManager;
.super Ljava/lang/Object;
.source "DevHttpsTrustManager.java"
# interfaces
.implements Ljavax/net/ssl/X509TrustManager;
# static fields
.field private static final _AcceptedIssuers:[Ljava/security/cert/X509Certificate;
.field private static trustManagers:[Ljavax/net/ssl/TrustManager;
# direct methods
.method static constructor <clinit>()V
.locals 1
.prologue
.line 19
const/4 v0, 0x0
new-array v0, v0, [Ljava/security/cert/X509Certificate;
sput-object v0, Lcom/valvesoftware/android/steam/community/DevHttpsTrustManager;->_AcceptedIssuers:[Ljava/security/cert/X509Certificate;
return-void
.end method
.method constructor <init>()V
.locals 0
.prologue
.line 17
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
return-void
.end method
.method public static allowSslToValveDev()V
.locals 5
.prologue
.line 23
new-instance v2, Lcom/valvesoftware/android/steam/community/DevHttpsTrustManager$1;
invoke-direct {v2}, Lcom/valvesoftware/android/steam/community/DevHttpsTrustManager$1;-><init>()V
invoke-static {v2}, Ljavax/net/ssl/HttpsURLConnection;->setDefaultHostnameVerifier(Ljavax/net/ssl/HostnameVerifier;)V
.line 31
const/4 v0, 0x0
.line 32
.local v0, "context":Ljavax/net/ssl/SSLContext;
sget-object v2, Lcom/valvesoftware/android/steam/community/DevHttpsTrustManager;->trustManagers:[Ljavax/net/ssl/TrustManager;
if-nez v2, :cond_0
.line 33
const/4 v2, 0x1
new-array v2, v2, [Ljavax/net/ssl/TrustManager;
const/4 v3, 0x0
new-instance v4, Lcom/valvesoftware/android/steam/community/DevHttpsTrustManager;
invoke-direct {v4}, Lcom/valvesoftware/android/steam/community/DevHttpsTrustManager;-><init>()V
aput-object v4, v2, v3
sput-object v2, Lcom/valvesoftware/android/steam/community/DevHttpsTrustManager;->trustManagers:[Ljavax/net/ssl/TrustManager;
.line 37
:cond_0
:try_start_0
const-string v2, "TLS"
invoke-static {v2}, Ljavax/net/ssl/SSLContext;->getInstance(Ljava/lang/String;)Ljavax/net/ssl/SSLContext;
move-result-object v0
.line 38
const/4 v2, 0x0
sget-object v3, Lcom/valvesoftware/android/steam/community/DevHttpsTrustManager;->trustManagers:[Ljavax/net/ssl/TrustManager;
new-instance v4, Ljava/security/SecureRandom;
invoke-direct {v4}, Ljava/security/SecureRandom;-><init>()V
invoke-virtual {v0, v2, v3, v4}, Ljavax/net/ssl/SSLContext;->init([Ljavax/net/ssl/KeyManager;[Ljavax/net/ssl/TrustManager;Ljava/security/SecureRandom;)V
:try_end_0
.catch Ljava/security/NoSuchAlgorithmException; {:try_start_0 .. :try_end_0} :catch_0
.catch Ljava/security/KeyManagementException; {:try_start_0 .. :try_end_0} :catch_1
.line 45
:goto_0
invoke-virtual {v0}, Ljavax/net/ssl/SSLContext;->getSocketFactory()Ljavax/net/ssl/SSLSocketFactory;
move-result-object v2
invoke-static {v2}, Ljavax/net/ssl/HttpsURLConnection;->setDefaultSSLSocketFactory(Ljavax/net/ssl/SSLSocketFactory;)V
.line 46
return-void
.line 39
:catch_0
move-exception v1
.line 40
.local v1, "e":Ljava/security/NoSuchAlgorithmException;
const-class v2, Lcom/valvesoftware/android/steam/community/DevHttpsTrustManager;
invoke-virtual {v2}, Ljava/lang/Class;->getSimpleName()Ljava/lang/String;
move-result-object v2
invoke-virtual {v1}, Ljava/security/NoSuchAlgorithmException;->toString()Ljava/lang/String;
move-result-object v3
invoke-static {v2, v3}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I
goto :goto_0
.line 41
.end local v1 # "e":Ljava/security/NoSuchAlgorithmException;
:catch_1
move-exception v1
.line 42
.local v1, "e":Ljava/security/KeyManagementException;
const-class v2, Lcom/valvesoftware/android/steam/community/DevHttpsTrustManager;
invoke-virtual {v2}, Ljava/lang/Class;->getSimpleName()Ljava/lang/String;
move-result-object v2
invoke-virtual {v1}, Ljava/security/KeyManagementException;->toString()Ljava/lang/String;
move-result-object v3
invoke-static {v2, v3}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I
goto :goto_0
.end method
# virtual methods
.method public checkClientTrusted([Ljava/security/cert/X509Certificate;Ljava/lang/String;)V
.locals 0
.param p1, "x509Certificates" # [Ljava/security/cert/X509Certificate;
.param p2, "s" # Ljava/lang/String;
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/security/cert/CertificateException;
}
.end annotation
.prologue
.line 50
return-void
.end method
.method public checkServerTrusted([Ljava/security/cert/X509Certificate;Ljava/lang/String;)V
.locals 0
.param p1, "x509Certificates" # [Ljava/security/cert/X509Certificate;
.param p2, "s" # Ljava/lang/String;
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/security/cert/CertificateException;
}
.end annotation
.prologue
.line 54
return-void
.end method
.method public getAcceptedIssuers()[Ljava/security/cert/X509Certificate;
.locals 1
.prologue
.line 58
sget-object v0, Lcom/valvesoftware/android/steam/community/DevHttpsTrustManager;->_AcceptedIssuers:[Ljava/security/cert/X509Certificate;
return-object v0
.end method
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment