-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathgen.html
138 lines (133 loc) · 6.17 KB
/
gen.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
<html>
<head>
<title>browserPGP | Key Gen</title>
<meta name="description" content="Generate PGP keys in browser, simple and secure." />
<meta name="keywords" content="browserPGP,PGP,OpenPGP,online,browser,javascript,github,live,secure,key generator,key gen,encrypt,decrypt,sign,verify,signature">
<meta name="author" content="ar0n#1462">
<link rel="icon" type='image/png' sizes='256x256' href="/256.png"/>
<link rel="stylesheet" href="bootstrap.min.css">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="prngCheck.js"></script>
<script src="favicon.js"></script>
<script src="sha1.min.js"></script>
<script src="openpgp.min.js"></script>
<script src="jquery.min.js"></script>
<script src="bootstrap.min.js"></script>
<script>
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";
const options = {
userIds: [{ name:document.getElementById("name").value, email:document.getElementById("email").value }], // multiple user IDs
numBits: 4096, // RSA key size
passphrase: document.getElementById("pass").value // protects the private key
};
openpgp.generateKey(options).then(function(key) {
var privkey = key.privateKeyArmored; // '-----BEGIN PGP PRIVATE KEY BLOCK ... '
var pubkey = key.publicKeyArmored; // '-----BEGIN PGP PUBLIC KEY BLOCK ... '
var revocationSignature = key.revocationSignature; // '-----BEGIN PGP PUBLIC KEY BLOCK ... '
document.getElementById("privkey").value = privkey;
document.getElementById("pubkey").value = pubkey;
document.getElementById("progressbar").className = "progress-bar bg-success";
}).catch(function(error){
document.getElementById("pubkey").value = error.message;
document.getElementById("privKey").value = error.message;
document.getElementById("progressbar").className = "progress-bar bg-danger";
});
}
</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="/">About</a>
</li>
<li class="nav-item active">
<a class="nav-link" href="/gen.html">Key Generator</a>
</li>
<li class="nav-item">
<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="/sign.html">Sign</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/verify.html">Verify</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/compatibility.html">Compatibility</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="exampleInputEmail1">Name</label>
<input type="text" class="form-control" id="name" placeholder="Enter name">
<small class="form-text text-muted">Will be implemented in PGP keys.</small>
</div>
<div class="form-group">
<label for="exampleInputEmail1">Email address</label>
<input type="email" class="form-control" id="email" placeholder="Enter email">
<small class="form-text text-muted">Will be implemented in PGP keys.</small>
</div>
<div class="form-group">
<label for="exampleInputEmail1">Passphrase</label>
<input type="password" class="form-control" id="pass" placeholder="Enter passphrase">
<small class="form-text text-muted">Protects your keys. Needs to be secure.</small>
</div>
<div class="form-group progress">
<div class="progress-bar" role="progressbar" id="progressbar" style="width: 100%"></div>
</div>
<small id="emailHelp" class="form-text text-danger">This may take some time and cause browser lag.</small>
<br>
<div class="form-group">
<button type="button" onclick="encryptDecryptFunction()" class="btn btn-primary">Generate</button>
</div>
<div id="collapseExample">
<div class="card card-body">
This tool generates a 4096 bit RSA pair of PGP keys. The private key should be backed up in a secure private way. The public key can be shared publicly. These keys can be used for signing, encrypting, and decrypting texts, e-mails, files and directories.
</div>
</div>
</div>
<div class="col-sm">
<div class="form-group">
<label for="exampleFormControlTextarea1">PGP Private Key <a class="text-danger">do not share! (gives complete control of PGP)</a></label>
<textarea class="form-control" style="font-size: 10px;" rows="10" placeholder="-----BEGIN PGP PRIVATE KEY BLOCK-----" id="privkey" readonly></textarea>
</div>
</div>
<div class="col-sm">
<div class="form-group">
<label for="exampleFormControlTextarea1">PGP Public Key <a class="text-success">share this one.</a></label>
<textarea class="form-control" style="font-size: 10px;" rows="10" placeholder="-----BEGIN PGP PUBLIC KEY BLOCK-----" id="pubkey" readonly></textarea>
</div>
</div>
</div>
</div>
</div>
</body>
</html>