Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/195.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在android中使用经过改造的Netcipher?_Android_Encryption_Retrofit - Fatal编程技术网

如何在android中使用经过改造的Netcipher?

如何在android中使用经过改造的Netcipher?,android,encryption,retrofit,Android,Encryption,Retrofit,Netcipher是一个Android库项目,提供多种方法来提高移动应用程序中的网络安全性。“洋葱”这个名字不仅指Tor使用的洋葱路由概念(它提供匿名性和对流量监视的抵抗),还指任何应用程序都应该利用的多层安全性 更具体地说,该库提供: 1. Stronger Sockets: Through support for the right cipher suites, pinning and more, we ensure your encrypted connections are as str

Netcipher是一个Android库项目,提供多种方法来提高移动应用程序中的网络安全性。“洋葱”这个名字不仅指Tor使用的洋葱路由概念(它提供匿名性和对流量监视的抵抗),还指任何应用程序都应该利用的多层安全性

更具体地说,该库提供:

1. Stronger Sockets: Through support for the right cipher suites, pinning and more, we ensure your encrypted connections are as strong as possible.
2. Proxied Connection Support: HTTP and SOCKS proxy connection support for HTTP and HTTP/S traffic through specific configuration of the Apache HTTPClient library

您需要实现自己的
客户端
,该客户端将在Netcipher http客户端上执行改装请求

  • 请求
    转换为相应的Netcipher请求(复制http方法、头、正文)
  • 在Netcipher http客户端上执行转换后的请求
  • 获取响应并将其转换为改装
    响应
    (复制http状态代码、响应、标题)
  • 返回要反序列化为类型的响应
  • 将您的
    客户端
    传递给
    RestAdapter.Builder

    完成了


    除了Tor类路由之外,它还具有证书固定功能和代理支持。而且它还可以在开箱即用的情况下进行改装!所以,如果Tor类函数对您来说不是那么重要,我建议您利用OkHttp的强大功能。否则,由@NikolaDespotoski回答是您的最佳选择。

    我们最近在NetCipher中实现了对OkHTTP的支持,因此通过OkHTTP添加Tor支持改造应该很容易。以下是方法:

    compile 'info.guardianproject.netcipher:netcipher-okhttp3:2.0.0-alpha1'
    
    其核心是运行方法来设置:

      StrongOkHttpClientBuilder
        .forMaxSecurity(this)
        .withTorValidation()
        .build(this);
    

    有关完整示例,请参见包含的项目,这是git回购协议的一部分

    您尝试过的内容?你有没有发现这两者之间的交叉点,在那里你可以把它们结合起来?
      StrongOkHttpClientBuilder
        .forMaxSecurity(this)
        .withTorValidation()
        .build(this);