This commit is contained in:
exams228
2018-11-12 10:03:12 +00:00
parent c9a5964ae6
commit be663acc50
6 changed files with 44 additions and 16 deletions

View File

@@ -2,7 +2,7 @@
<head>
<title>browserPGP | Decrypt</title>
<meta name="description" content="Decrypt PGP in browser, simple and secure.">
<meta name="keywords" content="PGP,online,browser,javascript,github,live,secure,key generator,encrypt,decrypt,sign,verify">
<meta name="keywords" content="browserPGP,PGP,online,browser,javascript,github,live,secure,key generator,encrypt,decrypt,sign,verify">
<meta name="author" content="ar0n#1462">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
@@ -16,6 +16,7 @@
openpgp.initWorker({ path:'openpgp.worker.min.js' }) // set the relative web worker path
const encryptDecryptFunction = async() => {
document.getElementById("progressbar").className = "progress-bar progress-bar-striped progress-bar-animated";
// put keys in backtick (``) to avoid errors caused by spaces or tabs
const privkey = document.getElementById("privKey").value
const passphrase = document.getElementById("pass").value
@@ -32,8 +33,8 @@
}
openpgp.decrypt(options).then(plaintext => {
console.log(plaintext.data)
document.getElementById("result").value = plaintext.data;
document.getElementById("progressbar").className = "progress-bar bg-success";
})
}
</script>
@@ -91,12 +92,15 @@
<label for="exampleInputEmail1">Privkey Passphrase</label>
<input type="password" class="form-control" id="pass" placeholder="Enter passphrase">
</div>
<div class="form-group progress">
<div class="progress-bar" role="progressbar" id="progressbar" style="width: 100%"></div>
</div>
<button type="button" onclick="encryptDecryptFunction()" class="btn btn-primary">Decrypt</button>
</div>
<div class="col-sm" style="height:100%;">
<div class="form-group">
<label for="exampleFormControlTextarea1">Message</label>
<textarea class="form-control" rows="10" placeholder="So basically, I'm monky." id="result" readonly></textarea>
<textarea class="form-control" rows="10" placeholder="Secret Message" id="result" readonly></textarea>
</div>
</div>
</div>

View File

@@ -2,7 +2,7 @@
<head>
<title>browserPGP | Encrypt</title>
<meta name="description" content="Encrypt PGP in browser, simple and secure.">
<meta name="keywords" content="PGP,online,browser,javascript,github,live,secure,key generator,encrypt,decrypt,sign,verify">
<meta name="keywords" content="browserPGP,PGP,online,browser,javascript,github,live,secure,key generator,encrypt,decrypt,sign,verify">
<meta name="author" content="ar0n#1462">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
@@ -16,6 +16,7 @@
openpgp.initWorker({ path:'openpgp.worker.min.js' }) // set the relative web worker path
const encryptDecryptFunction = async() => {
document.getElementById("progressbar").className = "progress-bar progress-bar-striped progress-bar-animated";
// put keys in backtick (``) to avoid errors caused by spaces or tabs
const pubkey = document.getElementById("pubKey").value
@@ -29,6 +30,7 @@
openpgp.encrypt(options).then(ciphertext => {
encrypted = ciphertext.data // '-----BEGIN PGP MESSAGE ... END PGP MESSAGE-----'
document.getElementById("result").value = encrypted;
document.getElementById("progressbar").className = "progress-bar bg-success";
})
}
</script>
@@ -80,7 +82,7 @@
<div class="col-sm">
<div class="form-group">
<label for="exampleFormControlTextarea1">Input Text</label>
<textarea class="form-control" id="text" rows="5" placeholder="So basically, I'm monky."></textarea>
<textarea class="form-control" id="text" rows="5" placeholder="Secret Message"></textarea>
</div>
<button type="button" onclick="encryptDecryptFunction()" class="btn btn-primary">Encrypt</button>
</div>

View File

@@ -2,7 +2,7 @@
<head>
<title>browserPGP | Key Gen</title>
<meta name="description" content="Generate PGP keys in browser, simple and secure.">
<meta name="keywords" content="PGP,online,browser,javascript,github,live,secure,key generator,encrypt,decrypt,sign,verify">
<meta name="keywords" content="browserPGP,PGP,online,browser,javascript,github,live,secure,key generator,encrypt,decrypt,sign,verify">
<meta name="author" content="ar0n#1462">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
@@ -93,6 +93,9 @@
</div>
<small id="emailHelp" class="form-text text-danger">This may take some time and cause browser lag.</small>
<br>
<div class="form-group progress">
<div class="progress-bar" role="progressbar" id="progressbar" style="width: 100%"></div>
</div>
<div class="form-group">
<button type="button" onclick="encryptDecryptFunction()" class="btn btn-primary">Generate</button>
</div>

View File

@@ -3,9 +3,9 @@
<title>browserPGP</title>
<meta charset="UTF-8">
<meta name="description" content="PGP in browser, simple and secure.">
<meta name="keywords" content="PGP,online,browser,javascript,github,live,secure,key generator,encrypt,decrypt,sign,verify">
<meta name="keywords" content="browserPGP,PGP,online,browser,javascript,github,live,secure,key generator,encrypt,decrypt,sign,verify">
<meta name="author" content="ar0n#1462">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script>

