[随手记]Android import org.apache.commons.codec.binary.Base64
2016-03-31 11:21
531 查看
转帖请注明原出处: http://blog.csdn.net/yezisuifengbiao/article/details/51024611
跟后台上传图片时,转BASE64后再用AES加密时。后台使用的是 import org.apache.commons.codec.binary.Base64 包的encodeBase64String.
Android 的 Base64 的package 是import android.util.Base64;
只能使用 encodeToString 方法。但是加密出来的数据,跟后台使用 apache 的包并不一样。
原因是因为传入的 Base64.DEFAULT 。 通过搜索得知:
Android's Base64 includes line terminators. To obtain the same result as with the Apache encoding, use Base64.NO_WRAP
下面是原帖:
http://stackoverflow.com/questions/17912119/is-there-any-difference-between-apaches-base64-encodebase64-and-androids-base6
跟后台上传图片时,转BASE64后再用AES加密时。后台使用的是 import org.apache.commons.codec.binary.Base64 包的encodeBase64String.
Android 的 Base64 的package 是import android.util.Base64;
只能使用 encodeToString 方法。但是加密出来的数据,跟后台使用 apache 的包并不一样。
原因是因为传入的 Base64.DEFAULT 。 通过搜索得知:
Android's Base64 includes line terminators. To obtain the same result as with the Apache encoding, use Base64.NO_WRAP
下面是原帖:
http://stackoverflow.com/questions/17912119/is-there-any-difference-between-apaches-base64-encodebase64-and-androids-base6
相关文章推荐
- 使用C++实现JNI接口需要注意的事项
- Android IPC进程间通讯机制
- Android Manifest 用法
- [转载]Activity中ConfigChanges属性的用法
- Android之获取手机上的图片和视频缩略图thumbnails
- Android之使用Http协议实现文件上传功能
- Android学习笔记(二九):嵌入浏览器
- android string.xml文件中的整型和string型代替
- i-jetty环境搭配与编译
- android之定时器AlarmManager
- android wifi 无线调试
- Android Native 绘图方法
- Android java 与 javascript互访(相互调用)的方法例子
- android 代码实现控件之间的间距
- android FragmentPagerAdapter的“标准”配置
- Android"解决"onTouch和onClick的冲突问题
- android:installLocation简析
- android searchView的关闭事件
- SourceProvider.getJniDirectories