-
Notifications
You must be signed in to change notification settings - Fork 200
/
me.jpg.html
44 lines (36 loc) · 1.29 KB
/
me.jpg.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<html>
<script lang="JavaScript" src="openpgp.js"></script>
<script lang="JavaScript">
var oReq = new XMLHttpRequest();
oReq.open("GET", "https://github.com/romeokienzler/developerWorks/raw/master/me.jpg.gpg", true);
oReq.responseType = "arraybuffer";
var arrayBuffer = oReq.response;
alert(1)
if (arrayBuffer) {
var byteArray = new Uint8Array(arrayBuffer);
for (var i = 0; i < byteArray.byteLength; i++) {
alert(byteArray[i])
}
}
oReq.send(null);
const options = {
message : window.openpgp.message.fromText('Hello, World!'),
passwords : ['pw'],
armor : false
}
window.openpgp.encrypt(options).then(ciphertext => {
encrypted = ciphertext.message
return encrypted
}).then(encrypted => {
const options = {
message : encrypted,
passwords : ['pw']
}
window.openpgp.decrypt(options).then(plaintext => {
console.log(plaintext.data)
alert(plaintext.data)
return plaintext.data
})
})
</script>
</html>