a
This commit is contained in:
18
verify.html
18
verify.html
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user