org.whispersystems.signalservice.api.push.TrustStore Java Examples

The following examples show how to use org.whispersystems.signalservice.api.push.TrustStore. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: WebSocketConnection.java    From libsignal-service-java with GNU General Public License v3.0 6 votes vote down vote up
public WebSocketConnection(String httpUri,
                           TrustStore trustStore,
                           Optional<CredentialsProvider> credentialsProvider,
                           String userAgent,
                           ConnectivityListener listener,
                           SleepTimer timer)
{
  this.trustStore          = trustStore;
  this.credentialsProvider = credentialsProvider;
  this.userAgent           = userAgent;
  this.listener            = listener;
  this.sleepTimer          = timer;
  this.attempts            = 0;
  this.connected           = false;

  String uri = httpUri.replace("https://", "wss://").replace("http://", "ws://");

  if (credentialsProvider.isPresent()) this.wsUri = uri + "/v1/websocket/?login=%s&password=%s";
  else                                 this.wsUri = uri + "/v1/websocket/";
}
 
Example #2
Source File: WebSocketConnection.java    From mollyim-android with GNU General Public License v3.0 6 votes vote down vote up
public WebSocketConnection(String httpUri,
                           TrustStore trustStore,
                           Optional<CredentialsProvider> credentialsProvider,
                           String signalAgent,
                           ConnectivityListener listener,
                           SleepTimer timer,
                           List<Interceptor> interceptors,
                           Optional<Dns> dns)
{
  this.trustStore          = trustStore;
  this.credentialsProvider = credentialsProvider;
  this.signalAgent         = signalAgent;
  this.listener            = listener;
  this.sleepTimer          = timer;
  this.interceptors        = interceptors;
  this.dns                 = dns;
  this.attempts            = 0;
  this.connected           = false;

  String uri = httpUri.replace("https://", "wss://").replace("http://", "ws://");

  if (credentialsProvider.isPresent()) this.wsUri = uri + "/v1/websocket/?login=%s&password=%s";
  else                                 this.wsUri = uri + "/v1/websocket/";
}
 
Example #3
Source File: BlacklistingTrustManager.java    From mollyim-android with GNU General Public License v3.0 5 votes vote down vote up
public static TrustManager[] createFor(TrustStore trustStore) {
  try {
    InputStream keyStoreInputStream = trustStore.getKeyStoreInputStream();
    KeyStore    keyStore            = KeyStore.getInstance("BKS");

    keyStore.load(keyStoreInputStream, trustStore.getKeyStorePassword().toCharArray());

    TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance("X509");
    trustManagerFactory.init(keyStore);

    return BlacklistingTrustManager.createFor(trustManagerFactory.getTrustManagers());
  } catch (KeyStoreException | CertificateException | IOException | NoSuchAlgorithmException e) {
    throw new AssertionError(e);
  }
}
 
Example #4
Source File: BlacklistingTrustManager.java    From libsignal-service-java with GNU General Public License v3.0 5 votes vote down vote up
public static TrustManager[] createFor(TrustStore trustStore) {
  try {
    InputStream keyStoreInputStream = trustStore.getKeyStoreInputStream();
    KeyStore    keyStore            = KeyStore.getInstance("BKS");

    keyStore.load(keyStoreInputStream, trustStore.getKeyStorePassword().toCharArray());

    TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance("X509");
    trustManagerFactory.init(keyStore);

    return BlacklistingTrustManager.createFor(trustManagerFactory.getTrustManagers());
  } catch (KeyStoreException | CertificateException | IOException | NoSuchAlgorithmException e) {
    throw new AssertionError(e);
  }
}
 
Example #5
Source File: SignalUrl.java    From libsignal-service-java with GNU General Public License v3.0 5 votes vote down vote up
public SignalUrl(String url, String hostHeader,
                 TrustStore trustStore,
                 ConnectionSpec connectionSpec)
{
  this.url            = url;
  this.hostHeader     = Optional.fromNullable(hostHeader);
  this.trustStore     = trustStore;
  this.connectionSpec = Optional.fromNullable(connectionSpec);
}
 
