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
https://guardianproject.info/code/netcipher/
最佳答案
您需要实现自己的 Client
,它将在 Netcipher http 客户端上执行 Retrofit 请求。
Request
转换为适当的 Netcipher 请求(复制 http 方法、标题、正文) Response
(复制 http 状态代码、响应、 header ) 将您的
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;
}
}