65 lines
1.7 KiB
HTML
65 lines
1.7 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<title>SSH Pub Generator - Bluecrypt</title>
|
|
<style>
|
|
textarea {
|
|
width: 42em;
|
|
height: 10em;
|
|
}
|
|
pre {
|
|
white-space: pre-wrap;
|
|
}
|
|
.code {
|
|
width: 29em;
|
|
word-wrap: break-word;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<h1>Bluecrypt SSH Public Key Generator</h1>
|
|
|
|
<textarea class="js-input" placeholder="Paste a PEM here">{
|
|
"kty": "EC",
|
|
"crv": "P-256",
|
|
"x": "IT1SWLxsacPiE5Z16jkopAn8_-85rMjgyCokrnjDft4",
|
|
"y": "mP2JwOAOdMmXuwpxbKng3KZz27mz-nKWIlXJ3rzSGMo"
|
|
}</textarea>
|
|
<br>
|
|
<input type="text" class="js-comment" placeholder="SSH comment (i.e. root@localhost" value="root@localhost">
|
|
|
|
<!-- pre><code class="js-hex"> </code></pre -->
|
|
|
|
<div class="code"><pre><code class="js-pub"> </code></pre></div>
|
|
|
|
<br>
|
|
<p>Made with <a href="https://git.coolaj86.com/coolaj86/bluecrypt-jwk-to-ssh.js/">jwk-to-ssh.js</a></p>
|
|
|
|
<script src="./jwk-to-ssh.js"></script>
|
|
<script>
|
|
'use strict';
|
|
var $input = document.querySelector('.js-input');
|
|
|
|
function convert() {
|
|
console.log('keyup');
|
|
|
|
try {
|
|
var text = document.querySelector('.js-input').value;
|
|
var comment = document.querySelector('.js-comment').value;
|
|
var jwk = JSON.parse(text);
|
|
var pub = SSH.pack({ jwk: jwk, comment: comment });
|
|
//document.querySelector('.js-hex').innerText = hex
|
|
// .match(/.{2}/g).join(' ').match(/.{1,24}/g).join(' ').match(/.{1,50}/g).join('\n');
|
|
document.querySelector('.js-pub').innerText = pub;
|
|
} catch(e) {
|
|
var msg = { error: { message: e.message } };
|
|
document.querySelector('.js-pub').innerText = JSON.stringify(msg, null, 2);
|
|
}
|
|
}
|
|
|
|
$input.addEventListener('keyup', convert);
|
|
convert();
|
|
</script>
|
|
</body>
|
|
</html>
|