Netcipher是一个Android库项目,它为提高移动应用程序中的网络安全性提供了多种方法。“洋葱”名称不仅指Tor使用的Onion路由概念(它提供匿名性和对流量监视的抵抗力),还指任何应用程序应该使用的多层安全概念。
更具体地说,这个图书馆提供:
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发布于 2015-01-15 16:40:03
您需要实现您自己的Client,它将在Netcipher http客户端上执行重定向请求。
Request转换为适当的网络密码请求(复制http方法、标头、正文)Response (复制http状态代码、响应、标头)把你的Client传给RestAdapter.Builder。
好了。
public class NetcipherClient implements Client{
private Context mContext;
public NetcipherClient(Context context){
mContext = context;
//As far as I could see from the sample, Netcipher seems to be dependant on application `Context`.
}
@Override
public retrofit.client.Response execute(retrofit.client.Request request) throws IOException {
//Set up configuration for Netcipher (proxy, timeout etc)
// Translate Request to Netcipher request
// Execute and obtain the response
// Build Response from response
return response;
}
}发布于 2016-11-01 17:14:05
我们最近在OkHTTP中实现了对NetCipher的支持,因此应该很容易通过OkHTTP将Tor支持添加到Retrofit中。下面是操作步骤:
compile 'info.guardianproject.netcipher:netcipher-okhttp3:2.0.0-alpha1'它的核心是运行方法来设置:
StrongOkHttpClientBuilder
.forMaxSecurity(this)
.withTorValidation()
.build(this);有关完整示例,请参阅包含的示例-okhttp3 3项目,它是git repo https://github.com/guardianproject/NetCipher的一部分。
发布于 2015-01-16 18:37:34
除了Tor类路由,OkHttp还具有证书钉扎能力&代理支持.而且它也适用于重新装修的盒子!所以,如果Tor类函数对您不那么重要,我建议您利用OkHttp的威望。否则,@NikolaDespotoski的回答是您的最佳选择。
https://stackoverflow.com/questions/27965821
复制相似问题