View File

@@ -12,12 +12,14 @@
openpgp.initWorker({ path:'openpgp.worker.min.js' }) // set the relative web worker path
const encryptDecryptFunction = async() => {
document.getElementById("progressbar").className = "progress-bar progress-bar-striped progress-bar-animated";
// put keys in backtick (``) to avoid errors caused by spaces or tabs
const privkey = document.getElementById("privKey").value
const passphrase = document.getElementById("pass").value
const msg = document.getElementById("msg").value
const privKeyObj = (await openpgp.key.readArmored(privkey)).keys[0]
if (passphrase) {
await privKeyObj.decrypt(passphrase)
}
@@ -28,8 +30,14 @@
};
openpgp.sign(options).then(function(signed) {
if (signed.data) {
cleartext = signed.data; // '-----BEGIN PGP SIGNED MESSAGE ... END PGP SIGNATURE-----'
document.getElementById("result").value = cleartext;
document.getElementById("progressbar").className = "progress-bar bg-success";
} else {
document.getElementById("result").value = 'Signing failed.';
document.getElementById("progressbar").className = "progress-bar bg-danger";
}
});
}
</script>
@@ -75,7 +83,7 @@
<div class="col-sm">
<div class="form-group">
<label for="exampleFormControlTextarea1">Message</label>
<textarea class="form-control" style="font-size: 10px;" rows="10" id="msg" placeholder=""></textarea>
<textarea class="form-control" rows="6" id="msg" placeholder="Message to be signed. Don't sign anything vague as it could be used by someone to pretend to be you, include dates and specifics."></textarea>
</div>
<div class="form-group">
<label for="exampleFormControlTextarea1">PGP Privkey</label>
@@ -87,12 +95,15 @@
<label for="exampleInputEmail1">Privkey Passphrase</label>
<input type="password" class="form-control" id="pass" placeholder="Enter passphrase">
</div>
<button type="button" onclick="encryptDecryptFunction()" class="btn btn-primary">Decrypt</button>
<div class="form-group progress">
<div class="progress-bar" role="progressbar" id="progressbar" style="width: 100%"></div>
</div>
<button type="button" onclick="encryptDecryptFunction()" class="btn btn-primary">Sign</button>
</div>
<div class="col-sm" style="height:100%;">
<div class="form-group">
<label for="exampleFormControlTextarea1">PGP Message</label>
<textarea class="form-control" rows="10" placeholder="So basically, I'm monky." id="result" readonly></textarea>
<textarea class="form-control" style="font-size: 10px;" rows="20" placeholder="-----BEGIN PGP SIGNED MESSAGE-----" id="result" readonly></textarea>
</div>
</div>
</div>

View File

@@ -11,6 +11,7 @@
openpgp.initWorker({ path:'openpgp.worker.min.js' }) // set the relative web worker path
const encryptDecryptFunction = async() => {
document.getElementById("progressbar").className = "progress-bar progress-bar-striped progress-bar-animated";
// put keys in backtick (``) to avoid errors caused by spaces or tabs
const pubkey = document.getElementById("pubKey").value
const cleartext = document.getElementById("signMsg").value
@@ -23,8 +24,12 @@
openpgp.verify(options).then(function(verified) {
validity = verified.signatures[0].valid; // true
if (validity) {
document.getElementById("result").value('signed by key id ' + verified.signatures[0].keyid.toHex());
}
document.getElementById("result").value = 'Signed by key id ' + verified.signatures[0].keyid.toHex();
document.getElementById("progressbar").className = "progress-bar bg-success";
} else {
document.getElementById("progressbar").className = "progress-bar bg-danger";
document.getElementById("result").value = 'Verification wrong or failed. DO NOT TRUST.';
}
});
}
</script>
@@ -76,14 +81,17 @@
<div class="col-sm">
<div class="form-group">
<label for="exampleFormControlTextarea1">Public Key</label>
<textarea class="form-control" id="pubKey" rows="5" placeholder="-----BEGIN PGP PUBLIC KEY BLOCK-----"></textarea>
<textarea class="form-control" style="font-size: 10px;" id="pubKey" rows="10" placeholder="-----BEGIN PGP PUBLIC KEY BLOCK-----"></textarea>
</div>
<button type="button" onclick="encryptDecryptFunction()" class="btn btn-primary">Encrypt</button>
<div class="form-group progress">
<div class="progress-bar" role="progressbar" id="progressbar" style="width: 100%"></div>
</div>
<button type="button" onclick="encryptDecryptFunction()" class="btn btn-primary">Verify</button>
</div>
<div class="col-sm">
<div class="form-group">
<label for="exampleFormControlTextarea1">PGP Output</label>
<textarea class="form-control" style="font-size: 10px;" rows="10" id="result" placeholder="-----BEGIN PGP MESSAGE-----" readonly></textarea>
<textarea class="form-control" style="font-size: 10px;" rows="10" id="result" readonly></textarea>
</div>
</div>
</div>