82 lines
3.8 KiB
HTML
82 lines
3.8 KiB
HTML
|
<!doctype html>
|
||
|
<html>
|
||
|
|
||
|
<head>
|
||
|
<title>js-keygen: convert pkcs1 to pkcs8</title>
|
||
|
<script>module = {};</script>
|
||
|
<script src="pkcs1To8.js"></script>
|
||
|
<link rel="stylesheet" href="js-keygen.css">
|
||
|
<link rel="icon" type="image/png" href="key.png">
|
||
|
</head>
|
||
|
|
||
|
<body>
|
||
|
<div id="content">
|
||
|
<h1>Convert PKCS1 private key to PKCS8 private key</h1>
|
||
|
<p>From the command line you can run
|
||
|
<br>
|
||
|
<code>openssl pkcs8 -topk8 -inform PEM -outform PEM -in private.pkcs1 -out private.pkcs8 -nocrypt</code>
|
||
|
<br>We can do the same in javascript</p>
|
||
|
<br> No data is being sent to the server, everything happens within the context of this web page.
|
||
|
<br>
|
||
|
<hr>
|
||
|
<div>
|
||
|
<label for="key">PKCS1 private Key PEM:</label>
|
||
|
<br>
|
||
|
<textarea id="key" style="height: 300px;" spellcheck="false">-----BEGIN PRIVATE KEY-----
|
||
|
MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQCku91CnYnU+88p
|
||
|
sDWthuLgMLZd1cWOMF8xV7KUNR/EqssNWObwdD/mrX6Z8t9MPl0T6jL8+EMHRcQn
|
||
|
pIR8bgUf7WT7Kl9INe/TpoIVX1bfyenQIqJbFE4lPs3E0VJP45wHFFRK85ls08zI
|
||
|
OVDmzYFt87upTiwPbxS5OIFUB16sxttKAdXhebtWtkVQPB9662OG2WRhVlJqXNc9
|
||
|
wuWvb0XnbVUxF0ryhsJj24VR3cjHQtkDc22Vu8yUzWS3VtBSUdfzT1EwVXm1AGAz
|
||
|
WhjO+W/7fvWYvR9uO7O+po0g4kbloL9lO1v+pMPVZvcv6VQqLbcgNc6fzAlfwis9
|
||
|
a/uKgRZhAgMBAAECggEADtNBZF9dKifHSw8qpYVAIcEAiI1WjCdaScyEq8XkKATe
|
||
|
5UKc9gLgRVhT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dL2o0FealVXra3IpECgYA0YYrmCNXb2LISpJe3NLJI
|
||
|
4UkMLsRwR4rnumsmbQl7u3NAjZtvsUWv+b8fayEbQii49RwfslJclrSAG/y0l/sA
|
||
|
l+a6EbtPiu6HeP0nLYksP/yxSd1RfXWr2KEKQXv0DSRguQAmr5QyR6CMCJXvM/ul
|
||
|
zB/5uOOZD9IzgautQqwIcQ==
|
||
|
-----END PRIVATE KEY-----
|
||
|
</textarea>
|
||
|
</div>
|
||
|
<button id="generate">Convert</button>
|
||
|
<div>
|
||
|
<label for="pem">PKCS8 private key PEM:</label>
|
||
|
<br>
|
||
|
<textarea id="pem" disabled style="height: 350px;" spellcheck="false"></textarea>
|
||
|
</div>
|
||
|
<br> To validate this pkcs8 record you can convert it baco pkcs1 through openssl:
|
||
|
<code>openssl pkcs8 -inform PEM -outform PEM -in private.pkcs8 -out private.pkcs1 -nocrypt</code>
|
||
|
<hr> Made with
|
||
|
<span style="color:magenta;">♥</span> by
|
||
|
<a href="http://blog.roumanoff.com">Patrick Roumanoff</a>
|
||
|
<a href="https://github.com/PatrickRoumanoff/js-keygen">
|
||
|
<img style="position: absolute; top: 0; right: 0; border: 0;" src="https://camo.githubusercontent.com/365986a132ccd6a44c23a9169022c0b5c890c387/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f7265645f6161303030302e706e67"
|
||
|
alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_red_aa0000.png">
|
||
|
</a>
|
||
|
</div>
|
||
|
<script>
|
||
|
document.addEventListener("DOMContentLoaded", () => {
|
||
|
document.querySelector("#generate").addEventListener("click", () => {
|
||
|
document.querySelector("#pem").value = pkcs1To8(document.querySelector("#key").value)
|
||
|
});
|
||
|
});
|
||
|
</script>
|
||
|
|
||
|
</body>
|
||
|
|
||
|
</html>
|