我正在使用html2canvas网页的截图,然后利用复制内容到剪贴板navigator.clipboard.write和ClipboardItem。这在 chrome 上运行良好
tempCanvas.toBlob(function(blob) {
navigator.clipboard
.write([
new ClipboardItem(
Object.defineProperty({}, blob.type, {
value: blob,
enumerable: true
})
)
]).then(function() {
console.log( "Copied to clipboard");
});
});
Run Code Online (Sandbox Code Playgroud)
但这不适用于 Firefox 和 Safari
我在尝试
tempCanvas.toBlob(function(blob) {
let data = new DataTransfer();
data.items.add("image/jpeg", blob);
navigator.clipboard.write(data).then(function() {
console.log( "Copied to clipboard");
});
});
Run Code Online (Sandbox Code Playgroud)
似乎不起作用。
我必须使用AES 128位在IOS Objective-C中使用java加密和解密
我有这个Java程序
import java.util.Base64;
import javax.crypto.Cipher;
import javax.crypto.KeyGenerator;
import javax.crypto.SecretKey;
import javax.crypto.spec.SecretKeySpec;
import sun.misc.BASE64Encoder;
import sun.misc.BASE64Decoder;
import javax.crypto.spec.IvParameterSpec;
public class EncryptionDecryptionAES {
static Cipher cipher;
public static void main(String[] args) throws Exception {
String plainText = "AES Symmetric Encryption Decryption";
String Enc = Encrypt(plainText,"testkey");
System.out.println("Enc :" + Enc+":");
}
public static String Decrypt(String text, String key) throws Exception {
Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
byte[] keyBytes = new byte[16];
byte[] b = key.getBytes("UTF-8");
int len = b.length;
if (len …Run Code Online (Sandbox Code Playgroud)