- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我想从服务器下载 mp4 视频到我的 Android 设备。我希望这个视频以 block (加密)的形式存储,并且应该在视频播放时实时组合。如何着手解决这个问题。
最佳答案
对于这样的样本
public class AESdemo extends Activity {
boolean encryptionIsOn = true;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_aesdemo);
// needs <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
String homeDirName = Environment.getExternalStorageDirectory().getAbsolutePath() +
"/" + getPackageName();
File file = new File(homeDirName, "test.txt");
byte[] keyBytes = getKey("password");
try {
File dir = new File(homeDirName);
if (!dir.exists())
dir.mkdirs();
if (!file.exists())
file.createNewFile();
OutputStreamWriter osw;
if (encryptionIsOn) {
Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
SecretKeySpec secretKeySpec = new SecretKeySpec(keyBytes, "AES");
IvParameterSpec ivParameterSpec = new IvParameterSpec(keyBytes);
cipher.init(Cipher.ENCRYPT_MODE, secretKeySpec, ivParameterSpec);
FileOutputStream fos = new FileOutputStream(file);
CipherOutputStream cos = new CipherOutputStream(fos, cipher);
osw = new OutputStreamWriter(cos, "UTF-8");
}
else // not encryptionIsOn
osw = new FileWriter(file);
BufferedWriter out = new BufferedWriter(osw);
out.write("This is a test\n");
out.close();
}
catch (Exception e) {
System.out.println("Encryption Exception "+e);
}
///////////////////////////////////
try {
InputStreamReader isr;
if (encryptionIsOn) {
Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
SecretKeySpec secretKeySpec = new SecretKeySpec(keyBytes, "AES");
IvParameterSpec ivParameterSpec = new IvParameterSpec(keyBytes);
cipher.init(Cipher.DECRYPT_MODE, secretKeySpec, ivParameterSpec);
FileInputStream fis = new FileInputStream(file);
CipherInputStream cis = new CipherInputStream(fis, cipher);
isr = new InputStreamReader(cis, "UTF-8");
}
else
isr = new FileReader(file);
BufferedReader in = new BufferedReader(isr);
String line = in.readLine();
System.out.println("Text read: <"+line+">");
in.close();
}
catch (Exception e) {
System.out.println("Decryption Exception "+e);
}
}
private byte[] getKey(String password) throws UnsupportedEncodingException {
String key = "";
while (key.length() < 16)
key += password;
return key.substring(0, 16).getBytes("UTF-8");
}
使用 .mp4 代替文本文件
关于offline - 安卓离线播放视频加密,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41873402/
sls 离线命令停留在“离线:启动离线 SQS:本地/us-east-1”。 "serverless-offline": "^6.8.0", "serverless-offline-sqs": "4.
需要关于使用 redux 的大型 React Native 移动应用程序使用哪个库的建议? redux-离线 或 react-native-offline ? 我需要定期检查连接状态,根据连接状态呈现
我正在使用 Redux Offline在我的 Angular 项目中,现在我想在离线模式下启用取消发件箱中的项目。基本上,我只想过滤发件箱数组以删除我想要取消/修改的项目。 我的问题是它从我在顶级 r
我有一个只能离线工作的应用程序,但由于项目的设置方式,它需要互联网连接启动。我知道问题出在 spring.xml 中的 xsi:schemaLocation 属性,但对 Spring 不太了解,不知道
这就是一大堆错误。我已经安装了所有最新版本的Ffltter和Android Studio,还重新安装了Android SDK,并运行了ADB KILL-SERVER和ADB START-SERVER命
这就是一大堆错误。我已经安装了所有最新版本的Ffltter和Android Studio,还重新安装了Android SDK,并运行了ADB KILL-SERVER和ADB START-SERVER命
我在 Android 4.1 版本和代理后面。我已经设置了代理设置并且 sdk 下载工作正常。但是当我创建一个新项目时,它会抛出错误: Could not GET 'https://dl.google
我正在尝试与服务 worker 合作以缓存并遇到经过身份验证的调用的问题。我目前正在使用 https://css-tricks.com/serviceworker-for-offline/ ( htt
即使用户清除了缓存和 cookie,我也想让我的网站离线可用。有可能吗?我也在处理数据库。是否可以离线处理数据库? 最佳答案 用户可以存储 本地 的副本单例网页使用 Chrome(右键单击另存为),它
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 想改进这个问题?将问题更新为 on-topic对于堆栈溢出。 3年前关闭。 Improve this qu
我想从服务器下载 mp4 视频到我的 Android 设备。我希望这个视频以 block (加密)的形式存储,并且应该在视频播放时实时组合。如何着手解决这个问题。 最佳答案 对于这样的样本 publi
我一直在与社交集成和授权的 oauth 框架密切合作。我知道,像 Facebook 一样,Twitter 为其应用程序实现了一个 oauth Hook 。我的问题是,有没有办法让访问 token 永远
我在我这边使用 OpenStreetMap,但它可以通过他们的页面工作。我想知道是否可以下载一些 map 并使用本地服务器。到目前为止,我发现了这样的事情: http://openlayers.org
我正在考虑使用 Firebase 使用 PhoneGap 和 HTML5 应用程序缓存编写移动应用程序。 让我们假设每个用户都有一个 TODO 项目列表。如果应用程序在手机离线时启动,它是否能够从上一
我正在运行我的 nodejs 代码并且还安装了无服务器( npm i -g serverless )但是在使用命令 sls offline start --CacheInvalidations 运行它
这在以下情况下很有用: 服务器已关闭,客户端无法连接进行实时同步 没有互联网连接 用户不想上网,但想使用应用程序; 最佳答案 是的!这大部分已经在 Meteor 中实现了。 如果与服务器的连接丢失,客
在c#中没有互联网连接时,有没有办法获取计算机的mac地址?当我有连接时我能得到,但当我离线时我不能得到。但强烈要求我的工作需要 mac 地址。 我的在线代码; var macAddr =
我想在此处 map 中离线显示转弯导航。我也下载了 map 并将 MapEngine 设置为 false 以在离线模式下使用它,但在计算路线时返回 map 数据不足错误。如何在离线模式下使用此处 ma
该应用程序执行简单的注册(使用 FirebaseAuth、FirebaseUI 和 Google 登录)。认证时成功 , 我拿firebaseUser.userId并使用它从实时数据库中获取用户配置文
在运行 Flutter doctor 以查看为什么我的物理 LG G6 设备没有被拿起后,我发现“设备离线”。 我试过谷歌搜索,拔下并重新插入设备。 似乎没有任何效果。 这是什么意思?我的设备确实启用
我是一名优秀的程序员,十分优秀!