Example #6
Source File: WebSocketConnection.java    From libsignal-service-java with GNU General Public License v3.0 5 votes vote down vote up
private Pair<SSLSocketFactory, X509TrustManager> createTlsSocketFactory(TrustStore trustStore) {
  try {
    SSLContext     context       = SSLContext.getInstance("TLS");
    TrustManager[] trustManagers = BlacklistingTrustManager.createFor(trustStore);
    context.init(null, trustManagers, null);

    return new Pair<>(context.getSocketFactory(), (X509TrustManager)trustManagers[0]);
  } catch (NoSuchAlgorithmException | KeyManagementException e) {
    throw new AssertionError(e);
  }
}
 
Example #7
Source File: BlacklistingTrustManager.java    From bcm-android with GNU General Public License v3.0 5 votes vote down vote up
public static TrustManager[] createFor(TrustStore trustStore) {
  try {
    InputStream keyStoreInputStream = trustStore.getKeyStoreInputStream();
    KeyStore    keyStore            = KeyStore.getInstance("BKS");

    keyStore.load(keyStoreInputStream, trustStore.getKeyStorePassword().toCharArray());

    TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance("X509");
    trustManagerFactory.init(keyStore);

    return BlacklistingTrustManager.createFor(trustManagerFactory.getTrustManagers());
  } catch (KeyStoreException | CertificateException | IOException | NoSuchAlgorithmException e) {
    throw new AssertionError(e);
  }
}
 
Example #8
Source File: IasKeyStore.java    From mollyim-android with GNU General Public License v3.0 5 votes vote down vote up
public static KeyStore getIasKeyStore(@NonNull Context context) {
  try {
    TrustStore contactTrustStore = new IasTrustStore(context);

    KeyStore keyStore = KeyStore.getInstance("BKS");
    keyStore.load(contactTrustStore.getKeyStoreInputStream(), contactTrustStore.getKeyStorePassword().toCharArray());

    return keyStore;
  } catch (KeyStoreException | CertificateException | IOException | NoSuchAlgorithmException e) {
    throw new AssertionError(e);
  }
}
 
Example #9
Source File: SignalUrl.java    From mollyim-android with GNU General Public License v3.0 5 votes vote down vote up
public SignalUrl(String url, String hostHeader,
                 TrustStore trustStore,
                 ConnectionSpec connectionSpec)
{
  this.url            = url;
  this.hostHeader     = Optional.fromNullable(hostHeader);
  this.trustStore     = trustStore;
  this.connectionSpec = Optional.fromNullable(connectionSpec);
}
 
Example #10
Source File: WebSocketConnection.java    From mollyim-android with GNU General Public License v3.0 5 votes vote down vote up
private Pair<SSLSocketFactory, X509TrustManager> createTlsSocketFactory(TrustStore trustStore) {
  try {
    SSLContext     context       = SSLContext.getInstance("TLS");
    TrustManager[] trustManagers = BlacklistingTrustManager.createFor(trustStore);
    context.init(null, trustManagers, null);

    return new Pair<>(context.getSocketFactory(), (X509TrustManager)trustManagers[0]);
  } catch (NoSuchAlgorithmException | KeyManagementException e) {
    throw new AssertionError(e);
  }
}
 
Example #11
Source File: SignalStorageUrl.java    From mollyim-android with GNU General Public License v3.0 4 votes vote down vote up
public SignalStorageUrl(String url, String hostHeader, TrustStore trustStore, ConnectionSpec connectionSpec) {
  super(url, hostHeader, trustStore, connectionSpec);
}
 
Example #12
Source File: SignalCdnUrl.java    From libsignal-service-java with GNU General Public License v3.0 4 votes vote down vote up
public SignalCdnUrl(String url, String hostHeader, TrustStore trustStore, ConnectionSpec connectionSpec) {
  super(url, hostHeader, trustStore, connectionSpec);
}
 
Example #13
Source File: SignalCdnUrl.java    From libsignal-service-java with GNU General Public License v3.0 4 votes vote down vote up
public SignalCdnUrl(String url, TrustStore trustStore) {
  super(url, trustStore);
}
 
Example #14
Source File: SignalUrl.java    From libsignal-service-java with GNU General Public License v3.0 4 votes vote down vote up
public TrustStore getTrustStore() {
  return trustStore;
}
 
Example #15
Source File: SignalStorageUrl.java    From mollyim-android with GNU General Public License v3.0 4 votes vote down vote up
public SignalStorageUrl(String url, TrustStore trustStore) {
  super(url, trustStore);
}
 
