a
This commit is contained in:
102
sign.html
Normal file
102
sign.html
Normal file
@@ -0,0 +1,102 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>browserPGP | Decrypt</title>
|
||||
<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>
|
||||
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<script src="openpgp.min.js"></script>
|
||||
<script>
|
||||
|
||||
openpgp.initWorker({ path:'openpgp.worker.min.js' }) // set the relative web worker path
|
||||
|
||||
const encryptDecryptFunction = async() => {
|
||||
// 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)
|
||||
}
|
||||
|
||||
options = {
|
||||
message: openpgp.cleartext.fromText(msg), // CleartextMessage or Message object
|
||||
privateKeys: [privKeyObj] // for signing
|
||||
};
|
||||
|
||||
openpgp.sign(options).then(function(signed) {
|
||||
cleartext = signed.data; // '-----BEGIN PGP SIGNED MESSAGE ... END PGP SIGNATURE-----'
|
||||
document.getElementById("result").value = cleartext;
|
||||
});
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
html, body {
|
||||
height: 95%;
|
||||
}
|
||||
div.main {
|
||||
padding:20px;
|
||||
height: 100%;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<nav class="navbar navbar-expand-lg navbar-light bg-light">
|
||||
<a class="navbar-brand" href="/">
|
||||
<img src="/logo.svg" width="30" height="30" class="d-inline-block align-top" alt="">
|
||||
browserPGP
|
||||
</a>
|
||||
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
<div class="collapse navbar-collapse" id="navbarNav">
|
||||
<ul class="navbar-nav">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="/encrypt.html">Encrypt</a>
|
||||
</li>
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="/decrypt.html">Decrypt</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="/gen.html">Key Generator</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="">More to come.</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</nav>
|
||||
<div class="main">
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<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>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="exampleFormControlTextarea1">PGP Privkey</label>
|
||||
<textarea class="form-control" style="font-size: 10px;" rows="10" id="privKey" placeholder="-----BEGIN PGP PRIVATE KEY BLOCK-----"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm">
|
||||
<div class="form-group">
|
||||
<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>
|
||||
<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>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
94
verify.html
Normal file
94
verify.html
Normal file
@@ -0,0 +1,94 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>browserPGP | Verify</title>
|
||||
<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>
|
||||
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<script src="openpgp.min.js"></script>
|
||||
<script>
|
||||
openpgp.initWorker({ path:'openpgp.worker.min.js' }) // set the relative web worker path
|
||||
|
||||
const encryptDecryptFunction = async() => {
|
||||
// put keys in backtick (``) to avoid errors caused by spaces or tabs
|
||||
const pubkey = document.getElementById("pubKey").value
|
||||
const cleartext = document.getElementById("signMsg").value
|
||||
|
||||
options = {
|
||||
message: await openpgp.cleartext.readArmored(cleartext), // parse armored message
|
||||
publicKeys: (await openpgp.key.readArmored(pubkey)).keys // for verification
|
||||
};
|
||||
|
||||
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());
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
html, body {
|
||||
height: 95%;
|
||||
}
|
||||
div.main {
|
||||
padding:20px;
|
||||
height: 100%;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<nav class="navbar navbar-expand-lg navbar-light bg-light">
|
||||
<a class="navbar-brand" href="/">
|
||||
<img src="/logo.svg" width="30" height="30" class="d-inline-block align-top" alt="">
|
||||
browserPGP
|
||||
</a>
|
||||
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
<div class="collapse navbar-collapse" id="navbarNav">
|
||||
<ul class="navbar-nav">
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="/encrypt.html">Encrypt</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="/decrypt.html">Decrypt</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="/gen.html">Key Generator</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="">More to come.</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</nav>
|
||||
<div class="main">
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-sm">
|
||||
<div class="form-group">
|
||||
<label for="exampleFormControlTextarea1">Signed Message</label>
|
||||
<textarea class="form-control" style="font-size: 10px;" rows="10" id="signMsg" placeholder="-----BEGIN PGP SIGNED MESSAGE ... END PGP SIGNATURE-----"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<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>
|
||||
</div>
|
||||
<button type="button" onclick="encryptDecryptFunction()" class="btn btn-primary">Encrypt</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>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
<!-- BlnD=@3B2sFD,f++D5D0F<L -->
|
||||
Reference in New Issue
Block a user