Example #16
Source File: SignalUrl.java    From libsignal-service-java with GNU General Public License v3.0 4 votes vote down vote up
public SignalUrl(String url, TrustStore trustStore) {
  this(url, null, trustStore, null);
}
 
Example #17
Source File: SignalServiceUrl.java    From libsignal-service-java with GNU General Public License v3.0 4 votes vote down vote up
public SignalServiceUrl(String url, String hostHeader, TrustStore trustStore, ConnectionSpec connectionSpec) {
  super(url, hostHeader, trustStore, connectionSpec);
}
 
Example #18
Source File: SignalServiceUrl.java    From libsignal-service-java with GNU General Public License v3.0 4 votes vote down vote up
public SignalServiceUrl(String url, TrustStore trustStore) {
  super(url, trustStore);
}
 
Example #19
Source File: SignalContactDiscoveryUrl.java    From libsignal-service-java with GNU General Public License v3.0 4 votes vote down vote up
public SignalContactDiscoveryUrl(String url, String hostHeader, TrustStore trustStore, ConnectionSpec connectionSpec) {
  super(url, hostHeader, trustStore, connectionSpec);
}
 
Example #20
Source File: SignalContactDiscoveryUrl.java    From libsignal-service-java with GNU General Public License v3.0 4 votes vote down vote up
public SignalContactDiscoveryUrl(String url, TrustStore trustStore) {
  super(url, trustStore);
}
 
Example #21
Source File: SignalServiceUrl.java    From mollyim-android with GNU General Public License v3.0 4 votes vote down vote up
public SignalServiceUrl(String url, String hostHeader, TrustStore trustStore, ConnectionSpec connectionSpec) {
  super(url, hostHeader, trustStore, connectionSpec);
}
 
Example #22
Source File: SignalKeyBackupServiceUrl.java    From mollyim-android with GNU General Public License v3.0 4 votes vote down vote up
public SignalKeyBackupServiceUrl(String url, TrustStore trustStore) {
  super(url, trustStore);
}
 
Example #23
Source File: SignalKeyBackupServiceUrl.java    From mollyim-android with GNU General Public License v3.0 4 votes vote down vote up
public SignalKeyBackupServiceUrl(String url, String hostHeader, TrustStore trustStore, ConnectionSpec connectionSpec) {
  super(url, hostHeader, trustStore, connectionSpec);
}
 
Example #24
Source File: SignalContactDiscoveryUrl.java    From mollyim-android with GNU General Public License v3.0 4 votes vote down vote up
public SignalContactDiscoveryUrl(String url, TrustStore trustStore) {
  super(url, trustStore);
}
 
Example #25
Source File: SignalContactDiscoveryUrl.java    From mollyim-android with GNU General Public License v3.0 4 votes vote down vote up
public SignalContactDiscoveryUrl(String url, String hostHeader, TrustStore trustStore, ConnectionSpec connectionSpec) {
  super(url, hostHeader, trustStore, connectionSpec);
}
 
Example #26
Source File: SignalCdnUrl.java    From mollyim-android with GNU General Public License v3.0 4 votes vote down vote up
public SignalCdnUrl(String url, String hostHeader, TrustStore trustStore, ConnectionSpec connectionSpec) {
  super(url, hostHeader, trustStore, connectionSpec);
}
 
Example #27
Source File: SignalCdnUrl.java    From mollyim-android with GNU General Public License v3.0 4 votes vote down vote up
public SignalCdnUrl(String url, TrustStore trustStore) {
  super(url, trustStore);
}
 
Example #28
Source File: SignalUrl.java    From mollyim-android with GNU General Public License v3.0 4 votes vote down vote up
public TrustStore getTrustStore() {
  return trustStore;
}
 
Example #29
Source File: SignalServiceUrl.java    From mollyim-android with GNU General Public License v3.0 4 votes vote down vote up
public SignalServiceUrl(String url, TrustStore trustStore) {
  super(url, trustStore);
}
 
Example #30
Source File: SignalUrl.java    From mollyim-android with GNU General Public License v3.0 4 votes vote down vote up
public SignalUrl(String url, TrustStore trustStore) {
  this(url, null, trustStore, null);
}