Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

4.1.5 release

  • Loading branch information...
commit 7c21fda71b0e7225dff5104d39827b67d73f4144 1 parent db0d173
@kjur authored
View
7 ChangeLog.txt
@@ -1,6 +1,13 @@
ChangeLog for jsrsasign
+* Changes between 4.1.4 to 4.1.5 (2013-Sep-29)
+ - keyutil 1.0.0 to 1.0.1
+ - new generateKeypair method added
+ - fix getKey method
+ - add LICENSE file for YUI.
+ - name jsrsasign-4.1.4-all-min.js is the same but updated.
+
* Changes between 4.1.3 to 4.1.4 (2013-Sep-24)
- ext/cryptojs-312-core-fix*.js added to fix HmacSHA224/384 issue.
Please use
View
2  api/files.html
@@ -451,7 +451,7 @@ <h1 class="classTitle">File Index</h1>
<dt class="heading">Version:</dt>
- <dd>keyutil 1.0.0 (2013-Sep-14)</dd>
+ <dd>keyutil 1.0.1 (2013-Sep-27)</dd>
View
79 api/symbols/KEYUTIL.html
@@ -409,6 +409,15 @@ <h1 class="classTitle">
<tr>
<td class="attributes">&lt;static&gt; &nbsp;</td>
<td class="nameDescription">
+ <div class="fixedFont">KEYUTIL.<b><a href="../symbols/KEYUTIL.html#.generateKeypair">generateKeypair</a></b>(alg, keylenOrCurve)
+ </div>
+ <div class="description">This method generates a key pair of public key algorithm.</div>
+ </td>
+ </tr>
+
+ <tr>
+ <td class="attributes">&lt;static&gt; &nbsp;</td>
+ <td class="nameDescription">
<div class="fixedFont">KEYUTIL.<b><a href="../symbols/KEYUTIL.html#.getDecryptedKeyHex">getDecryptedKeyHex</a></b>(sEncryptedPEM, passcode)
</div>
<div class="description">decrypt PEM formatted protected PKCS#5 private key with passcode</div>
@@ -848,6 +857,76 @@ <h1 class="classTitle">
Method Detail
</div>
+ <a name=".generateKeypair"> </a>
+ <div class="fixedFont">&lt;static&gt;
+
+ <span class="light">{Array}</span>
+ <span class="light">KEYUTIL.</span><b>generateKeypair</b>(alg, keylenOrCurve)
+
+ </div>
+ <div class="description">
+ This method generates a key pair of public key algorithm.
+The result will be an associative array which has following
+parameters:
+<ul>
+<li>prvKeyObj - RSAKey or ECDSA object of private key</li>
+<li>pubKeyObj - RSAKey or ECDSA object of public key</li>
+</ul>
+NOTE1: As for RSA algoirthm, public exponent has fixed
+value '0x10001'.
+NOTE2: As for EC algorithm, supported names of curve are
+secp256r1, secp256k1 and secp384r1.
+
+
+ </div>
+
+
+
+ <pre class="code">var rsaKeypair = KEYUTIL.generateKeypair("RSA", 1024);
+var ecKeypair = KEYUTIL.generateKeypair("EC", "secp256r1");</pre>
+
+
+
+
+ <dl class="detailList">
+ <dt class="heading">Parameters:</dt>
+
+ <dt>
+ <span class="light fixedFont">{String}</span> <b>alg</b>
+
+ </dt>
+ <dd>'RSA' or 'EC'</dd>
+
+ <dt>
+ <span class="light fixedFont">{Object}</span> <b>keylenOrCurve</b>
+
+ </dt>
+ <dd>key length for RSA or curve name for EC</dd>
+
+ </dl>
+
+
+
+ <dl class="detailList">
+ <dt class="heading">Since:</dt>
+ <dd>keyutil 1.0.1</dd>
+ </dl>
+ </dl>
+
+
+
+ <dl class="detailList">
+ <dt class="heading">Returns:</dt>
+
+ <dd><span class="light fixedFont">{Array}</span> associative array of keypair which has prvKeyObj and pubKeyObj parameters</dd>
+
+ </dl>
+
+
+
+
+ <hr />
+
<a name=".getDecryptedKeyHex"> </a>
<div class="fixedFont">&lt;static&gt;
View
73 api/symbols/src/keyutil-1.0.js.html
@@ -5,7 +5,7 @@
.STRN {color: #393;}
.REGX {color: #339;}
.line {border-right: 1px dotted #666; color: #666; font-style: normal;}
- </style></head><body><pre><span class='line'> 1</span> <span class="COMM">/*! keyutil-1.0.0.js (c) 2013 Kenji Urushima | kjur.github.com/jsrsasign/license
+ </style></head><body><pre><span class='line'> 1</span> <span class="COMM">/*! keyutil-1.0.1.js (c) 2013 Kenji Urushima | kjur.github.com/jsrsasign/license
<span class='line'> 2</span> */</span><span class="WHIT">
<span class='line'> 3</span> </span><span class="COMM">/*
<span class='line'> 4</span> * keyutil.js - key utility for PKCS#5/8 PEM, RSA/ECDSA key object
@@ -22,8 +22,8 @@
<span class='line'> 15</span> * @fileOverview
<span class='line'> 16</span> * @name keyutil-1.0.js
<span class='line'> 17</span> * @author Kenji Urushima kenji.urushima@gmail.com
-<span class='line'> 18</span> * @version keyutil 1.0.0 (2013-Sep-14)
-<span class='line'> 19</span> * @since jsrsasign 4.1.3
+<span class='line'> 18</span> * @version keyutil 1.0.1 (2013-Sep-27)
+<span class='line'> 19</span> * @since jsrsasign 4.1.4
<span class='line'> 20</span> * @license &lt;a href="http://kjur.github.io/jsrsasign/license/">MIT License&lt;/a>
<span class='line'> 21</span> */</span><span class="WHIT">
<span class='line'> 22</span>
@@ -1198,7 +1198,7 @@
<span class='line'>1191</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">KJUR.crypto.ECDSA</span><span class="PUNC">(</span><span class="PUNC">{</span><span class="NAME">prv</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">param.xy</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">curve</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">param.curve</span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1192</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>1193</span> </span><span class="WHIT"> </span><span class="COMM">// 2.2. RSA private key</span><span class="WHIT">
-<span class='line'>1194</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">param</span><span class="PUNC">,</span><span class="NAME">n</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="NAME">undefined</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">param.e</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="NAME">undefined</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">param.d</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="NAME">undefined</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT">
+<span class='line'>1194</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">param.n</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="NAME">undefined</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">param.e</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="NAME">undefined</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">param.d</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="NAME">undefined</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT">
<span class='line'>1195</span> </span><span class="WHIT"> </span><span class="NAME">param.p</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="NAME">undefined</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">param.q</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="NAME">undefined</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT">
<span class='line'>1196</span> </span><span class="WHIT"> </span><span class="NAME">param.dp</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="NAME">undefined</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">param.dq</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="NAME">undefined</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">param.co</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="NAME">undefined</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1197</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">key</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">RSAKey</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
@@ -1211,7 +1211,7 @@
<span class='line'>1204</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">KJUR.crypto.ECDSA</span><span class="PUNC">(</span><span class="PUNC">{</span><span class="NAME">pub</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">param.d</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">curve</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">param.curve</span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1205</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>1206</span> </span><span class="WHIT"> </span><span class="COMM">// 2.4. RSA private key</span><span class="WHIT">
-<span class='line'>1207</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">param</span><span class="PUNC">,</span><span class="NAME">n</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="NAME">undefined</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">param.e</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
+<span class='line'>1207</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">param.n</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="NAME">undefined</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">param.e</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1208</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">key</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">RSAKey</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1209</span> </span><span class="WHIT"> </span><span class="NAME">key.setPublic</span><span class="PUNC">(</span><span class="NAME">param.n</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">param.e</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1210</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">key</span><span class="PUNC">;</span><span class="WHIT">
@@ -1275,4 +1275,65 @@
<span class='line'>1268</span> </span><span class="WHIT"> </span><span class="KEYW">throw</span><span class="WHIT"> </span><span class="STRN">"not supported argument"</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1269</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1270</span>
-<span class='line'>1271</span> </span></pre></body></html>
+<span class='line'>1271</span> </span><span class="COMM">/**
+<span class='line'>1272</span> * @name generateKeypair
+<span class='line'>1273</span> * @memberOf KEYUTIL
+<span class='line'>1274</span> * @function
+<span class='line'>1275</span> * @static
+<span class='line'>1276</span> * @param {String} alg 'RSA' or 'EC'
+<span class='line'>1277</span> * @param {Object} keylenOrCurve key length for RSA or curve name for EC
+<span class='line'>1278</span> * @return {Array} associative array of keypair which has prvKeyObj and pubKeyObj parameters
+<span class='line'>1279</span> * @since keyutil 1.0.1
+<span class='line'>1280</span> * @description
+<span class='line'>1281</span> * This method generates a key pair of public key algorithm.
+<span class='line'>1282</span> * The result will be an associative array which has following
+<span class='line'>1283</span> * parameters:
+<span class='line'>1284</span> * &lt;ul>
+<span class='line'>1285</span> * &lt;li>prvKeyObj - RSAKey or ECDSA object of private key&lt;/li>
+<span class='line'>1286</span> * &lt;li>pubKeyObj - RSAKey or ECDSA object of public key&lt;/li>
+<span class='line'>1287</span> * &lt;/ul>
+<span class='line'>1288</span> * NOTE1: As for RSA algoirthm, public exponent has fixed
+<span class='line'>1289</span> * value '0x10001'.
+<span class='line'>1290</span> * NOTE2: As for EC algorithm, supported names of curve are
+<span class='line'>1291</span> * secp256r1, secp256k1 and secp384r1.
+<span class='line'>1292</span> * @example
+<span class='line'>1293</span> * var rsaKeypair = KEYUTIL.generateKeypair("RSA", 1024);
+<span class='line'>1294</span> * var ecKeypair = KEYUTIL.generateKeypair("EC", "secp256r1");
+<span class='line'>1295</span> *
+<span class='line'>1296</span> */</span><span class="WHIT">
+<span class='line'>1297</span> </span><span class="NAME">KEYUTIL.generateKeypair</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">alg</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">keylenOrCurve</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
+<span class='line'>1298</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">alg</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">"RSA"</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
+<span class='line'>1299</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">keylen</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">keylenOrCurve</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'>1300</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">prvKey</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">RSAKey</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'>1301</span> </span><span class="WHIT"> </span><span class="NAME">prvKey.generate</span><span class="PUNC">(</span><span class="NAME">keylen</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">'10001'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'>1302</span> </span><span class="WHIT">
+<span class='line'>1303</span> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">pubKey</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">RSAKey</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'>1304</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">hN</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">prvKey.n.toString</span><span class="PUNC">(</span><span class="NUMB">16</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'>1305</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">hE</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">prvKey.e.toString</span><span class="PUNC">(</span><span class="NUMB">16</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'>1306</span> </span><span class="WHIT"> </span><span class="NAME">pubKey.setPublic</span><span class="PUNC">(</span><span class="NAME">hN</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">hE</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'>1307</span> </span><span class="WHIT">
+<span class='line'>1308</span> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">result</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'>1309</span> </span><span class="WHIT"> </span><span class="NAME">result.prvKeyObj</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">prvKey</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'>1310</span> </span><span class="WHIT"> </span><span class="NAME">result.pubKeyObj</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">pubKey</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'>1311</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">result</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'>1312</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">alg</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">"EC"</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
+<span class='line'>1313</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">curve</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">keylenOrCurve</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'>1314</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">ec</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">KJUR.crypto.ECDSA</span><span class="PUNC">(</span><span class="PUNC">{</span><span class="NAME">curve</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">curve</span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'>1315</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">keypairHex</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">ec.generateKeyPairHex</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'>1316</span>
+<span class='line'>1317</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">prvKey</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">KJUR.crypto.ECDSA</span><span class="PUNC">(</span><span class="PUNC">{</span><span class="NAME">curve</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">curve</span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'>1318</span> </span><span class="WHIT"> </span><span class="NAME">prvKey.setPrivateKeyHex</span><span class="PUNC">(</span><span class="NAME">keypairHex.ecprvhex</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'>1319</span>
+<span class='line'>1320</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">pubKey</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">KJUR.crypto.ECDSA</span><span class="PUNC">(</span><span class="PUNC">{</span><span class="NAME">curve</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">curve</span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'>1321</span> </span><span class="WHIT"> </span><span class="NAME">pubKey.setPublicKeyHex</span><span class="PUNC">(</span><span class="NAME">keypairHex.ecpubhex</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'>1322</span>
+<span class='line'>1323</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">result</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'>1324</span> </span><span class="WHIT"> </span><span class="NAME">result.prvKeyObj</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">prvKey</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'>1325</span> </span><span class="WHIT"> </span><span class="NAME">result.pubKeyObj</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">pubKey</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'>1326</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">result</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'>1327</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
+<span class='line'>1328</span> </span><span class="WHIT"> </span><span class="KEYW">throw</span><span class="WHIT"> </span><span class="STRN">"unknown algorithm: "</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">alg</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'>1329</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
+<span class='line'>1330</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'>1331</span>
+<span class='line'>1332</span> </span></pre></body></html>
View
38 ext/THIRDPARTY_LICENSE.yui.txt
@@ -0,0 +1,38 @@
+http://yuilibrary.com/license/
+
+LICENCE:
+ BSD License
+
+FILES
+ - a part of ../jsrsasign-x.x.x-all-min.js
+
+Software License Agreement (BSD License)
+
+Copyright c 2013 Yahoo! Inc. All rights reserved.
+
+Redistribution and use of this software in source and binary forms,
+with or without modification, are permitted provided that the
+following conditions are met:
+
+- Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+- Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+- Neither the name of Yahoo! Inc. nor the names of YUI's contributors
+ may be used to endorse or promote products derived from this
+ software without specific prior written permission of Yahoo! Inc.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
View
6 jsrsasign-4.1.4-all-min.js
@@ -1,5 +1,5 @@
/*
- * jsrsasign 4.1.4 (c) 2010-2013 Kenji Urushima | kjur.github.com/jsrsasign/license
+ * jsrsasign 4.1.5 (c) 2010-2013 Kenji Urushima | kjur.github.com/jsrsasign/license
*/
/*
yahoo-min.js
@@ -232,9 +232,9 @@ if(typeof KJUR=="undefined"||!KJUR){KJUR={}}if(typeof KJUR.crypto=="undefined"||
/*! pkcs5pkey-1.0.5.js (c) 2013 Kenji Urushima | kjur.github.com/jsrsasign/license
*/
var PKCS5PKEY=function(){var c=function(n,p,o){return i(CryptoJS.AES,n,p,o)};var d=function(n,p,o){return i(CryptoJS.TripleDES,n,p,o)};var i=function(q,v,s,o){var p=CryptoJS.enc.Hex.parse(v);var u=CryptoJS.enc.Hex.parse(s);var n=CryptoJS.enc.Hex.parse(o);var r={};r.key=u;r.iv=n;r.ciphertext=p;var t=q.decrypt(r,u,{iv:n});return CryptoJS.enc.Hex.stringify(t)};var j=function(n,p,o){return e(CryptoJS.AES,n,p,o)};var m=function(n,p,o){return e(CryptoJS.TripleDES,n,p,o)};var e=function(s,x,v,p){var r=CryptoJS.enc.Hex.parse(x);var w=CryptoJS.enc.Hex.parse(v);var o=CryptoJS.enc.Hex.parse(p);var n={};var u=s.encrypt(r,w,{iv:o});var q=CryptoJS.enc.Hex.parse(u.toString());var t=CryptoJS.enc.Base64.stringify(q);return t};var g={"AES-256-CBC":{proc:c,eproc:j,keylen:32,ivlen:16},"AES-192-CBC":{proc:c,eproc:j,keylen:24,ivlen:16},"AES-128-CBC":{proc:c,eproc:j,keylen:16,ivlen:16},"DES-EDE3-CBC":{proc:d,eproc:m,keylen:24,ivlen:8}};var b=function(n){return g[n]["proc"]};var k=function(n){var p=CryptoJS.lib.WordArray.random(n);var o=CryptoJS.enc.Hex.stringify(p);return o};var l=function(q){var r={};if(q.match(new RegExp("DEK-Info: ([^,]+),([0-9A-Fa-f]+)","m"))){r.cipher=RegExp.$1;r.ivsalt=RegExp.$2}if(q.match(new RegExp("-----BEGIN ([A-Z]+) PRIVATE KEY-----"))){r.type=RegExp.$1}var p=-1;var t=0;if(q.indexOf("\r\n\r\n")!=-1){p=q.indexOf("\r\n\r\n");t=2}if(q.indexOf("\n\n")!=-1){p=q.indexOf("\n\n");t=1}var o=q.indexOf("-----END");if(p!=-1&&o!=-1){var n=q.substring(p+t*2,o-t);n=n.replace(/\s+/g,"");r.data=n}return r};var h=function(o,w,n){var t=n.substring(0,16);var r=CryptoJS.enc.Hex.parse(t);var p=CryptoJS.enc.Utf8.parse(w);var s=g[o]["keylen"]+g[o]["ivlen"];var v="";var u=null;for(;;){var q=CryptoJS.algo.MD5.create();if(u!=null){q.update(u)}q.update(p);q.update(r);u=q.finalize();v=v+CryptoJS.enc.Hex.stringify(u);if(v.length>=s*2){break}}var x={};x.keyhex=v.substr(0,g[o]["keylen"]*2);x.ivhex=v.substr(g[o]["keylen"]*2,g[o]["ivlen"]*2);return x};var a=function(n,t,p,u){var q=CryptoJS.enc.Base64.parse(n);var o=CryptoJS.enc.Hex.stringify(q);var s=g[t]["proc"];var r=s(o,p,u);return r};var f=function(n,q,o,s){var p=g[q]["eproc"];var r=p(n,o,s);return r};return{version:"1.0.5",getHexFromPEM:function(o,r){var p=o;if(p.indexOf("BEGIN "+r)==-1){throw"can't find PEM header: "+r}p=p.replace("-----BEGIN "+r+"-----","");p=p.replace("-----END "+r+"-----","");var q=p.replace(/\s+/g,"");var n=b64tohex(q);return n},getDecryptedKeyHexByKeyIV:function(o,r,q,p){var n=b(r);return n(o,q,p)},parsePKCS5PEM:function(n){return l(n)},getKeyAndUnusedIvByPasscodeAndIvsalt:function(o,n,p){return h(o,n,p)},decryptKeyB64:function(n,p,o,q){return a(n,p,o,q)},getDecryptedKeyHex:function(w,v){var o=l(w);var r=o.type;var p=o.cipher;var n=o.ivsalt;var q=o.data;var u=h(p,v,n);var t=u.keyhex;var s=a(q,p,t,n);return s},getRSAKeyFromEncryptedPKCS5PEM:function(p,o){var q=this.getDecryptedKeyHex(p,o);var n=new RSAKey();n.readPrivateKeyFromASN1HexString(q);return n},getEryptedPKCS5PEMFromPrvKeyHex:function(q,x,r,p){var n="";if(typeof r=="undefined"||r==null){r="AES-256-CBC"}if(typeof g[r]=="undefined"){throw"PKCS5PKEY unsupported algorithm: "+r}if(typeof p=="undefined"||p==null){var t=g[r]["ivlen"];var s=k(t);p=s.toUpperCase()}var w=h(r,x,p);var v=w.keyhex;var u=f(q,r,v,p);var o=u.replace(/(.{64})/g,"$1\r\n");var n="-----BEGIN RSA PRIVATE KEY-----\r\n";n+="Proc-Type: 4,ENCRYPTED\r\n";n+="DEK-Info: "+r+","+p+"\r\n";n+="\r\n";n+=o;n+="\r\n-----END RSA PRIVATE KEY-----\r\n";return n},getEryptedPKCS5PEMFromRSAKey:function(C,D,o,s){var A=new KJUR.asn1.DERInteger({"int":0});var v=new KJUR.asn1.DERInteger({bigint:C.n});var z=new KJUR.asn1.DERInteger({"int":C.e});var B=new KJUR.asn1.DERInteger({bigint:C.d});var t=new KJUR.asn1.DERInteger({bigint:C.p});var r=new KJUR.asn1.DERInteger({bigint:C.q});var y=new KJUR.asn1.DERInteger({bigint:C.dmp1});var u=new KJUR.asn1.DERInteger({bigint:C.dmq1});var x=new KJUR.asn1.DERInteger({bigint:C.coeff});var E=new KJUR.asn1.DERSequence({array:[A,v,z,B,t,r,y,u,x]});var w=E.getEncodedHex();return this.getEryptedPKCS5PEMFromPrvKeyHex(w,D,o,s)},newEncryptedPKCS5PEM:function(n,o,r,s){if(typeof o=="undefined"||o==null){o=1024}if(typeof r=="undefined"||r==null){r="10001"}var p=new RSAKey();p.generate(o,r);var q=null;if(typeof s=="undefined"||s==null){q=this.getEncryptedPKCS5PEMFromRSAKey(pkey,n)}else{q=this.getEncryptedPKCS5PEMFromRSAKey(pkey,n,s)}return q},getRSAKeyFromPlainPKCS8PEM:function(p){if(p.match(/ENCRYPTED/)){throw"pem shall be not ENCRYPTED"}var o=this.getHexFromPEM(p,"PRIVATE KEY");var n=this.getRSAKeyFromPlainPKCS8Hex(o);return n},getRSAKeyFromPlainPKCS8Hex:function(q){var p=ASN1HEX.getPosArrayOfChildren_AtObj(q,0);if(p.length!=3){throw"outer DERSequence shall have 3 elements: "+p.length}var o=ASN1HEX.getHexOfTLV_AtObj(q,p[1]);if(o!="300d06092a864886f70d0101010500"){throw"PKCS8 AlgorithmIdentifier is not rsaEnc: "+o}var o=ASN1HEX.getHexOfTLV_AtObj(q,p[1]);var r=ASN1HEX.getHexOfTLV_AtObj(q,p[2]);var s=ASN1HEX.getHexOfV_AtObj(r,0);var n=new RSAKey();n.readPrivateKeyFromASN1HexString(s);return n},parseHexOfEncryptedPKCS8:function(u){var q={};var p=ASN1HEX.getPosArrayOfChildren_AtObj(u,0);if(p.length!=2){throw"malformed format: SEQUENCE(0).items != 2: "+p.length}q.ciphertext=ASN1HEX.getHexOfV_AtObj(u,p[1]);var w=ASN1HEX.getPosArrayOfChildren_AtObj(u,p[0]);if(w.length!=2){throw"malformed format: SEQUENCE(0.0).items != 2: "+w.length}if(ASN1HEX.getHexOfV_AtObj(u,w[0])!="2a864886f70d01050d"){throw"this only supports pkcs5PBES2"}var n=ASN1HEX.getPosArrayOfChildren_AtObj(u,w[1]);if(w.length!=2){throw"malformed format: SEQUENCE(0.0.1).items != 2: "+n.length}var o=ASN1HEX.getPosArrayOfChildren_AtObj(u,n[1]);if(o.length!=2){throw"malformed format: SEQUENCE(0.0.1.1).items != 2: "+o.length}if(ASN1HEX.getHexOfV_AtObj(u,o[0])!="2a864886f70d0307"){throw"this only supports TripleDES"}q.encryptionSchemeAlg="TripleDES";q.encryptionSchemeIV=ASN1HEX.getHexOfV_AtObj(u,o[1]);var r=ASN1HEX.getPosArrayOfChildren_AtObj(u,n[0]);if(r.length!=2){throw"malformed format: SEQUENCE(0.0.1.0).items != 2: "+r.length}if(ASN1HEX.getHexOfV_AtObj(u,r[0])!="2a864886f70d01050c"){throw"this only supports pkcs5PBKDF2"}var v=ASN1HEX.getPosArrayOfChildren_AtObj(u,r[1]);if(v.length<2){throw"malformed format: SEQUENCE(0.0.1.0.1).items < 2: "+v.length}q.pbkdf2Salt=ASN1HEX.getHexOfV_AtObj(u,v[0]);var s=ASN1HEX.getHexOfV_AtObj(u,v[1]);try{q.pbkdf2Iter=parseInt(s,16)}catch(t){throw"malformed format pbkdf2Iter: "+s}return q},getPBKDF2KeyHexFromParam:function(s,n){var r=CryptoJS.enc.Hex.parse(s.pbkdf2Salt);var o=s.pbkdf2Iter;var q=CryptoJS.PBKDF2(n,r,{keySize:192/32,iterations:o});var p=CryptoJS.enc.Hex.stringify(q);return p},getPlainPKCS8HexFromEncryptedPKCS8PEM:function(v,w){var p=this.getHexFromPEM(v,"ENCRYPTED PRIVATE KEY");var n=this.parseHexOfEncryptedPKCS8(p);var s=PKCS5PKEY.getPBKDF2KeyHexFromParam(n,w);var t={};t.ciphertext=CryptoJS.enc.Hex.parse(n.ciphertext);var r=CryptoJS.enc.Hex.parse(s);var q=CryptoJS.enc.Hex.parse(n.encryptionSchemeIV);var u=CryptoJS.TripleDES.decrypt(t,r,{iv:q});var o=CryptoJS.enc.Hex.stringify(u);return o},getRSAKeyFromEncryptedPKCS8PEM:function(q,p){var o=this.getPlainPKCS8HexFromEncryptedPKCS8PEM(q,p);var n=this.getRSAKeyFromPlainPKCS8Hex(o);return n},getKeyFromEncryptedPKCS8PEM:function(q,o){var n=this.getPlainPKCS8HexFromEncryptedPKCS8PEM(q,o);var p=this.getKeyFromPlainPrivatePKCS8Hex(n);return p},parsePlainPrivatePKCS8Hex:function(q){var o={};o.algparam=null;if(q.substr(0,2)!="30"){throw"malformed plain PKCS8 private key(code:001)"}var p=ASN1HEX.getPosArrayOfChildren_AtObj(q,0);if(p.length!=3){throw"malformed plain PKCS8 private key(code:002)"}if(q.substr(p[1],2)!="30"){throw"malformed PKCS8 private key(code:003)"}var n=ASN1HEX.getPosArrayOfChildren_AtObj(q,p[1]);if(n.length!=2){throw"malformed PKCS8 private key(code:004)"}if(q.substr(n[0],2)!="06"){throw"malformed PKCS8 private key(code:005)"}o.algoid=ASN1HEX.getHexOfV_AtObj(q,n[0]);if(q.substr(n[1],2)=="06"){o.algparam=ASN1HEX.getHexOfV_AtObj(q,n[1])}if(q.substr(p[2],2)!="04"){throw"malformed PKCS8 private key(code:006)"}o.keyidx=ASN1HEX.getStartPosOfV_AtObj(q,p[2]);return o},getKeyFromPlainPrivatePKCS8PEM:function(o){var n=this.getHexFromPEM(o,"PRIVATE KEY");var p=this.getKeyFromPlainPrivatePKCS8Hex(n);return p},getKeyFromPlainPrivatePKCS8Hex:function(n){var p=this.parsePlainPrivatePKCS8Hex(n);if(p.algoid=="2a864886f70d010101"){this.parsePrivateRawRSAKeyHexAtObj(n,p);var o=p.key;var q=new RSAKey();q.setPrivateEx(o.n,o.e,o.d,o.p,o.q,o.dp,o.dq,o.co);return q}else{if(p.algoid=="2a8648ce3d0201"){this.parsePrivateRawECKeyHexAtObj(n,p);if(KJUR.crypto.OID.oidhex2name[p.algparam]===undefined){throw"KJUR.crypto.OID.oidhex2name undefined: "+p.algparam}var r=KJUR.crypto.OID.oidhex2name[p.algparam];var q=new KJUR.crypto.ECDSA({curve:r,prv:p.key});return q}else{throw"unsupported private key algorithm"}}},getRSAKeyFromPublicPKCS8PEM:function(o){var p=this.getHexFromPEM(o,"PUBLIC KEY");var n=this.getRSAKeyFromPublicPKCS8Hex(p);return n},getKeyFromPublicPKCS8PEM:function(o){var p=this.getHexFromPEM(o,"PUBLIC KEY");var n=this.getKeyFromPublicPKCS8Hex(p);return n},getKeyFromPublicPKCS8Hex:function(o){var n=this.parsePublicPKCS8Hex(o);if(n.algoid=="2a864886f70d010101"){var r=this.parsePublicRawRSAKeyHex(n.key);var p=new RSAKey();p.setPublic(r.n,r.e);return p}else{if(n.algoid=="2a8648ce3d0201"){if(KJUR.crypto.OID.oidhex2name[n.algparam]===undefined){throw"KJUR.crypto.OID.oidhex2name undefined: "+n.algparam}var q=KJUR.crypto.OID.oidhex2name[n.algparam];var p=new KJUR.crypto.ECDSA({curve:q,pub:n.key});return p}else{throw"unsupported public key algorithm"}}},parsePublicRawRSAKeyHex:function(p){var n={};if(p.substr(0,2)!="30"){throw"malformed RSA key(code:001)"}var o=ASN1HEX.getPosArrayOfChildren_AtObj(p,0);if(o.length!=2){throw"malformed RSA key(code:002)"}if(p.substr(o[0],2)!="02"){throw"malformed RSA key(code:003)"}n.n=ASN1HEX.getHexOfV_AtObj(p,o[0]);if(p.substr(o[1],2)!="02"){throw"malformed RSA key(code:004)"}n.e=ASN1HEX.getHexOfV_AtObj(p,o[1]);return n},parsePrivateRawRSAKeyHexAtObj:function(o,q){var p=q.keyidx;if(o.substr(p,2)!="30"){throw"malformed RSA private key(code:001)"}var n=ASN1HEX.getPosArrayOfChildren_AtObj(o,p);if(n.length!=9){throw"malformed RSA private key(code:002)"}q.key={};q.key.n=ASN1HEX.getHexOfV_AtObj(o,n[1]);q.key.e=ASN1HEX.getHexOfV_AtObj(o,n[2]);q.key.d=ASN1HEX.getHexOfV_AtObj(o,n[3]);q.key.p=ASN1HEX.getHexOfV_AtObj(o,n[4]);q.key.q=ASN1HEX.getHexOfV_AtObj(o,n[5]);q.key.dp=ASN1HEX.getHexOfV_AtObj(o,n[6]);q.key.dq=ASN1HEX.getHexOfV_AtObj(o,n[7]);q.key.co=ASN1HEX.getHexOfV_AtObj(o,n[8])},parsePrivateRawECKeyHexAtObj:function(o,q){var p=q.keyidx;if(o.substr(p,2)!="30"){throw"malformed ECC private key(code:001)"}var n=ASN1HEX.getPosArrayOfChildren_AtObj(o,p);if(n.length!=3){throw"malformed ECC private key(code:002)"}if(o.substr(n[1],2)!="04"){throw"malformed ECC private key(code:003)"}q.key=ASN1HEX.getHexOfV_AtObj(o,n[1])},parsePublicPKCS8Hex:function(q){var o={};o.algparam=null;var p=ASN1HEX.getPosArrayOfChildren_AtObj(q,0);if(p.length!=2){throw"outer DERSequence shall have 2 elements: "+p.length}var r=p[0];if(q.substr(r,2)!="30"){throw"malformed PKCS8 public key(code:001)"}var n=ASN1HEX.getPosArrayOfChildren_AtObj(q,r);if(n.length!=2){throw"malformed PKCS8 public key(code:002)"}if(q.substr(n[0],2)!="06"){throw"malformed PKCS8 public key(code:003)"}o.algoid=ASN1HEX.getHexOfV_AtObj(q,n[0]);if(q.substr(n[1],2)=="06"){o.algparam=ASN1HEX.getHexOfV_AtObj(q,n[1])}if(q.substr(p[1],2)!="03"){throw"malformed PKCS8 public key(code:004)"}o.key=ASN1HEX.getHexOfV_AtObj(q,p[1]).substr(2);return o},getRSAKeyFromPublicPKCS8Hex:function(r){var q=ASN1HEX.getPosArrayOfChildren_AtObj(r,0);if(q.length!=2){throw"outer DERSequence shall have 2 elements: "+q.length}var p=ASN1HEX.getHexOfTLV_AtObj(r,q[0]);if(p!="300d06092a864886f70d0101010500"){throw"PKCS8 AlgorithmId is not rsaEncryption"}if(r.substr(q[1],2)!="03"){throw"PKCS8 Public Key is not BITSTRING encapslated."}var t=ASN1HEX.getStartPosOfV_AtObj(r,q[1])+2;if(r.substr(t,2)!="30"){throw"PKCS8 Public Key is not SEQUENCE."}var n=ASN1HEX.getPosArrayOfChildren_AtObj(r,t);if(n.length!=2){throw"inner DERSequence shall have 2 elements: "+n.length}if(r.substr(n[0],2)!="02"){throw"N is not ASN.1 INTEGER"}if(r.substr(n[1],2)!="02"){throw"E is not ASN.1 INTEGER"}var u=ASN1HEX.getHexOfV_AtObj(r,n[0]);var s=ASN1HEX.getHexOfV_AtObj(r,n[1]);var o=new RSAKey();o.setPublic(u,s);return o},}}();
-/*! keyutil-1.0.0.js (c) 2013 Kenji Urushima | kjur.github.com/jsrsasign/license
+/*! keyutil-1.0.1.js (c) 2013 Kenji Urushima | kjur.github.com/jsrsasign/license
*/
-var KEYUTIL=function(){var c=function(o,q,p){return i(CryptoJS.AES,o,q,p)};var d=function(o,q,p){return i(CryptoJS.TripleDES,o,q,p)};var i=function(r,w,t,p){var q=CryptoJS.enc.Hex.parse(w);var v=CryptoJS.enc.Hex.parse(t);var o=CryptoJS.enc.Hex.parse(p);var s={};s.key=v;s.iv=o;s.ciphertext=q;var u=r.decrypt(s,v,{iv:o});return CryptoJS.enc.Hex.stringify(u)};var j=function(o,q,p){return e(CryptoJS.AES,o,q,p)};var m=function(o,q,p){return e(CryptoJS.TripleDES,o,q,p)};var e=function(s,x,u,p){var r=CryptoJS.enc.Hex.parse(x);var w=CryptoJS.enc.Hex.parse(u);var o=CryptoJS.enc.Hex.parse(p);var v=s.encrypt(r,w,{iv:o});var q=CryptoJS.enc.Hex.parse(v.toString());var t=CryptoJS.enc.Base64.stringify(q);return t};var g={"AES-256-CBC":{proc:c,eproc:j,keylen:32,ivlen:16},"AES-192-CBC":{proc:c,eproc:j,keylen:24,ivlen:16},"AES-128-CBC":{proc:c,eproc:j,keylen:16,ivlen:16},"DES-EDE3-CBC":{proc:d,eproc:m,keylen:24,ivlen:8}};var b=function(o){return g[o]["proc"]};var k=function(o){var q=CryptoJS.lib.WordArray.random(o);var p=CryptoJS.enc.Hex.stringify(q);return p};var l=function(r){var t={};if(r.match(new RegExp("DEK-Info: ([^,]+),([0-9A-Fa-f]+)","m"))){t.cipher=RegExp.$1;t.ivsalt=RegExp.$2}if(r.match(new RegExp("-----BEGIN ([A-Z]+) PRIVATE KEY-----"))){t.type=RegExp.$1}var q=-1;var u=0;if(r.indexOf("\r\n\r\n")!=-1){q=r.indexOf("\r\n\r\n");u=2}if(r.indexOf("\n\n")!=-1){q=r.indexOf("\n\n");u=1}var p=r.indexOf("-----END");if(q!=-1&&p!=-1){var o=r.substring(q+u*2,p-u);o=o.replace(/\s+/g,"");t.data=o}return t};var h=function(p,x,o){var u=o.substring(0,16);var s=CryptoJS.enc.Hex.parse(u);var q=CryptoJS.enc.Utf8.parse(x);var t=g[p]["keylen"]+g[p]["ivlen"];var w="";var v=null;for(;;){var r=CryptoJS.algo.MD5.create();if(v!=null){r.update(v)}r.update(q);r.update(s);v=r.finalize();w=w+CryptoJS.enc.Hex.stringify(v);if(w.length>=t*2){break}}var y={};y.keyhex=w.substr(0,g[p]["keylen"]*2);y.ivhex=w.substr(g[p]["keylen"]*2,g[p]["ivlen"]*2);return y};var a=function(o,u,q,v){var r=CryptoJS.enc.Base64.parse(o);var p=CryptoJS.enc.Hex.stringify(r);var t=g[u]["proc"];var s=t(p,q,v);return s};var f=function(o,r,p,t){var q=g[r]["eproc"];var s=q(o,p,t);return s};return{version:"1.0.0",getHexFromPEM:function(p,t){var q=p;if(q.indexOf("BEGIN "+t)==-1){throw"can't find PEM header: "+t}q=q.replace("-----BEGIN "+t+"-----","");q=q.replace("-----END "+t+"-----","");var r=q.replace(/\s+/g,"");var o=b64tohex(r);return o},getDecryptedKeyHexByKeyIV:function(p,s,r,q){var o=b(s);return o(p,r,q)},parsePKCS5PEM:function(o){return l(o)},getKeyAndUnusedIvByPasscodeAndIvsalt:function(p,o,q){return h(p,o,q)},decryptKeyB64:function(o,q,p,r){return a(o,q,p,r)},getDecryptedKeyHex:function(x,w){var p=l(x);var s=p.type;var q=p.cipher;var o=p.ivsalt;var r=p.data;var v=h(q,w,o);var u=v.keyhex;var t=a(r,q,u,o);return t},getRSAKeyFromEncryptedPKCS5PEM:function(q,p){var r=this.getDecryptedKeyHex(q,p);var o=new RSAKey();o.readPrivateKeyFromASN1HexString(r);return o},getEncryptedPKCS5PEMFromPrvKeyHex:function(r,y,s,q){var o="";if(typeof s=="undefined"||s==null){s="AES-256-CBC"}if(typeof g[s]=="undefined"){throw"KEYUTIL unsupported algorithm: "+s}if(typeof q=="undefined"||q==null){var u=g[s]["ivlen"];var t=k(u);q=t.toUpperCase()}var x=h(s,y,q);var w=x.keyhex;var v=f(r,s,w,q);var p=v.replace(/(.{64})/g,"$1\r\n");var o="-----BEGIN RSA PRIVATE KEY-----\r\n";o+="Proc-Type: 4,ENCRYPTED\r\n";o+="DEK-Info: "+s+","+q+"\r\n";o+="\r\n";o+=p;o+="\r\n-----END RSA PRIVATE KEY-----\r\n";return o},getEncryptedPKCS5PEMFromRSAKey:function(C,D,o,s){var A=new KJUR.asn1.DERInteger({"int":0});var v=new KJUR.asn1.DERInteger({bigint:C.n});var z=new KJUR.asn1.DERInteger({"int":C.e});var B=new KJUR.asn1.DERInteger({bigint:C.d});var t=new KJUR.asn1.DERInteger({bigint:C.p});var r=new KJUR.asn1.DERInteger({bigint:C.q});var y=new KJUR.asn1.DERInteger({bigint:C.dmp1});var u=new KJUR.asn1.DERInteger({bigint:C.dmq1});var x=new KJUR.asn1.DERInteger({bigint:C.coeff});var E=new KJUR.asn1.DERSequence({array:[A,v,z,B,t,r,y,u,x]});var w=E.getEncodedHex();return this.getEncryptedPKCS5PEMFromPrvKeyHex(w,D,o,s)},newEncryptedPKCS5PEM:function(o,p,s,t){if(typeof p=="undefined"||p==null){p=1024}if(typeof s=="undefined"||s==null){s="10001"}var q=new RSAKey();q.generate(p,s);var r=null;if(typeof t=="undefined"||t==null){r=this.getEncryptedPKCS5PEMFromRSAKey(pkey,o)}else{r=this.getEncryptedPKCS5PEMFromRSAKey(pkey,o,t)}return r},getRSAKeyFromPlainPKCS8PEM:function(q){if(q.match(/ENCRYPTED/)){throw"pem shall be not ENCRYPTED"}var p=this.getHexFromPEM(q,"PRIVATE KEY");var o=this.getRSAKeyFromPlainPKCS8Hex(p);return o},getRSAKeyFromPlainPKCS8Hex:function(r){var q=ASN1HEX.getPosArrayOfChildren_AtObj(r,0);if(q.length!=3){throw"outer DERSequence shall have 3 elements: "+q.length}var p=ASN1HEX.getHexOfTLV_AtObj(r,q[1]);if(p!="300d06092a864886f70d0101010500"){throw"PKCS8 AlgorithmIdentifier is not rsaEnc: "+p}var p=ASN1HEX.getHexOfTLV_AtObj(r,q[1]);var s=ASN1HEX.getHexOfTLV_AtObj(r,q[2]);var t=ASN1HEX.getHexOfV_AtObj(s,0);var o=new RSAKey();o.readPrivateKeyFromASN1HexString(t);return o},parseHexOfEncryptedPKCS8:function(v){var r={};var q=ASN1HEX.getPosArrayOfChildren_AtObj(v,0);if(q.length!=2){throw"malformed format: SEQUENCE(0).items != 2: "+q.length}r.ciphertext=ASN1HEX.getHexOfV_AtObj(v,q[1]);var x=ASN1HEX.getPosArrayOfChildren_AtObj(v,q[0]);if(x.length!=2){throw"malformed format: SEQUENCE(0.0).items != 2: "+x.length}if(ASN1HEX.getHexOfV_AtObj(v,x[0])!="2a864886f70d01050d"){throw"this only supports pkcs5PBES2"}var o=ASN1HEX.getPosArrayOfChildren_AtObj(v,x[1]);if(x.length!=2){throw"malformed format: SEQUENCE(0.0.1).items != 2: "+o.length}var p=ASN1HEX.getPosArrayOfChildren_AtObj(v,o[1]);if(p.length!=2){throw"malformed format: SEQUENCE(0.0.1.1).items != 2: "+p.length}if(ASN1HEX.getHexOfV_AtObj(v,p[0])!="2a864886f70d0307"){throw"this only supports TripleDES"}r.encryptionSchemeAlg="TripleDES";r.encryptionSchemeIV=ASN1HEX.getHexOfV_AtObj(v,p[1]);var s=ASN1HEX.getPosArrayOfChildren_AtObj(v,o[0]);if(s.length!=2){throw"malformed format: SEQUENCE(0.0.1.0).items != 2: "+s.length}if(ASN1HEX.getHexOfV_AtObj(v,s[0])!="2a864886f70d01050c"){throw"this only supports pkcs5PBKDF2"}var w=ASN1HEX.getPosArrayOfChildren_AtObj(v,s[1]);if(w.length<2){throw"malformed format: SEQUENCE(0.0.1.0.1).items < 2: "+w.length}r.pbkdf2Salt=ASN1HEX.getHexOfV_AtObj(v,w[0]);var t=ASN1HEX.getHexOfV_AtObj(v,w[1]);try{r.pbkdf2Iter=parseInt(t,16)}catch(u){throw"malformed format pbkdf2Iter: "+t}return r},getPBKDF2KeyHexFromParam:function(t,o){var s=CryptoJS.enc.Hex.parse(t.pbkdf2Salt);var p=t.pbkdf2Iter;var r=CryptoJS.PBKDF2(o,s,{keySize:192/32,iterations:p});var q=CryptoJS.enc.Hex.stringify(r);return q},getPlainPKCS8HexFromEncryptedPKCS8PEM:function(w,x){var q=this.getHexFromPEM(w,"ENCRYPTED PRIVATE KEY");var o=this.parseHexOfEncryptedPKCS8(q);var t=KEYUTIL.getPBKDF2KeyHexFromParam(o,x);var u={};u.ciphertext=CryptoJS.enc.Hex.parse(o.ciphertext);var s=CryptoJS.enc.Hex.parse(t);var r=CryptoJS.enc.Hex.parse(o.encryptionSchemeIV);var v=CryptoJS.TripleDES.decrypt(u,s,{iv:r});var p=CryptoJS.enc.Hex.stringify(v);return p},getRSAKeyFromEncryptedPKCS8PEM:function(r,q){var p=this.getPlainPKCS8HexFromEncryptedPKCS8PEM(r,q);var o=this.getRSAKeyFromPlainPKCS8Hex(p);return o},getKeyFromEncryptedPKCS8PEM:function(r,p){var o=this.getPlainPKCS8HexFromEncryptedPKCS8PEM(r,p);var q=this.getKeyFromPlainPrivatePKCS8Hex(o);return q},parsePlainPrivatePKCS8Hex:function(r){var p={};p.algparam=null;if(r.substr(0,2)!="30"){throw"malformed plain PKCS8 private key(code:001)"}var q=ASN1HEX.getPosArrayOfChildren_AtObj(r,0);if(q.length!=3){throw"malformed plain PKCS8 private key(code:002)"}if(r.substr(q[1],2)!="30"){throw"malformed PKCS8 private key(code:003)"}var o=ASN1HEX.getPosArrayOfChildren_AtObj(r,q[1]);if(o.length!=2){throw"malformed PKCS8 private key(code:004)"}if(r.substr(o[0],2)!="06"){throw"malformed PKCS8 private key(code:005)"}p.algoid=ASN1HEX.getHexOfV_AtObj(r,o[0]);if(r.substr(o[1],2)=="06"){p.algparam=ASN1HEX.getHexOfV_AtObj(r,o[1])}if(r.substr(q[2],2)!="04"){throw"malformed PKCS8 private key(code:006)"}p.keyidx=ASN1HEX.getStartPosOfV_AtObj(r,q[2]);return p},getKeyFromPlainPrivatePKCS8PEM:function(p){var o=this.getHexFromPEM(p,"PRIVATE KEY");var q=this.getKeyFromPlainPrivatePKCS8Hex(o);return q},getKeyFromPlainPrivatePKCS8Hex:function(o){var q=this.parsePlainPrivatePKCS8Hex(o);if(q.algoid=="2a864886f70d010101"){this.parsePrivateRawRSAKeyHexAtObj(o,q);var p=q.key;var r=new RSAKey();r.setPrivateEx(p.n,p.e,p.d,p.p,p.q,p.dp,p.dq,p.co);return r}else{if(q.algoid=="2a8648ce3d0201"){this.parsePrivateRawECKeyHexAtObj(o,q);if(KJUR.crypto.OID.oidhex2name[q.algparam]===undefined){throw"KJUR.crypto.OID.oidhex2name undefined: "+q.algparam}var s=KJUR.crypto.OID.oidhex2name[q.algparam];var r=new KJUR.crypto.ECDSA({curve:s,prv:q.key});return r}else{throw"unsupported private key algorithm"}}},getRSAKeyFromPublicPKCS8PEM:function(p){var q=this.getHexFromPEM(p,"PUBLIC KEY");var o=this.getRSAKeyFromPublicPKCS8Hex(q);return o},getKeyFromPublicPKCS8PEM:function(p){var q=this.getHexFromPEM(p,"PUBLIC KEY");var o=this.getKeyFromPublicPKCS8Hex(q);return o},getKeyFromPublicPKCS8Hex:function(p){var o=this.parsePublicPKCS8Hex(p);if(o.algoid=="2a864886f70d010101"){var s=this.parsePublicRawRSAKeyHex(o.key);var q=new RSAKey();q.setPublic(s.n,s.e);return q}else{if(o.algoid=="2a8648ce3d0201"){if(KJUR.crypto.OID.oidhex2name[o.algparam]===undefined){throw"KJUR.crypto.OID.oidhex2name undefined: "+o.algparam}var r=KJUR.crypto.OID.oidhex2name[o.algparam];var q=new KJUR.crypto.ECDSA({curve:r,pub:o.key});return q}else{throw"unsupported public key algorithm"}}},parsePublicRawRSAKeyHex:function(q){var o={};if(q.substr(0,2)!="30"){throw"malformed RSA key(code:001)"}var p=ASN1HEX.getPosArrayOfChildren_AtObj(q,0);if(p.length!=2){throw"malformed RSA key(code:002)"}if(q.substr(p[0],2)!="02"){throw"malformed RSA key(code:003)"}o.n=ASN1HEX.getHexOfV_AtObj(q,p[0]);if(q.substr(p[1],2)!="02"){throw"malformed RSA key(code:004)"}o.e=ASN1HEX.getHexOfV_AtObj(q,p[1]);return o},parsePrivateRawRSAKeyHexAtObj:function(p,r){var q=r.keyidx;if(p.substr(q,2)!="30"){throw"malformed RSA private key(code:001)"}var o=ASN1HEX.getPosArrayOfChildren_AtObj(p,q);if(o.length!=9){throw"malformed RSA private key(code:002)"}r.key={};r.key.n=ASN1HEX.getHexOfV_AtObj(p,o[1]);r.key.e=ASN1HEX.getHexOfV_AtObj(p,o[2]);r.key.d=ASN1HEX.getHexOfV_AtObj(p,o[3]);r.key.p=ASN1HEX.getHexOfV_AtObj(p,o[4]);r.key.q=ASN1HEX.getHexOfV_AtObj(p,o[5]);r.key.dp=ASN1HEX.getHexOfV_AtObj(p,o[6]);r.key.dq=ASN1HEX.getHexOfV_AtObj(p,o[7]);r.key.co=ASN1HEX.getHexOfV_AtObj(p,o[8])},parsePrivateRawECKeyHexAtObj:function(p,r){var q=r.keyidx;if(p.substr(q,2)!="30"){throw"malformed ECC private key(code:001)"}var o=ASN1HEX.getPosArrayOfChildren_AtObj(p,q);if(o.length!=3){throw"malformed ECC private key(code:002)"}if(p.substr(o[1],2)!="04"){throw"malformed ECC private key(code:003)"}r.key=ASN1HEX.getHexOfV_AtObj(p,o[1])},parsePublicPKCS8Hex:function(r){var p={};p.algparam=null;var q=ASN1HEX.getPosArrayOfChildren_AtObj(r,0);if(q.length!=2){throw"outer DERSequence shall have 2 elements: "+q.length}var s=q[0];if(r.substr(s,2)!="30"){throw"malformed PKCS8 public key(code:001)"}var o=ASN1HEX.getPosArrayOfChildren_AtObj(r,s);if(o.length!=2){throw"malformed PKCS8 public key(code:002)"}if(r.substr(o[0],2)!="06"){throw"malformed PKCS8 public key(code:003)"}p.algoid=ASN1HEX.getHexOfV_AtObj(r,o[0]);if(r.substr(o[1],2)=="06"){p.algparam=ASN1HEX.getHexOfV_AtObj(r,o[1])}if(r.substr(q[1],2)!="03"){throw"malformed PKCS8 public key(code:004)"}p.key=ASN1HEX.getHexOfV_AtObj(r,q[1]).substr(2);return p},getRSAKeyFromPublicPKCS8Hex:function(s){var r=ASN1HEX.getPosArrayOfChildren_AtObj(s,0);if(r.length!=2){throw"outer DERSequence shall have 2 elements: "+r.length}var q=ASN1HEX.getHexOfTLV_AtObj(s,r[0]);if(q!="300d06092a864886f70d0101010500"){throw"PKCS8 AlgorithmId is not rsaEncryption"}if(s.substr(r[1],2)!="03"){throw"PKCS8 Public Key is not BITSTRING encapslated."}var u=ASN1HEX.getStartPosOfV_AtObj(s,r[1])+2;if(s.substr(u,2)!="30"){throw"PKCS8 Public Key is not SEQUENCE."}var o=ASN1HEX.getPosArrayOfChildren_AtObj(s,u);if(o.length!=2){throw"inner DERSequence shall have 2 elements: "+o.length}if(s.substr(o[0],2)!="02"){throw"N is not ASN.1 INTEGER"}if(s.substr(o[1],2)!="02"){throw"E is not ASN.1 INTEGER"}var v=ASN1HEX.getHexOfV_AtObj(s,o[0]);var t=ASN1HEX.getHexOfV_AtObj(s,o[1]);var p=new RSAKey();p.setPublic(v,t);return p},}}();KEYUTIL.getKey=function(d,a,c){if(d instanceof RSAKey){return d}if(d instanceof KJUR.crypto.ECDSA){return d}if(d.xy!==undefined&&d.curve!==undefined){return new KJUR.crypto.ECDSA({prv:d.xy,curve:d.curve})}if(d,n!==undefined&&d.e!==undefined&&d.d!==undefined&&d.p!==undefined&&d.q!==undefined&&d.dp!==undefined&&d.dq!==undefined&&d.co!==undefined){var b=new RSAKey();b.setPrivateEx(d.n,d.e,d.d,d.p,d.q,d.dp,d.dq,d.co);return b}if(d.d!==undefined&&d.curve!==undefined){return new KJUR.crypto.ECDSA({pub:d.d,curve:d.curve})}if(d,n!==undefined&&d.e){var b=new RSAKey();b.setPublic(d.n,d.e);return b}if(d.indexOf("-END CERTIFICATE-",0)!=-1||d.indexOf("-END X509 CERTIFICATE-",0)!=-1||d.indexOf("-END TRUSTED CERTIFICATE-",0)!=-1){return X509.getPublicKeyFromCertPEM(d)}if(c==="pkcs8pub"){return KEYUTIL.getKeyFromPublicPKCS8Hex(d)}if(d.indexOf("-END PUBLIC KEY-")!=-1){return KEYUTIL.getKeyFromPublicPKCS8PEM(d)}if(c==="pkcs5prv"){var b=new RSAKey();b.readPrivateKeyFromASN1HexString(d);return b}if(c==="pkcs5prv"){var b=new RSAKey();b.readPrivateKeyFromASN1HexString(d);return b}if(d.indexOf("-END RSA PRIVATE KEY-")!=-1&&d.indexOf("4,ENCRYPTED")==-1){var b=new RSAKey();b.readPrivateKeyFromPEMString(d);return b}if(d.indexOf("-END PRIVATE KEY-")!=-1){return KEYUTIL.getKeyFromPlainPrivatePKCS8PEM(d)}if(d.indexOf("-END RSA PRIVATE KEY-")!=-1&&d.indexOf("4,ENCRYPTED")!=-1){return KEYUTIL.getRSAKeyFromEncryptedPKCS5PEM(d,a)}if(d.indexOf("-END ENCRYPTED PRIVATE KEY-")!=-1){return KEYUTIL.getKeyFromEncryptedPKCS8PEM(d,a)}throw"not supported argument"};
+var KEYUTIL=function(){var c=function(n,p,o){return i(CryptoJS.AES,n,p,o)};var d=function(n,p,o){return i(CryptoJS.TripleDES,n,p,o)};var i=function(q,v,s,o){var p=CryptoJS.enc.Hex.parse(v);var u=CryptoJS.enc.Hex.parse(s);var n=CryptoJS.enc.Hex.parse(o);var r={};r.key=u;r.iv=n;r.ciphertext=p;var t=q.decrypt(r,u,{iv:n});return CryptoJS.enc.Hex.stringify(t)};var j=function(n,p,o){return e(CryptoJS.AES,n,p,o)};var m=function(n,p,o){return e(CryptoJS.TripleDES,n,p,o)};var e=function(r,w,t,o){var q=CryptoJS.enc.Hex.parse(w);var v=CryptoJS.enc.Hex.parse(t);var n=CryptoJS.enc.Hex.parse(o);var u=r.encrypt(q,v,{iv:n});var p=CryptoJS.enc.Hex.parse(u.toString());var s=CryptoJS.enc.Base64.stringify(p);return s};var g={"AES-256-CBC":{proc:c,eproc:j,keylen:32,ivlen:16},"AES-192-CBC":{proc:c,eproc:j,keylen:24,ivlen:16},"AES-128-CBC":{proc:c,eproc:j,keylen:16,ivlen:16},"DES-EDE3-CBC":{proc:d,eproc:m,keylen:24,ivlen:8}};var b=function(n){return g[n]["proc"]};var k=function(n){var p=CryptoJS.lib.WordArray.random(n);var o=CryptoJS.enc.Hex.stringify(p);return o};var l=function(q){var r={};if(q.match(new RegExp("DEK-Info: ([^,]+),([0-9A-Fa-f]+)","m"))){r.cipher=RegExp.$1;r.ivsalt=RegExp.$2}if(q.match(new RegExp("-----BEGIN ([A-Z]+) PRIVATE KEY-----"))){r.type=RegExp.$1}var p=-1;var t=0;if(q.indexOf("\r\n\r\n")!=-1){p=q.indexOf("\r\n\r\n");t=2}if(q.indexOf("\n\n")!=-1){p=q.indexOf("\n\n");t=1}var o=q.indexOf("-----END");if(p!=-1&&o!=-1){var n=q.substring(p+t*2,o-t);n=n.replace(/\s+/g,"");r.data=n}return r};var h=function(o,w,n){var t=n.substring(0,16);var r=CryptoJS.enc.Hex.parse(t);var p=CryptoJS.enc.Utf8.parse(w);var s=g[o]["keylen"]+g[o]["ivlen"];var v="";var u=null;for(;;){var q=CryptoJS.algo.MD5.create();if(u!=null){q.update(u)}q.update(p);q.update(r);u=q.finalize();v=v+CryptoJS.enc.Hex.stringify(u);if(v.length>=s*2){break}}var x={};x.keyhex=v.substr(0,g[o]["keylen"]*2);x.ivhex=v.substr(g[o]["keylen"]*2,g[o]["ivlen"]*2);return x};var a=function(n,t,p,u){var q=CryptoJS.enc.Base64.parse(n);var o=CryptoJS.enc.Hex.stringify(q);var s=g[t]["proc"];var r=s(o,p,u);return r};var f=function(n,q,o,s){var p=g[q]["eproc"];var r=p(n,o,s);return r};return{version:"1.0.0",getHexFromPEM:function(o,r){var p=o;if(p.indexOf("BEGIN "+r)==-1){throw"can't find PEM header: "+r}p=p.replace("-----BEGIN "+r+"-----","");p=p.replace("-----END "+r+"-----","");var q=p.replace(/\s+/g,"");var n=b64tohex(q);return n},getDecryptedKeyHexByKeyIV:function(o,r,q,p){var n=b(r);return n(o,q,p)},parsePKCS5PEM:function(n){return l(n)},getKeyAndUnusedIvByPasscodeAndIvsalt:function(o,n,p){return h(o,n,p)},decryptKeyB64:function(n,p,o,q){return a(n,p,o,q)},getDecryptedKeyHex:function(w,v){var o=l(w);var r=o.type;var p=o.cipher;var n=o.ivsalt;var q=o.data;var u=h(p,v,n);var t=u.keyhex;var s=a(q,p,t,n);return s},getRSAKeyFromEncryptedPKCS5PEM:function(p,o){var q=this.getDecryptedKeyHex(p,o);var n=new RSAKey();n.readPrivateKeyFromASN1HexString(q);return n},getEncryptedPKCS5PEMFromPrvKeyHex:function(q,x,r,p){var n="";if(typeof r=="undefined"||r==null){r="AES-256-CBC"}if(typeof g[r]=="undefined"){throw"KEYUTIL unsupported algorithm: "+r}if(typeof p=="undefined"||p==null){var t=g[r]["ivlen"];var s=k(t);p=s.toUpperCase()}var w=h(r,x,p);var v=w.keyhex;var u=f(q,r,v,p);var o=u.replace(/(.{64})/g,"$1\r\n");var n="-----BEGIN RSA PRIVATE KEY-----\r\n";n+="Proc-Type: 4,ENCRYPTED\r\n";n+="DEK-Info: "+r+","+p+"\r\n";n+="\r\n";n+=o;n+="\r\n-----END RSA PRIVATE KEY-----\r\n";return n},getEncryptedPKCS5PEMFromRSAKey:function(C,D,o,s){var A=new KJUR.asn1.DERInteger({"int":0});var v=new KJUR.asn1.DERInteger({bigint:C.n});var z=new KJUR.asn1.DERInteger({"int":C.e});var B=new KJUR.asn1.DERInteger({bigint:C.d});var t=new KJUR.asn1.DERInteger({bigint:C.p});var r=new KJUR.asn1.DERInteger({bigint:C.q});var y=new KJUR.asn1.DERInteger({bigint:C.dmp1});var u=new KJUR.asn1.DERInteger({bigint:C.dmq1});var x=new KJUR.asn1.DERInteger({bigint:C.coeff});var E=new KJUR.asn1.DERSequence({array:[A,v,z,B,t,r,y,u,x]});var w=E.getEncodedHex();return this.getEncryptedPKCS5PEMFromPrvKeyHex(w,D,o,s)},newEncryptedPKCS5PEM:function(n,o,r,s){if(typeof o=="undefined"||o==null){o=1024}if(typeof r=="undefined"||r==null){r="10001"}var p=new RSAKey();p.generate(o,r);var q=null;if(typeof s=="undefined"||s==null){q=this.getEncryptedPKCS5PEMFromRSAKey(pkey,n)}else{q=this.getEncryptedPKCS5PEMFromRSAKey(pkey,n,s)}return q},getRSAKeyFromPlainPKCS8PEM:function(p){if(p.match(/ENCRYPTED/)){throw"pem shall be not ENCRYPTED"}var o=this.getHexFromPEM(p,"PRIVATE KEY");var n=this.getRSAKeyFromPlainPKCS8Hex(o);return n},getRSAKeyFromPlainPKCS8Hex:function(q){var p=ASN1HEX.getPosArrayOfChildren_AtObj(q,0);if(p.length!=3){throw"outer DERSequence shall have 3 elements: "+p.length}var o=ASN1HEX.getHexOfTLV_AtObj(q,p[1]);if(o!="300d06092a864886f70d0101010500"){throw"PKCS8 AlgorithmIdentifier is not rsaEnc: "+o}var o=ASN1HEX.getHexOfTLV_AtObj(q,p[1]);var r=ASN1HEX.getHexOfTLV_AtObj(q,p[2]);var s=ASN1HEX.getHexOfV_AtObj(r,0);var n=new RSAKey();n.readPrivateKeyFromASN1HexString(s);return n},parseHexOfEncryptedPKCS8:function(u){var q={};var p=ASN1HEX.getPosArrayOfChildren_AtObj(u,0);if(p.length!=2){throw"malformed format: SEQUENCE(0).items != 2: "+p.length}q.ciphertext=ASN1HEX.getHexOfV_AtObj(u,p[1]);var w=ASN1HEX.getPosArrayOfChildren_AtObj(u,p[0]);if(w.length!=2){throw"malformed format: SEQUENCE(0.0).items != 2: "+w.length}if(ASN1HEX.getHexOfV_AtObj(u,w[0])!="2a864886f70d01050d"){throw"this only supports pkcs5PBES2"}var n=ASN1HEX.getPosArrayOfChildren_AtObj(u,w[1]);if(w.length!=2){throw"malformed format: SEQUENCE(0.0.1).items != 2: "+n.length}var o=ASN1HEX.getPosArrayOfChildren_AtObj(u,n[1]);if(o.length!=2){throw"malformed format: SEQUENCE(0.0.1.1).items != 2: "+o.length}if(ASN1HEX.getHexOfV_AtObj(u,o[0])!="2a864886f70d0307"){throw"this only supports TripleDES"}q.encryptionSchemeAlg="TripleDES";q.encryptionSchemeIV=ASN1HEX.getHexOfV_AtObj(u,o[1]);var r=ASN1HEX.getPosArrayOfChildren_AtObj(u,n[0]);if(r.length!=2){throw"malformed format: SEQUENCE(0.0.1.0).items != 2: "+r.length}if(ASN1HEX.getHexOfV_AtObj(u,r[0])!="2a864886f70d01050c"){throw"this only supports pkcs5PBKDF2"}var v=ASN1HEX.getPosArrayOfChildren_AtObj(u,r[1]);if(v.length<2){throw"malformed format: SEQUENCE(0.0.1.0.1).items < 2: "+v.length}q.pbkdf2Salt=ASN1HEX.getHexOfV_AtObj(u,v[0]);var s=ASN1HEX.getHexOfV_AtObj(u,v[1]);try{q.pbkdf2Iter=parseInt(s,16)}catch(t){throw"malformed format pbkdf2Iter: "+s}return q},getPBKDF2KeyHexFromParam:function(s,n){var r=CryptoJS.enc.Hex.parse(s.pbkdf2Salt);var o=s.pbkdf2Iter;var q=CryptoJS.PBKDF2(n,r,{keySize:192/32,iterations:o});var p=CryptoJS.enc.Hex.stringify(q);return p},getPlainPKCS8HexFromEncryptedPKCS8PEM:function(v,w){var p=this.getHexFromPEM(v,"ENCRYPTED PRIVATE KEY");var n=this.parseHexOfEncryptedPKCS8(p);var s=KEYUTIL.getPBKDF2KeyHexFromParam(n,w);var t={};t.ciphertext=CryptoJS.enc.Hex.parse(n.ciphertext);var r=CryptoJS.enc.Hex.parse(s);var q=CryptoJS.enc.Hex.parse(n.encryptionSchemeIV);var u=CryptoJS.TripleDES.decrypt(t,r,{iv:q});var o=CryptoJS.enc.Hex.stringify(u);return o},getRSAKeyFromEncryptedPKCS8PEM:function(q,p){var o=this.getPlainPKCS8HexFromEncryptedPKCS8PEM(q,p);var n=this.getRSAKeyFromPlainPKCS8Hex(o);return n},getKeyFromEncryptedPKCS8PEM:function(q,o){var n=this.getPlainPKCS8HexFromEncryptedPKCS8PEM(q,o);var p=this.getKeyFromPlainPrivatePKCS8Hex(n);return p},parsePlainPrivatePKCS8Hex:function(q){var o={};o.algparam=null;if(q.substr(0,2)!="30"){throw"malformed plain PKCS8 private key(code:001)"}var p=ASN1HEX.getPosArrayOfChildren_AtObj(q,0);if(p.length!=3){throw"malformed plain PKCS8 private key(code:002)"}if(q.substr(p[1],2)!="30"){throw"malformed PKCS8 private key(code:003)"}var n=ASN1HEX.getPosArrayOfChildren_AtObj(q,p[1]);if(n.length!=2){throw"malformed PKCS8 private key(code:004)"}if(q.substr(n[0],2)!="06"){throw"malformed PKCS8 private key(code:005)"}o.algoid=ASN1HEX.getHexOfV_AtObj(q,n[0]);if(q.substr(n[1],2)=="06"){o.algparam=ASN1HEX.getHexOfV_AtObj(q,n[1])}if(q.substr(p[2],2)!="04"){throw"malformed PKCS8 private key(code:006)"}o.keyidx=ASN1HEX.getStartPosOfV_AtObj(q,p[2]);return o},getKeyFromPlainPrivatePKCS8PEM:function(o){var n=this.getHexFromPEM(o,"PRIVATE KEY");var p=this.getKeyFromPlainPrivatePKCS8Hex(n);return p},getKeyFromPlainPrivatePKCS8Hex:function(n){var p=this.parsePlainPrivatePKCS8Hex(n);if(p.algoid=="2a864886f70d010101"){this.parsePrivateRawRSAKeyHexAtObj(n,p);var o=p.key;var q=new RSAKey();q.setPrivateEx(o.n,o.e,o.d,o.p,o.q,o.dp,o.dq,o.co);return q}else{if(p.algoid=="2a8648ce3d0201"){this.parsePrivateRawECKeyHexAtObj(n,p);if(KJUR.crypto.OID.oidhex2name[p.algparam]===undefined){throw"KJUR.crypto.OID.oidhex2name undefined: "+p.algparam}var r=KJUR.crypto.OID.oidhex2name[p.algparam];var q=new KJUR.crypto.ECDSA({curve:r,prv:p.key});return q}else{throw"unsupported private key algorithm"}}},getRSAKeyFromPublicPKCS8PEM:function(o){var p=this.getHexFromPEM(o,"PUBLIC KEY");var n=this.getRSAKeyFromPublicPKCS8Hex(p);return n},getKeyFromPublicPKCS8PEM:function(o){var p=this.getHexFromPEM(o,"PUBLIC KEY");var n=this.getKeyFromPublicPKCS8Hex(p);return n},getKeyFromPublicPKCS8Hex:function(o){var n=this.parsePublicPKCS8Hex(o);if(n.algoid=="2a864886f70d010101"){var r=this.parsePublicRawRSAKeyHex(n.key);var p=new RSAKey();p.setPublic(r.n,r.e);return p}else{if(n.algoid=="2a8648ce3d0201"){if(KJUR.crypto.OID.oidhex2name[n.algparam]===undefined){throw"KJUR.crypto.OID.oidhex2name undefined: "+n.algparam}var q=KJUR.crypto.OID.oidhex2name[n.algparam];var p=new KJUR.crypto.ECDSA({curve:q,pub:n.key});return p}else{throw"unsupported public key algorithm"}}},parsePublicRawRSAKeyHex:function(p){var n={};if(p.substr(0,2)!="30"){throw"malformed RSA key(code:001)"}var o=ASN1HEX.getPosArrayOfChildren_AtObj(p,0);if(o.length!=2){throw"malformed RSA key(code:002)"}if(p.substr(o[0],2)!="02"){throw"malformed RSA key(code:003)"}n.n=ASN1HEX.getHexOfV_AtObj(p,o[0]);if(p.substr(o[1],2)!="02"){throw"malformed RSA key(code:004)"}n.e=ASN1HEX.getHexOfV_AtObj(p,o[1]);return n},parsePrivateRawRSAKeyHexAtObj:function(o,q){var p=q.keyidx;if(o.substr(p,2)!="30"){throw"malformed RSA private key(code:001)"}var n=ASN1HEX.getPosArrayOfChildren_AtObj(o,p);if(n.length!=9){throw"malformed RSA private key(code:002)"}q.key={};q.key.n=ASN1HEX.getHexOfV_AtObj(o,n[1]);q.key.e=ASN1HEX.getHexOfV_AtObj(o,n[2]);q.key.d=ASN1HEX.getHexOfV_AtObj(o,n[3]);q.key.p=ASN1HEX.getHexOfV_AtObj(o,n[4]);q.key.q=ASN1HEX.getHexOfV_AtObj(o,n[5]);q.key.dp=ASN1HEX.getHexOfV_AtObj(o,n[6]);q.key.dq=ASN1HEX.getHexOfV_AtObj(o,n[7]);q.key.co=ASN1HEX.getHexOfV_AtObj(o,n[8])},parsePrivateRawECKeyHexAtObj:function(o,q){var p=q.keyidx;if(o.substr(p,2)!="30"){throw"malformed ECC private key(code:001)"}var n=ASN1HEX.getPosArrayOfChildren_AtObj(o,p);if(n.length!=3){throw"malformed ECC private key(code:002)"}if(o.substr(n[1],2)!="04"){throw"malformed ECC private key(code:003)"}q.key=ASN1HEX.getHexOfV_AtObj(o,n[1])},parsePublicPKCS8Hex:function(q){var o={};o.algparam=null;var p=ASN1HEX.getPosArrayOfChildren_AtObj(q,0);if(p.length!=2){throw"outer DERSequence shall have 2 elements: "+p.length}var r=p[0];if(q.substr(r,2)!="30"){throw"malformed PKCS8 public key(code:001)"}var n=ASN1HEX.getPosArrayOfChildren_AtObj(q,r);if(n.length!=2){throw"malformed PKCS8 public key(code:002)"}if(q.substr(n[0],2)!="06"){throw"malformed PKCS8 public key(code:003)"}o.algoid=ASN1HEX.getHexOfV_AtObj(q,n[0]);if(q.substr(n[1],2)=="06"){o.algparam=ASN1HEX.getHexOfV_AtObj(q,n[1])}if(q.substr(p[1],2)!="03"){throw"malformed PKCS8 public key(code:004)"}o.key=ASN1HEX.getHexOfV_AtObj(q,p[1]).substr(2);return o},getRSAKeyFromPublicPKCS8Hex:function(r){var q=ASN1HEX.getPosArrayOfChildren_AtObj(r,0);if(q.length!=2){throw"outer DERSequence shall have 2 elements: "+q.length}var p=ASN1HEX.getHexOfTLV_AtObj(r,q[0]);if(p!="300d06092a864886f70d0101010500"){throw"PKCS8 AlgorithmId is not rsaEncryption"}if(r.substr(q[1],2)!="03"){throw"PKCS8 Public Key is not BITSTRING encapslated."}var t=ASN1HEX.getStartPosOfV_AtObj(r,q[1])+2;if(r.substr(t,2)!="30"){throw"PKCS8 Public Key is not SEQUENCE."}var n=ASN1HEX.getPosArrayOfChildren_AtObj(r,t);if(n.length!=2){throw"inner DERSequence shall have 2 elements: "+n.length}if(r.substr(n[0],2)!="02"){throw"N is not ASN.1 INTEGER"}if(r.substr(n[1],2)!="02"){throw"E is not ASN.1 INTEGER"}var u=ASN1HEX.getHexOfV_AtObj(r,n[0]);var s=ASN1HEX.getHexOfV_AtObj(r,n[1]);var o=new RSAKey();o.setPublic(u,s);return o},}}();KEYUTIL.getKey=function(d,a,c){if(d instanceof RSAKey){return d}if(d instanceof KJUR.crypto.ECDSA){return d}if(d.xy!==undefined&&d.curve!==undefined){return new KJUR.crypto.ECDSA({prv:d.xy,curve:d.curve})}if(d.n!==undefined&&d.e!==undefined&&d.d!==undefined&&d.p!==undefined&&d.q!==undefined&&d.dp!==undefined&&d.dq!==undefined&&d.co!==undefined){var b=new RSAKey();b.setPrivateEx(d.n,d.e,d.d,d.p,d.q,d.dp,d.dq,d.co);return b}if(d.d!==undefined&&d.curve!==undefined){return new KJUR.crypto.ECDSA({pub:d.d,curve:d.curve})}if(d.n!==undefined&&d.e){var b=new RSAKey();b.setPublic(d.n,d.e);return b}if(d.indexOf("-END CERTIFICATE-",0)!=-1||d.indexOf("-END X509 CERTIFICATE-",0)!=-1||d.indexOf("-END TRUSTED CERTIFICATE-",0)!=-1){return X509.getPublicKeyFromCertPEM(d)}if(c==="pkcs8pub"){return KEYUTIL.getKeyFromPublicPKCS8Hex(d)}if(d.indexOf("-END PUBLIC KEY-")!=-1){return KEYUTIL.getKeyFromPublicPKCS8PEM(d)}if(c==="pkcs5prv"){var b=new RSAKey();b.readPrivateKeyFromASN1HexString(d);return b}if(c==="pkcs5prv"){var b=new RSAKey();b.readPrivateKeyFromASN1HexString(d);return b}if(d.indexOf("-END RSA PRIVATE KEY-")!=-1&&d.indexOf("4,ENCRYPTED")==-1){var b=new RSAKey();b.readPrivateKeyFromPEMString(d);return b}if(d.indexOf("-END PRIVATE KEY-")!=-1){return KEYUTIL.getKeyFromPlainPrivatePKCS8PEM(d)}if(d.indexOf("-END RSA PRIVATE KEY-")!=-1&&d.indexOf("4,ENCRYPTED")!=-1){return KEYUTIL.getRSAKeyFromEncryptedPKCS5PEM(d,a)}if(d.indexOf("-END ENCRYPTED PRIVATE KEY-")!=-1){return KEYUTIL.getKeyFromEncryptedPKCS8PEM(d,a)}throw"not supported argument"};KEYUTIL.generateKeypair=function(a,c){if(a=="RSA"){var b=c;var h=new RSAKey();h.generate(b,"10001");var f=new RSAKey();var e=h.n.toString(16);var i=h.e.toString(16);f.setPublic(e,i);var k={};k.prvKeyObj=h;k.pubKeyObj=f;return k}else{if(a=="EC"){var d=c;var g=new KJUR.crypto.ECDSA({curve:d});var j=g.generateKeyPairHex();var h=new KJUR.crypto.ECDSA({curve:d});h.setPrivateKeyHex(j.ecprvhex);var f=new KJUR.crypto.ECDSA({curve:d});f.setPublicKeyHex(j.ecpubhex);var k={};k.prvKeyObj=h;k.pubKeyObj=f;return k}else{throw"unknown algorithm: "+a}}};
/*! rsapem-1.1.js (c) 2012 Kenji Urushima | kjur.github.com/jsrsasign/license
*/
function _rsapem_pemToBase64(b){var a=b;a=a.replace("-----BEGIN RSA PRIVATE KEY-----","");a=a.replace("-----END RSA PRIVATE KEY-----","");a=a.replace(/[ \n]+/g,"");return a}function _rsapem_getPosArrayOfChildrenFromHex(d){var j=new Array();var k=ASN1HEX.getStartPosOfV_AtObj(d,0);var f=ASN1HEX.getPosOfNextSibling_AtObj(d,k);var h=ASN1HEX.getPosOfNextSibling_AtObj(d,f);var b=ASN1HEX.getPosOfNextSibling_AtObj(d,h);var l=ASN1HEX.getPosOfNextSibling_AtObj(d,b);var e=ASN1HEX.getPosOfNextSibling_AtObj(d,l);var g=ASN1HEX.getPosOfNextSibling_AtObj(d,e);var c=ASN1HEX.getPosOfNextSibling_AtObj(d,g);var i=ASN1HEX.getPosOfNextSibling_AtObj(d,c);j.push(k,f,h,b,l,e,g,c,i);return j}function _rsapem_getHexValueArrayOfChildrenFromHex(i){var o=_rsapem_getPosArrayOfChildrenFromHex(i);var r=ASN1HEX.getHexOfV_AtObj(i,o[0]);var f=ASN1HEX.getHexOfV_AtObj(i,o[1]);var j=ASN1HEX.getHexOfV_AtObj(i,o[2]);var k=ASN1HEX.getHexOfV_AtObj(i,o[3]);var c=ASN1HEX.getHexOfV_AtObj(i,o[4]);var b=ASN1HEX.getHexOfV_AtObj(i,o[5]);var h=ASN1HEX.getHexOfV_AtObj(i,o[6]);var g=ASN1HEX.getHexOfV_AtObj(i,o[7]);var l=ASN1HEX.getHexOfV_AtObj(i,o[8]);var m=new Array();m.push(r,f,j,k,c,b,h,g,l);return m}function _rsapem_readPrivateKeyFromASN1HexString(c){var b=_rsapem_getHexValueArrayOfChildrenFromHex(c);this.setPrivateEx(b[1],b[2],b[3],b[4],b[5],b[6],b[7],b[8])}function _rsapem_readPrivateKeyFromPEMString(e){var c=_rsapem_pemToBase64(e);var d=b64tohex(c);var b=_rsapem_getHexValueArrayOfChildrenFromHex(d);this.setPrivateEx(b[1],b[2],b[3],b[4],b[5],b[6],b[7],b[8])}RSAKey.prototype.readPrivateKeyFromPEMString=_rsapem_readPrivateKeyFromPEMString;RSAKey.prototype.readPrivateKeyFromASN1HexString=_rsapem_readPrivateKeyFromASN1HexString;
View
71 keyutil-1.0.js
@@ -1,4 +1,4 @@
-/*! keyutil-1.0.0.js (c) 2013 Kenji Urushima | kjur.github.com/jsrsasign/license
+/*! keyutil-1.0.1.js (c) 2013 Kenji Urushima | kjur.github.com/jsrsasign/license
*/
/*
* keyutil.js - key utility for PKCS#5/8 PEM, RSA/ECDSA key object
@@ -15,8 +15,8 @@
* @fileOverview
* @name keyutil-1.0.js
* @author Kenji Urushima kenji.urushima@gmail.com
- * @version keyutil 1.0.0 (2013-Sep-14)
- * @since jsrsasign 4.1.3
+ * @version keyutil 1.0.1 (2013-Sep-27)
+ * @since jsrsasign 4.1.4
* @license <a href="http://kjur.github.io/jsrsasign/license/">MIT License</a>
*/
@@ -1191,7 +1191,7 @@ KEYUTIL.getKey = function(param, passcode, hextype) {
return new KJUR.crypto.ECDSA({prv: param.xy, curve: param.curve});
}
// 2.2. RSA private key
- if (param,n !== undefined && param.e !== undefined && param.d !== undefined &&
+ if (param.n !== undefined && param.e !== undefined && param.d !== undefined &&
param.p !== undefined && param.q !== undefined &&
param.dp !== undefined && param.dq !== undefined && param.co !== undefined) {
var key = new RSAKey();
@@ -1204,7 +1204,7 @@ KEYUTIL.getKey = function(param, passcode, hextype) {
return new KJUR.crypto.ECDSA({pub: param.d, curve: param.curve});
}
// 2.4. RSA private key
- if (param,n !== undefined && param.e) {
+ if (param.n !== undefined && param.e) {
var key = new RSAKey();
key.setPublic(param.n, param.e);
return key;
@@ -1268,3 +1268,64 @@ KEYUTIL.getKey = function(param, passcode, hextype) {
throw "not supported argument";
};
+/**
+ * @name generateKeypair
+ * @memberOf KEYUTIL
+ * @function
+ * @static
+ * @param {String} alg 'RSA' or 'EC'
+ * @param {Object} keylenOrCurve key length for RSA or curve name for EC
+ * @return {Array} associative array of keypair which has prvKeyObj and pubKeyObj parameters
+ * @since keyutil 1.0.1
+ * @description
+ * This method generates a key pair of public key algorithm.
+ * The result will be an associative array which has following
+ * parameters:
+ * <ul>
+ * <li>prvKeyObj - RSAKey or ECDSA object of private key</li>
+ * <li>pubKeyObj - RSAKey or ECDSA object of public key</li>
+ * </ul>
+ * NOTE1: As for RSA algoirthm, public exponent has fixed
+ * value '0x10001'.
+ * NOTE2: As for EC algorithm, supported names of curve are
+ * secp256r1, secp256k1 and secp384r1.
+ * @example
+ * var rsaKeypair = KEYUTIL.generateKeypair("RSA", 1024);
+ * var ecKeypair = KEYUTIL.generateKeypair("EC", "secp256r1");
+ *
+ */
+KEYUTIL.generateKeypair = function(alg, keylenOrCurve) {
+ if (alg == "RSA") {
+ var keylen = keylenOrCurve;
+ var prvKey = new RSAKey();
+ prvKey.generate(keylen, '10001');
+
+ var pubKey = new RSAKey();
+ var hN = prvKey.n.toString(16);
+ var hE = prvKey.e.toString(16);
+ pubKey.setPublic(hN, hE);
+
+ var result = {};
+ result.prvKeyObj = prvKey;
+ result.pubKeyObj = pubKey;
+ return result;
+ } else if (alg == "EC") {
+ var curve = keylenOrCurve;
+ var ec = new KJUR.crypto.ECDSA({curve: curve});
+ var keypairHex = ec.generateKeyPairHex();
+
+ var prvKey = new KJUR.crypto.ECDSA({curve: curve});
+ prvKey.setPrivateKeyHex(keypairHex.ecprvhex);
+
+ var pubKey = new KJUR.crypto.ECDSA({curve: curve});
+ pubKey.setPublicKeyHex(keypairHex.ecpubhex);
+
+ var result = {};
+ result.prvKeyObj = prvKey;
+ result.pubKeyObj = pubKey;
+ return result;
+ } else {
+ throw "unknown algorithm: " + alg;
+ }
+};
+
View
4 keyutil-1.0.min.js
@@ -1,3 +1,3 @@
-/*! keyutil-1.0.0.js (c) 2013 Kenji Urushima | kjur.github.com/jsrsasign/license
+/*! keyutil-1.0.1.js (c) 2013 Kenji Urushima | kjur.github.com/jsrsasign/license
*/
-var KEYUTIL=function(){var c=function(o,q,p){return i(CryptoJS.AES,o,q,p)};var d=function(o,q,p){return i(CryptoJS.TripleDES,o,q,p)};var i=function(r,w,t,p){var q=CryptoJS.enc.Hex.parse(w);var v=CryptoJS.enc.Hex.parse(t);var o=CryptoJS.enc.Hex.parse(p);var s={};s.key=v;s.iv=o;s.ciphertext=q;var u=r.decrypt(s,v,{iv:o});return CryptoJS.enc.Hex.stringify(u)};var j=function(o,q,p){return e(CryptoJS.AES,o,q,p)};var m=function(o,q,p){return e(CryptoJS.TripleDES,o,q,p)};var e=function(s,x,u,p){var r=CryptoJS.enc.Hex.parse(x);var w=CryptoJS.enc.Hex.parse(u);var o=CryptoJS.enc.Hex.parse(p);var v=s.encrypt(r,w,{iv:o});var q=CryptoJS.enc.Hex.parse(v.toString());var t=CryptoJS.enc.Base64.stringify(q);return t};var g={"AES-256-CBC":{proc:c,eproc:j,keylen:32,ivlen:16},"AES-192-CBC":{proc:c,eproc:j,keylen:24,ivlen:16},"AES-128-CBC":{proc:c,eproc:j,keylen:16,ivlen:16},"DES-EDE3-CBC":{proc:d,eproc:m,keylen:24,ivlen:8}};var b=function(o){return g[o]["proc"]};var k=function(o){var q=CryptoJS.lib.WordArray.random(o);var p=CryptoJS.enc.Hex.stringify(q);return p};var l=function(r){var t={};if(r.match(new RegExp("DEK-Info: ([^,]+),([0-9A-Fa-f]+)","m"))){t.cipher=RegExp.$1;t.ivsalt=RegExp.$2}if(r.match(new RegExp("-----BEGIN ([A-Z]+) PRIVATE KEY-----"))){t.type=RegExp.$1}var q=-1;var u=0;if(r.indexOf("\r\n\r\n")!=-1){q=r.indexOf("\r\n\r\n");u=2}if(r.indexOf("\n\n")!=-1){q=r.indexOf("\n\n");u=1}var p=r.indexOf("-----END");if(q!=-1&&p!=-1){var o=r.substring(q+u*2,p-u);o=o.replace(/\s+/g,"");t.data=o}return t};var h=function(p,x,o){var u=o.substring(0,16);var s=CryptoJS.enc.Hex.parse(u);var q=CryptoJS.enc.Utf8.parse(x);var t=g[p]["keylen"]+g[p]["ivlen"];var w="";var v=null;for(;;){var r=CryptoJS.algo.MD5.create();if(v!=null){r.update(v)}r.update(q);r.update(s);v=r.finalize();w=w+CryptoJS.enc.Hex.stringify(v);if(w.length>=t*2){break}}var y={};y.keyhex=w.substr(0,g[p]["keylen"]*2);y.ivhex=w.substr(g[p]["keylen"]*2,g[p]["ivlen"]*2);return y};var a=function(o,u,q,v){var r=CryptoJS.enc.Base64.parse(o);var p=CryptoJS.enc.Hex.stringify(r);var t=g[u]["proc"];var s=t(p,q,v);return s};var f=function(o,r,p,t){var q=g[r]["eproc"];var s=q(o,p,t);return s};return{version:"1.0.0",getHexFromPEM:function(p,t){var q=p;if(q.indexOf("BEGIN "+t)==-1){throw"can't find PEM header: "+t}q=q.replace("-----BEGIN "+t+"-----","");q=q.replace("-----END "+t+"-----","");var r=q.replace(/\s+/g,"");var o=b64tohex(r);return o},getDecryptedKeyHexByKeyIV:function(p,s,r,q){var o=b(s);return o(p,r,q)},parsePKCS5PEM:function(o){return l(o)},getKeyAndUnusedIvByPasscodeAndIvsalt:function(p,o,q){return h(p,o,q)},decryptKeyB64:function(o,q,p,r){return a(o,q,p,r)},getDecryptedKeyHex:function(x,w){var p=l(x);var s=p.type;var q=p.cipher;var o=p.ivsalt;var r=p.data;var v=h(q,w,o);var u=v.keyhex;var t=a(r,q,u,o);return t},getRSAKeyFromEncryptedPKCS5PEM:function(q,p){var r=this.getDecryptedKeyHex(q,p);var o=new RSAKey();o.readPrivateKeyFromASN1HexString(r);return o},getEncryptedPKCS5PEMFromPrvKeyHex:function(r,y,s,q){var o="";if(typeof s=="undefined"||s==null){s="AES-256-CBC"}if(typeof g[s]=="undefined"){throw"KEYUTIL unsupported algorithm: "+s}if(typeof q=="undefined"||q==null){var u=g[s]["ivlen"];var t=k(u);q=t.toUpperCase()}var x=h(s,y,q);var w=x.keyhex;var v=f(r,s,w,q);var p=v.replace(/(.{64})/g,"$1\r\n");var o="-----BEGIN RSA PRIVATE KEY-----\r\n";o+="Proc-Type: 4,ENCRYPTED\r\n";o+="DEK-Info: "+s+","+q+"\r\n";o+="\r\n";o+=p;o+="\r\n-----END RSA PRIVATE KEY-----\r\n";return o},getEncryptedPKCS5PEMFromRSAKey:function(C,D,o,s){var A=new KJUR.asn1.DERInteger({"int":0});var v=new KJUR.asn1.DERInteger({bigint:C.n});var z=new KJUR.asn1.DERInteger({"int":C.e});var B=new KJUR.asn1.DERInteger({bigint:C.d});var t=new KJUR.asn1.DERInteger({bigint:C.p});var r=new KJUR.asn1.DERInteger({bigint:C.q});var y=new KJUR.asn1.DERInteger({bigint:C.dmp1});var u=new KJUR.asn1.DERInteger({bigint:C.dmq1});var x=new KJUR.asn1.DERInteger({bigint:C.coeff});var E=new KJUR.asn1.DERSequence({array:[A,v,z,B,t,r,y,u,x]});var w=E.getEncodedHex();return this.getEncryptedPKCS5PEMFromPrvKeyHex(w,D,o,s)},newEncryptedPKCS5PEM:function(o,p,s,t){if(typeof p=="undefined"||p==null){p=1024}if(typeof s=="undefined"||s==null){s="10001"}var q=new RSAKey();q.generate(p,s);var r=null;if(typeof t=="undefined"||t==null){r=this.getEncryptedPKCS5PEMFromRSAKey(pkey,o)}else{r=this.getEncryptedPKCS5PEMFromRSAKey(pkey,o,t)}return r},getRSAKeyFromPlainPKCS8PEM:function(q){if(q.match(/ENCRYPTED/)){throw"pem shall be not ENCRYPTED"}var p=this.getHexFromPEM(q,"PRIVATE KEY");var o=this.getRSAKeyFromPlainPKCS8Hex(p);return o},getRSAKeyFromPlainPKCS8Hex:function(r){var q=ASN1HEX.getPosArrayOfChildren_AtObj(r,0);if(q.length!=3){throw"outer DERSequence shall have 3 elements: "+q.length}var p=ASN1HEX.getHexOfTLV_AtObj(r,q[1]);if(p!="300d06092a864886f70d0101010500"){throw"PKCS8 AlgorithmIdentifier is not rsaEnc: "+p}var p=ASN1HEX.getHexOfTLV_AtObj(r,q[1]);var s=ASN1HEX.getHexOfTLV_AtObj(r,q[2]);var t=ASN1HEX.getHexOfV_AtObj(s,0);var o=new RSAKey();o.readPrivateKeyFromASN1HexString(t);return o},parseHexOfEncryptedPKCS8:function(v){var r={};var q=ASN1HEX.getPosArrayOfChildren_AtObj(v,0);if(q.length!=2){throw"malformed format: SEQUENCE(0).items != 2: "+q.length}r.ciphertext=ASN1HEX.getHexOfV_AtObj(v,q[1]);var x=ASN1HEX.getPosArrayOfChildren_AtObj(v,q[0]);if(x.length!=2){throw"malformed format: SEQUENCE(0.0).items != 2: "+x.length}if(ASN1HEX.getHexOfV_AtObj(v,x[0])!="2a864886f70d01050d"){throw"this only supports pkcs5PBES2"}var o=ASN1HEX.getPosArrayOfChildren_AtObj(v,x[1]);if(x.length!=2){throw"malformed format: SEQUENCE(0.0.1).items != 2: "+o.length}var p=ASN1HEX.getPosArrayOfChildren_AtObj(v,o[1]);if(p.length!=2){throw"malformed format: SEQUENCE(0.0.1.1).items != 2: "+p.length}if(ASN1HEX.getHexOfV_AtObj(v,p[0])!="2a864886f70d0307"){throw"this only supports TripleDES"}r.encryptionSchemeAlg="TripleDES";r.encryptionSchemeIV=ASN1HEX.getHexOfV_AtObj(v,p[1]);var s=ASN1HEX.getPosArrayOfChildren_AtObj(v,o[0]);if(s.length!=2){throw"malformed format: SEQUENCE(0.0.1.0).items != 2: "+s.length}if(ASN1HEX.getHexOfV_AtObj(v,s[0])!="2a864886f70d01050c"){throw"this only supports pkcs5PBKDF2"}var w=ASN1HEX.getPosArrayOfChildren_AtObj(v,s[1]);if(w.length<2){throw"malformed format: SEQUENCE(0.0.1.0.1).items < 2: "+w.length}r.pbkdf2Salt=ASN1HEX.getHexOfV_AtObj(v,w[0]);var t=ASN1HEX.getHexOfV_AtObj(v,w[1]);try{r.pbkdf2Iter=parseInt(t,16)}catch(u){throw"malformed format pbkdf2Iter: "+t}return r},getPBKDF2KeyHexFromParam:function(t,o){var s=CryptoJS.enc.Hex.parse(t.pbkdf2Salt);var p=t.pbkdf2Iter;var r=CryptoJS.PBKDF2(o,s,{keySize:192/32,iterations:p});var q=CryptoJS.enc.Hex.stringify(r);return q},getPlainPKCS8HexFromEncryptedPKCS8PEM:function(w,x){var q=this.getHexFromPEM(w,"ENCRYPTED PRIVATE KEY");var o=this.parseHexOfEncryptedPKCS8(q);var t=KEYUTIL.getPBKDF2KeyHexFromParam(o,x);var u={};u.ciphertext=CryptoJS.enc.Hex.parse(o.ciphertext);var s=CryptoJS.enc.Hex.parse(t);var r=CryptoJS.enc.Hex.parse(o.encryptionSchemeIV);var v=CryptoJS.TripleDES.decrypt(u,s,{iv:r});var p=CryptoJS.enc.Hex.stringify(v);return p},getRSAKeyFromEncryptedPKCS8PEM:function(r,q){var p=this.getPlainPKCS8HexFromEncryptedPKCS8PEM(r,q);var o=this.getRSAKeyFromPlainPKCS8Hex(p);return o},getKeyFromEncryptedPKCS8PEM:function(r,p){var o=this.getPlainPKCS8HexFromEncryptedPKCS8PEM(r,p);var q=this.getKeyFromPlainPrivatePKCS8Hex(o);return q},parsePlainPrivatePKCS8Hex:function(r){var p={};p.algparam=null;if(r.substr(0,2)!="30"){throw"malformed plain PKCS8 private key(code:001)"}var q=ASN1HEX.getPosArrayOfChildren_AtObj(r,0);if(q.length!=3){throw"malformed plain PKCS8 private key(code:002)"}if(r.substr(q[1],2)!="30"){throw"malformed PKCS8 private key(code:003)"}var o=ASN1HEX.getPosArrayOfChildren_AtObj(r,q[1]);if(o.length!=2){throw"malformed PKCS8 private key(code:004)"}if(r.substr(o[0],2)!="06"){throw"malformed PKCS8 private key(code:005)"}p.algoid=ASN1HEX.getHexOfV_AtObj(r,o[0]);if(r.substr(o[1],2)=="06"){p.algparam=ASN1HEX.getHexOfV_AtObj(r,o[1])}if(r.substr(q[2],2)!="04"){throw"malformed PKCS8 private key(code:006)"}p.keyidx=ASN1HEX.getStartPosOfV_AtObj(r,q[2]);return p},getKeyFromPlainPrivatePKCS8PEM:function(p){var o=this.getHexFromPEM(p,"PRIVATE KEY");var q=this.getKeyFromPlainPrivatePKCS8Hex(o);return q},getKeyFromPlainPrivatePKCS8Hex:function(o){var q=this.parsePlainPrivatePKCS8Hex(o);if(q.algoid=="2a864886f70d010101"){this.parsePrivateRawRSAKeyHexAtObj(o,q);var p=q.key;var r=new RSAKey();r.setPrivateEx(p.n,p.e,p.d,p.p,p.q,p.dp,p.dq,p.co);return r}else{if(q.algoid=="2a8648ce3d0201"){this.parsePrivateRawECKeyHexAtObj(o,q);if(KJUR.crypto.OID.oidhex2name[q.algparam]===undefined){throw"KJUR.crypto.OID.oidhex2name undefined: "+q.algparam}var s=KJUR.crypto.OID.oidhex2name[q.algparam];var r=new KJUR.crypto.ECDSA({curve:s,prv:q.key});return r}else{throw"unsupported private key algorithm"}}},getRSAKeyFromPublicPKCS8PEM:function(p){var q=this.getHexFromPEM(p,"PUBLIC KEY");var o=this.getRSAKeyFromPublicPKCS8Hex(q);return o},getKeyFromPublicPKCS8PEM:function(p){var q=this.getHexFromPEM(p,"PUBLIC KEY");var o=this.getKeyFromPublicPKCS8Hex(q);return o},getKeyFromPublicPKCS8Hex:function(p){var o=this.parsePublicPKCS8Hex(p);if(o.algoid=="2a864886f70d010101"){var s=this.parsePublicRawRSAKeyHex(o.key);var q=new RSAKey();q.setPublic(s.n,s.e);return q}else{if(o.algoid=="2a8648ce3d0201"){if(KJUR.crypto.OID.oidhex2name[o.algparam]===undefined){throw"KJUR.crypto.OID.oidhex2name undefined: "+o.algparam}var r=KJUR.crypto.OID.oidhex2name[o.algparam];var q=new KJUR.crypto.ECDSA({curve:r,pub:o.key});return q}else{throw"unsupported public key algorithm"}}},parsePublicRawRSAKeyHex:function(q){var o={};if(q.substr(0,2)!="30"){throw"malformed RSA key(code:001)"}var p=ASN1HEX.getPosArrayOfChildren_AtObj(q,0);if(p.length!=2){throw"malformed RSA key(code:002)"}if(q.substr(p[0],2)!="02"){throw"malformed RSA key(code:003)"}o.n=ASN1HEX.getHexOfV_AtObj(q,p[0]);if(q.substr(p[1],2)!="02"){throw"malformed RSA key(code:004)"}o.e=ASN1HEX.getHexOfV_AtObj(q,p[1]);return o},parsePrivateRawRSAKeyHexAtObj:function(p,r){var q=r.keyidx;if(p.substr(q,2)!="30"){throw"malformed RSA private key(code:001)"}var o=ASN1HEX.getPosArrayOfChildren_AtObj(p,q);if(o.length!=9){throw"malformed RSA private key(code:002)"}r.key={};r.key.n=ASN1HEX.getHexOfV_AtObj(p,o[1]);r.key.e=ASN1HEX.getHexOfV_AtObj(p,o[2]);r.key.d=ASN1HEX.getHexOfV_AtObj(p,o[3]);r.key.p=ASN1HEX.getHexOfV_AtObj(p,o[4]);r.key.q=ASN1HEX.getHexOfV_AtObj(p,o[5]);r.key.dp=ASN1HEX.getHexOfV_AtObj(p,o[6]);r.key.dq=ASN1HEX.getHexOfV_AtObj(p,o[7]);r.key.co=ASN1HEX.getHexOfV_AtObj(p,o[8])},parsePrivateRawECKeyHexAtObj:function(p,r){var q=r.keyidx;if(p.substr(q,2)!="30"){throw"malformed ECC private key(code:001)"}var o=ASN1HEX.getPosArrayOfChildren_AtObj(p,q);if(o.length!=3){throw"malformed ECC private key(code:002)"}if(p.substr(o[1],2)!="04"){throw"malformed ECC private key(code:003)"}r.key=ASN1HEX.getHexOfV_AtObj(p,o[1])},parsePublicPKCS8Hex:function(r){var p={};p.algparam=null;var q=ASN1HEX.getPosArrayOfChildren_AtObj(r,0);if(q.length!=2){throw"outer DERSequence shall have 2 elements: "+q.length}var s=q[0];if(r.substr(s,2)!="30"){throw"malformed PKCS8 public key(code:001)"}var o=ASN1HEX.getPosArrayOfChildren_AtObj(r,s);if(o.length!=2){throw"malformed PKCS8 public key(code:002)"}if(r.substr(o[0],2)!="06"){throw"malformed PKCS8 public key(code:003)"}p.algoid=ASN1HEX.getHexOfV_AtObj(r,o[0]);if(r.substr(o[1],2)=="06"){p.algparam=ASN1HEX.getHexOfV_AtObj(r,o[1])}if(r.substr(q[1],2)!="03"){throw"malformed PKCS8 public key(code:004)"}p.key=ASN1HEX.getHexOfV_AtObj(r,q[1]).substr(2);return p},getRSAKeyFromPublicPKCS8Hex:function(s){var r=ASN1HEX.getPosArrayOfChildren_AtObj(s,0);if(r.length!=2){throw"outer DERSequence shall have 2 elements: "+r.length}var q=ASN1HEX.getHexOfTLV_AtObj(s,r[0]);if(q!="300d06092a864886f70d0101010500"){throw"PKCS8 AlgorithmId is not rsaEncryption"}if(s.substr(r[1],2)!="03"){throw"PKCS8 Public Key is not BITSTRING encapslated."}var u=ASN1HEX.getStartPosOfV_AtObj(s,r[1])+2;if(s.substr(u,2)!="30"){throw"PKCS8 Public Key is not SEQUENCE."}var o=ASN1HEX.getPosArrayOfChildren_AtObj(s,u);if(o.length!=2){throw"inner DERSequence shall have 2 elements: "+o.length}if(s.substr(o[0],2)!="02"){throw"N is not ASN.1 INTEGER"}if(s.substr(o[1],2)!="02"){throw"E is not ASN.1 INTEGER"}var v=ASN1HEX.getHexOfV_AtObj(s,o[0]);var t=ASN1HEX.getHexOfV_AtObj(s,o[1]);var p=new RSAKey();p.setPublic(v,t);return p},}}();KEYUTIL.getKey=function(d,a,c){if(d instanceof RSAKey){return d}if(d instanceof KJUR.crypto.ECDSA){return d}if(d.xy!==undefined&&d.curve!==undefined){return new KJUR.crypto.ECDSA({prv:d.xy,curve:d.curve})}if(d,n!==undefined&&d.e!==undefined&&d.d!==undefined&&d.p!==undefined&&d.q!==undefined&&d.dp!==undefined&&d.dq!==undefined&&d.co!==undefined){var b=new RSAKey();b.setPrivateEx(d.n,d.e,d.d,d.p,d.q,d.dp,d.dq,d.co);return b}if(d.d!==undefined&&d.curve!==undefined){return new KJUR.crypto.ECDSA({pub:d.d,curve:d.curve})}if(d,n!==undefined&&d.e){var b=new RSAKey();b.setPublic(d.n,d.e);return b}if(d.indexOf("-END CERTIFICATE-",0)!=-1||d.indexOf("-END X509 CERTIFICATE-",0)!=-1||d.indexOf("-END TRUSTED CERTIFICATE-",0)!=-1){return X509.getPublicKeyFromCertPEM(d)}if(c==="pkcs8pub"){return KEYUTIL.getKeyFromPublicPKCS8Hex(d)}if(d.indexOf("-END PUBLIC KEY-")!=-1){return KEYUTIL.getKeyFromPublicPKCS8PEM(d)}if(c==="pkcs5prv"){var b=new RSAKey();b.readPrivateKeyFromASN1HexString(d);return b}if(c==="pkcs5prv"){var b=new RSAKey();b.readPrivateKeyFromASN1HexString(d);return b}if(d.indexOf("-END RSA PRIVATE KEY-")!=-1&&d.indexOf("4,ENCRYPTED")==-1){var b=new RSAKey();b.readPrivateKeyFromPEMString(d);return b}if(d.indexOf("-END PRIVATE KEY-")!=-1){return KEYUTIL.getKeyFromPlainPrivatePKCS8PEM(d)}if(d.indexOf("-END RSA PRIVATE KEY-")!=-1&&d.indexOf("4,ENCRYPTED")!=-1){return KEYUTIL.getRSAKeyFromEncryptedPKCS5PEM(d,a)}if(d.indexOf("-END ENCRYPTED PRIVATE KEY-")!=-1){return KEYUTIL.getKeyFromEncryptedPKCS8PEM(d,a)}throw"not supported argument"};
+var KEYUTIL=function(){var c=function(n,p,o){return i(CryptoJS.AES,n,p,o)};var d=function(n,p,o){return i(CryptoJS.TripleDES,n,p,o)};var i=function(q,v,s,o){var p=CryptoJS.enc.Hex.parse(v);var u=CryptoJS.enc.Hex.parse(s);var n=CryptoJS.enc.Hex.parse(o);var r={};r.key=u;r.iv=n;r.ciphertext=p;var t=q.decrypt(r,u,{iv:n});return CryptoJS.enc.Hex.stringify(t)};var j=function(n,p,o){return e(CryptoJS.AES,n,p,o)};var m=function(n,p,o){return e(CryptoJS.TripleDES,n,p,o)};var e=function(r,w,t,o){var q=CryptoJS.enc.Hex.parse(w);var v=CryptoJS.enc.Hex.parse(t);var n=CryptoJS.enc.Hex.parse(o);var u=r.encrypt(q,v,{iv:n});var p=CryptoJS.enc.Hex.parse(u.toString());var s=CryptoJS.enc.Base64.stringify(p);return s};var g={"AES-256-CBC":{proc:c,eproc:j,keylen:32,ivlen:16},"AES-192-CBC":{proc:c,eproc:j,keylen:24,ivlen:16},"AES-128-CBC":{proc:c,eproc:j,keylen:16,ivlen:16},"DES-EDE3-CBC":{proc:d,eproc:m,keylen:24,ivlen:8}};var b=function(n){return g[n]["proc"]};var k=function(n){var p=CryptoJS.lib.WordArray.random(n);var o=CryptoJS.enc.Hex.stringify(p);return o};var l=function(q){var r={};if(q.match(new RegExp("DEK-Info: ([^,]+),([0-9A-Fa-f]+)","m"))){r.cipher=RegExp.$1;r.ivsalt=RegExp.$2}if(q.match(new RegExp("-----BEGIN ([A-Z]+) PRIVATE KEY-----"))){r.type=RegExp.$1}var p=-1;var t=0;if(q.indexOf("\r\n\r\n")!=-1){p=q.indexOf("\r\n\r\n");t=2}if(q.indexOf("\n\n")!=-1){p=q.indexOf("\n\n");t=1}var o=q.indexOf("-----END");if(p!=-1&&o!=-1){var n=q.substring(p+t*2,o-t);n=n.replace(/\s+/g,"");r.data=n}return r};var h=function(o,w,n){var t=n.substring(0,16);var r=CryptoJS.enc.Hex.parse(t);var p=CryptoJS.enc.Utf8.parse(w);var s=g[o]["keylen"]+g[o]["ivlen"];var v="";var u=null;for(;;){var q=CryptoJS.algo.MD5.create();if(u!=null){q.update(u)}q.update(p);q.update(r);u=q.finalize();v=v+CryptoJS.enc.Hex.stringify(u);if(v.length>=s*2){break}}var x={};x.keyhex=v.substr(0,g[o]["keylen"]*2);x.ivhex=v.substr(g[o]["keylen"]*2,g[o]["ivlen"]*2);return x};var a=function(n,t,p,u){var q=CryptoJS.enc.Base64.parse(n);var o=CryptoJS.enc.Hex.stringify(q);var s=g[t]["proc"];var r=s(o,p,u);return r};var f=function(n,q,o,s){var p=g[q]["eproc"];var r=p(n,o,s);return r};return{version:"1.0.0",getHexFromPEM:function(o,r){var p=o;if(p.indexOf("BEGIN "+r)==-1){throw"can't find PEM header: "+r}p=p.replace("-----BEGIN "+r+"-----","");p=p.replace("-----END "+r+"-----","");var q=p.replace(/\s+/g,"");var n=b64tohex(q);return n},getDecryptedKeyHexByKeyIV:function(o,r,q,p){var n=b(r);return n(o,q,p)},parsePKCS5PEM:function(n){return l(n)},getKeyAndUnusedIvByPasscodeAndIvsalt:function(o,n,p){return h(o,n,p)},decryptKeyB64:function(n,p,o,q){return a(n,p,o,q)},getDecryptedKeyHex:function(w,v){var o=l(w);var r=o.type;var p=o.cipher;var n=o.ivsalt;var q=o.data;var u=h(p,v,n);var t=u.keyhex;var s=a(q,p,t,n);return s},getRSAKeyFromEncryptedPKCS5PEM:function(p,o){var q=this.getDecryptedKeyHex(p,o);var n=new RSAKey();n.readPrivateKeyFromASN1HexString(q);return n},getEncryptedPKCS5PEMFromPrvKeyHex:function(q,x,r,p){var n="";if(typeof r=="undefined"||r==null){r="AES-256-CBC"}if(typeof g[r]=="undefined"){throw"KEYUTIL unsupported algorithm: "+r}if(typeof p=="undefined"||p==null){var t=g[r]["ivlen"];var s=k(t);p=s.toUpperCase()}var w=h(r,x,p);var v=w.keyhex;var u=f(q,r,v,p);var o=u.replace(/(.{64})/g,"$1\r\n");var n="-----BEGIN RSA PRIVATE KEY-----\r\n";n+="Proc-Type: 4,ENCRYPTED\r\n";n+="DEK-Info: "+r+","+p+"\r\n";n+="\r\n";n+=o;n+="\r\n-----END RSA PRIVATE KEY-----\r\n";return n},getEncryptedPKCS5PEMFromRSAKey:function(C,D,o,s){var A=new KJUR.asn1.DERInteger({"int":0});var v=new KJUR.asn1.DERInteger({bigint:C.n});var z=new KJUR.asn1.DERInteger({"int":C.e});var B=new KJUR.asn1.DERInteger({bigint:C.d});var t=new KJUR.asn1.DERInteger({bigint:C.p});var r=new KJUR.asn1.DERInteger({bigint:C.q});var y=new KJUR.asn1.DERInteger({bigint:C.dmp1});var u=new KJUR.asn1.DERInteger({bigint:C.dmq1});var x=new KJUR.asn1.DERInteger({bigint:C.coeff});var E=new KJUR.asn1.DERSequence({array:[A,v,z,B,t,r,y,u,x]});var w=E.getEncodedHex();return this.getEncryptedPKCS5PEMFromPrvKeyHex(w,D,o,s)},newEncryptedPKCS5PEM:function(n,o,r,s){if(typeof o=="undefined"||o==null){o=1024}if(typeof r=="undefined"||r==null){r="10001"}var p=new RSAKey();p.generate(o,r);var q=null;if(typeof s=="undefined"||s==null){q=this.getEncryptedPKCS5PEMFromRSAKey(pkey,n)}else{q=this.getEncryptedPKCS5PEMFromRSAKey(pkey,n,s)}return q},getRSAKeyFromPlainPKCS8PEM:function(p){if(p.match(/ENCRYPTED/)){throw"pem shall be not ENCRYPTED"}var o=this.getHexFromPEM(p,"PRIVATE KEY");var n=this.getRSAKeyFromPlainPKCS8Hex(o);return n},getRSAKeyFromPlainPKCS8Hex:function(q){var p=ASN1HEX.getPosArrayOfChildren_AtObj(q,0);if(p.length!=3){throw"outer DERSequence shall have 3 elements: "+p.length}var o=ASN1HEX.getHexOfTLV_AtObj(q,p[1]);if(o!="300d06092a864886f70d0101010500"){throw"PKCS8 AlgorithmIdentifier is not rsaEnc: "+o}var o=ASN1HEX.getHexOfTLV_AtObj(q,p[1]);var r=ASN1HEX.getHexOfTLV_AtObj(q,p[2]);var s=ASN1HEX.getHexOfV_AtObj(r,0);var n=new RSAKey();n.readPrivateKeyFromASN1HexString(s);return n},parseHexOfEncryptedPKCS8:function(u){var q={};var p=ASN1HEX.getPosArrayOfChildren_AtObj(u,0);if(p.length!=2){throw"malformed format: SEQUENCE(0).items != 2: "+p.length}q.ciphertext=ASN1HEX.getHexOfV_AtObj(u,p[1]);var w=ASN1HEX.getPosArrayOfChildren_AtObj(u,p[0]);if(w.length!=2){throw"malformed format: SEQUENCE(0.0).items != 2: "+w.length}if(ASN1HEX.getHexOfV_AtObj(u,w[0])!="2a864886f70d01050d"){throw"this only supports pkcs5PBES2"}var n=ASN1HEX.getPosArrayOfChildren_AtObj(u,w[1]);if(w.length!=2){throw"malformed format: SEQUENCE(0.0.1).items != 2: "+n.length}var o=ASN1HEX.getPosArrayOfChildren_AtObj(u,n[1]);if(o.length!=2){throw"malformed format: SEQUENCE(0.0.1.1).items != 2: "+o.length}if(ASN1HEX.getHexOfV_AtObj(u,o[0])!="2a864886f70d0307"){throw"this only supports TripleDES"}q.encryptionSchemeAlg="TripleDES";q.encryptionSchemeIV=ASN1HEX.getHexOfV_AtObj(u,o[1]);var r=ASN1HEX.getPosArrayOfChildren_AtObj(u,n[0]);if(r.length!=2){throw"malformed format: SEQUENCE(0.0.1.0).items != 2: "+r.length}if(ASN1HEX.getHexOfV_AtObj(u,r[0])!="2a864886f70d01050c"){throw"this only supports pkcs5PBKDF2"}var v=ASN1HEX.getPosArrayOfChildren_AtObj(u,r[1]);if(v.length<2){throw"malformed format: SEQUENCE(0.0.1.0.1).items < 2: "+v.length}q.pbkdf2Salt=ASN1HEX.getHexOfV_AtObj(u,v[0]);var s=ASN1HEX.getHexOfV_AtObj(u,v[1]);try{q.pbkdf2Iter=parseInt(s,16)}catch(t){throw"malformed format pbkdf2Iter: "+s}return q},getPBKDF2KeyHexFromParam:function(s,n){var r=CryptoJS.enc.Hex.parse(s.pbkdf2Salt);var o=s.pbkdf2Iter;var q=CryptoJS.PBKDF2(n,r,{keySize:192/32,iterations:o});var p=CryptoJS.enc.Hex.stringify(q);return p},getPlainPKCS8HexFromEncryptedPKCS8PEM:function(v,w){var p=this.getHexFromPEM(v,"ENCRYPTED PRIVATE KEY");var n=this.parseHexOfEncryptedPKCS8(p);var s=KEYUTIL.getPBKDF2KeyHexFromParam(n,w);var t={};t.ciphertext=CryptoJS.enc.Hex.parse(n.ciphertext);var r=CryptoJS.enc.Hex.parse(s);var q=CryptoJS.enc.Hex.parse(n.encryptionSchemeIV);var u=CryptoJS.TripleDES.decrypt(t,r,{iv:q});var o=CryptoJS.enc.Hex.stringify(u);return o},getRSAKeyFromEncryptedPKCS8PEM:function(q,p){var o=this.getPlainPKCS8HexFromEncryptedPKCS8PEM(q,p);var n=this.getRSAKeyFromPlainPKCS8Hex(o);return n},getKeyFromEncryptedPKCS8PEM:function(q,o){var n=this.getPlainPKCS8HexFromEncryptedPKCS8PEM(q,o);var p=this.getKeyFromPlainPrivatePKCS8Hex(n);return p},parsePlainPrivatePKCS8Hex:function(q){var o={};o.algparam=null;if(q.substr(0,2)!="30"){throw"malformed plain PKCS8 private key(code:001)"}var p=ASN1HEX.getPosArrayOfChildren_AtObj(q,0);if(p.length!=3){throw"malformed plain PKCS8 private key(code:002)"}if(q.substr(p[1],2)!="30"){throw"malformed PKCS8 private key(code:003)"}var n=ASN1HEX.getPosArrayOfChildren_AtObj(q,p[1]);if(n.length!=2){throw"malformed PKCS8 private key(code:004)"}if(q.substr(n[0],2)!="06"){throw"malformed PKCS8 private key(code:005)"}o.algoid=ASN1HEX.getHexOfV_AtObj(q,n[0]);if(q.substr(n[1],2)=="06"){o.algparam=ASN1HEX.getHexOfV_AtObj(q,n[1])}if(q.substr(p[2],2)!="04"){throw"malformed PKCS8 private key(code:006)"}o.keyidx=ASN1HEX.getStartPosOfV_AtObj(q,p[2]);return o},getKeyFromPlainPrivatePKCS8PEM:function(o){var n=this.getHexFromPEM(o,"PRIVATE KEY");var p=this.getKeyFromPlainPrivatePKCS8Hex(n);return p},getKeyFromPlainPrivatePKCS8Hex:function(n){var p=this.parsePlainPrivatePKCS8Hex(n);if(p.algoid=="2a864886f70d010101"){this.parsePrivateRawRSAKeyHexAtObj(n,p);var o=p.key;var q=new RSAKey();q.setPrivateEx(o.n,o.e,o.d,o.p,o.q,o.dp,o.dq,o.co);return q}else{if(p.algoid=="2a8648ce3d0201"){this.parsePrivateRawECKeyHexAtObj(n,p);if(KJUR.crypto.OID.oidhex2name[p.algparam]===undefined){throw"KJUR.crypto.OID.oidhex2name undefined: "+p.algparam}var r=KJUR.crypto.OID.oidhex2name[p.algparam];var q=new KJUR.crypto.ECDSA({curve:r,prv:p.key});return q}else{throw"unsupported private key algorithm"}}},getRSAKeyFromPublicPKCS8PEM:function(o){var p=this.getHexFromPEM(o,"PUBLIC KEY");var n=this.getRSAKeyFromPublicPKCS8Hex(p);return n},getKeyFromPublicPKCS8PEM:function(o){var p=this.getHexFromPEM(o,"PUBLIC KEY");var n=this.getKeyFromPublicPKCS8Hex(p);return n},getKeyFromPublicPKCS8Hex:function(o){var n=this.parsePublicPKCS8Hex(o);if(n.algoid=="2a864886f70d010101"){var r=this.parsePublicRawRSAKeyHex(n.key);var p=new RSAKey();p.setPublic(r.n,r.e);return p}else{if(n.algoid=="2a8648ce3d0201"){if(KJUR.crypto.OID.oidhex2name[n.algparam]===undefined){throw"KJUR.crypto.OID.oidhex2name undefined: "+n.algparam}var q=KJUR.crypto.OID.oidhex2name[n.algparam];var p=new KJUR.crypto.ECDSA({curve:q,pub:n.key});return p}else{throw"unsupported public key algorithm"}}},parsePublicRawRSAKeyHex:function(p){var n={};if(p.substr(0,2)!="30"){throw"malformed RSA key(code:001)"}var o=ASN1HEX.getPosArrayOfChildren_AtObj(p,0);if(o.length!=2){throw"malformed RSA key(code:002)"}if(p.substr(o[0],2)!="02"){throw"malformed RSA key(code:003)"}n.n=ASN1HEX.getHexOfV_AtObj(p,o[0]);if(p.substr(o[1],2)!="02"){throw"malformed RSA key(code:004)"}n.e=ASN1HEX.getHexOfV_AtObj(p,o[1]);return n},parsePrivateRawRSAKeyHexAtObj:function(o,q){var p=q.keyidx;if(o.substr(p,2)!="30"){throw"malformed RSA private key(code:001)"}var n=ASN1HEX.getPosArrayOfChildren_AtObj(o,p);if(n.length!=9){throw"malformed RSA private key(code:002)"}q.key={};q.key.n=ASN1HEX.getHexOfV_AtObj(o,n[1]);q.key.e=ASN1HEX.getHexOfV_AtObj(o,n[2]);q.key.d=ASN1HEX.getHexOfV_AtObj(o,n[3]);q.key.p=ASN1HEX.getHexOfV_AtObj(o,n[4]);q.key.q=ASN1HEX.getHexOfV_AtObj(o,n[5]);q.key.dp=ASN1HEX.getHexOfV_AtObj(o,n[6]);q.key.dq=ASN1HEX.getHexOfV_AtObj(o,n[7]);q.key.co=ASN1HEX.getHexOfV_AtObj(o,n[8])},parsePrivateRawECKeyHexAtObj:function(o,q){var p=q.keyidx;if(o.substr(p,2)!="30"){throw"malformed ECC private key(code:001)"}var n=ASN1HEX.getPosArrayOfChildren_AtObj(o,p);if(n.length!=3){throw"malformed ECC private key(code:002)"}if(o.substr(n[1],2)!="04"){throw"malformed ECC private key(code:003)"}q.key=ASN1HEX.getHexOfV_AtObj(o,n[1])},parsePublicPKCS8Hex:function(q){var o={};o.algparam=null;var p=ASN1HEX.getPosArrayOfChildren_AtObj(q,0);if(p.length!=2){throw"outer DERSequence shall have 2 elements: "+p.length}var r=p[0];if(q.substr(r,2)!="30"){throw"malformed PKCS8 public key(code:001)"}var n=ASN1HEX.getPosArrayOfChildren_AtObj(q,r);if(n.length!=2){throw"malformed PKCS8 public key(code:002)"}if(q.substr(n[0],2)!="06"){throw"malformed PKCS8 public key(code:003)"}o.algoid=ASN1HEX.getHexOfV_AtObj(q,n[0]);if(q.substr(n[1],2)=="06"){o.algparam=ASN1HEX.getHexOfV_AtObj(q,n[1])}if(q.substr(p[1],2)!="03"){throw"malformed PKCS8 public key(code:004)"}o.key=ASN1HEX.getHexOfV_AtObj(q,p[1]).substr(2);return o},getRSAKeyFromPublicPKCS8Hex:function(r){var q=ASN1HEX.getPosArrayOfChildren_AtObj(r,0);if(q.length!=2){throw"outer DERSequence shall have 2 elements: "+q.length}var p=ASN1HEX.getHexOfTLV_AtObj(r,q[0]);if(p!="300d06092a864886f70d0101010500"){throw"PKCS8 AlgorithmId is not rsaEncryption"}if(r.substr(q[1],2)!="03"){throw"PKCS8 Public Key is not BITSTRING encapslated."}var t=ASN1HEX.getStartPosOfV_AtObj(r,q[1])+2;if(r.substr(t,2)!="30"){throw"PKCS8 Public Key is not SEQUENCE."}var n=ASN1HEX.getPosArrayOfChildren_AtObj(r,t);if(n.length!=2){throw"inner DERSequence shall have 2 elements: "+n.length}if(r.substr(n[0],2)!="02"){throw"N is not ASN.1 INTEGER"}if(r.substr(n[1],2)!="02"){throw"E is not ASN.1 INTEGER"}var u=ASN1HEX.getHexOfV_AtObj(r,n[0]);var s=ASN1HEX.getHexOfV_AtObj(r,n[1]);var o=new RSAKey();o.setPublic(u,s);return o},}}();KEYUTIL.getKey=function(d,a,c){if(d instanceof RSAKey){return d}if(d instanceof KJUR.crypto.ECDSA){return d}if(d.xy!==undefined&&d.curve!==undefined){return new KJUR.crypto.ECDSA({prv:d.xy,curve:d.curve})}if(d.n!==undefined&&d.e!==undefined&&d.d!==undefined&&d.p!==undefined&&d.q!==undefined&&d.dp!==undefined&&d.dq!==undefined&&d.co!==undefined){var b=new RSAKey();b.setPrivateEx(d.n,d.e,d.d,d.p,d.q,d.dp,d.dq,d.co);return b}if(d.d!==undefined&&d.curve!==undefined){return new KJUR.crypto.ECDSA({pub:d.d,curve:d.curve})}if(d.n!==undefined&&d.e){var b=new RSAKey();b.setPublic(d.n,d.e);return b}if(d.indexOf("-END CERTIFICATE-",0)!=-1||d.indexOf("-END X509 CERTIFICATE-",0)!=-1||d.indexOf("-END TRUSTED CERTIFICATE-",0)!=-1){return X509.getPublicKeyFromCertPEM(d)}if(c==="pkcs8pub"){return KEYUTIL.getKeyFromPublicPKCS8Hex(d)}if(d.indexOf("-END PUBLIC KEY-")!=-1){return KEYUTIL.getKeyFromPublicPKCS8PEM(d)}if(c==="pkcs5prv"){var b=new RSAKey();b.readPrivateKeyFromASN1HexString(d);return b}if(c==="pkcs5prv"){var b=new RSAKey();b.readPrivateKeyFromASN1HexString(d);return b}if(d.indexOf("-END RSA PRIVATE KEY-")!=-1&&d.indexOf("4,ENCRYPTED")==-1){var b=new RSAKey();b.readPrivateKeyFromPEMString(d);return b}if(d.indexOf("-END PRIVATE KEY-")!=-1){return KEYUTIL.getKeyFromPlainPrivatePKCS8PEM(d)}if(d.indexOf("-END RSA PRIVATE KEY-")!=-1&&d.indexOf("4,ENCRYPTED")!=-1){return KEYUTIL.getRSAKeyFromEncryptedPKCS5PEM(d,a)}if(d.indexOf("-END ENCRYPTED PRIVATE KEY-")!=-1){return KEYUTIL.getKeyFromEncryptedPKCS8PEM(d,a)}throw"not supported argument"};KEYUTIL.generateKeypair=function(a,c){if(a=="RSA"){var b=c;var h=new RSAKey();h.generate(b,"10001");var f=new RSAKey();var e=h.n.toString(16);var i=h.e.toString(16);f.setPublic(e,i);var k={};k.prvKeyObj=h;k.pubKeyObj=f;return k}else{if(a=="EC"){var d=c;var g=new KJUR.crypto.ECDSA({curve:d});var j=g.generateKeyPairHex();var h=new KJUR.crypto.ECDSA({curve:d});h.setPrivateKeyHex(j.ecprvhex);var f=new KJUR.crypto.ECDSA({curve:d});f.setPublicKeyHex(j.ecpubhex);var k={};k.prvKeyObj=h;k.pubKeyObj=f;return k}else{throw"unknown algorithm: "+a}}};
View
4 test/qunit-do-keyutil-eprv.html
@@ -159,6 +159,10 @@
<body>
<div id="qunit"></div>
<div id="qunit-fixture">test markup</div>
+QUnit for
+<a href="qunit-do-keyutil.html">keyutil</a> |
+<a href="qunit-do-keyutil-eprv.html">keyutil-eprv</a> |
+<a href="qunit-do-keyutil-pub.html">keyutil-pub</a> |
</body>
</html>
View
112 test/qunit-do-keyutil-gen.html
@@ -0,0 +1,112 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+ "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+<title>QUnit for KEYUTIL keypair generator 'keyutil.js'</title>
+<script type="text/javascript" src="jquery-1.4.2.min.js"></script>
+
+<!-- script type="text/javascript" src="qunit.js" /script -->
+<!-- link rel="stylesheet" href="qunit.css" type="text/css" media="screen" -->
+<script src="http://code.jquery.com/qunit/qunit-1.11.0.js"></script>
+<link rel="stylesheet" href="http://code.jquery.com/qunit/qunit-1.11.0.css" type="text/css" media="screen"/>
+
+<script language="JavaScript" type="text/javascript" src="../ext/jsbn.js"></script>
+<script language="JavaScript" type="text/javascript" src="../ext/jsbn2.js"></script>
+<script language="JavaScript" type="text/javascript" src="../ext/prng4.js"></script>
+<script language="JavaScript" type="text/javascript" src="../ext/rng.js"></script>
+<script language="JavaScript" type="text/javascript" src="../ext/base64.js"></script>
+<script language="JavaScript" type="text/javascript" src="../ext/rsa.js"></script>
+<script language="JavaScript" type="text/javascript" src="../ext/rsa2.js"></script>
+<script language="JavaScript" type="text/javascript" src="../ext/sha1.js"></script>
+<script language="JavaScript" type="text/javascript" src="../asn1hex-1.1.js"></script>
+<script language="JavaScript" type="text/javascript" src="../rsapem-1.1.js"></script>
+<script language="JavaScript" type="text/javascript" src="../rsasign-1.2.js"></script>
+
+<script src="http://yui.yahooapis.com/2.9.0/build/yahoo/yahoo-min.js"></script>
+<script language="JavaScript" type="text/javascript" src="../asn1-1.0.js"></script>
+
+<!-- jsrsasign keyutil external codes -->
+<script src="http://crypto-js.googlecode.com/svn/tags/3.1.2/build/components/core.js"></script>
+<script src="http://crypto-js.googlecode.com/svn/tags/3.1.2/build/components/x64-core.js"></script>
+<script src="http://crypto-js.googlecode.com/svn/tags/3.1.2/build/components/cipher-core.js"></script>
+<script src="http://crypto-js.googlecode.com/svn/tags/3.1.2/build/components/aes.js"></script>
+<script src="http://crypto-js.googlecode.com/svn/tags/3.1.2/build/components/tripledes.js"></script>
+<script src="http://crypto-js.googlecode.com/svn/tags/3.1.2/build/components/enc-base64.js"></script>
+<script src="http://crypto-js.googlecode.com/svn/tags/3.1.2/build/components/md5.js"></script>
+<!-- for PKCS5 PBKDF2 -->
+<script src="http://crypto-js.googlecode.com/svn/tags/3.1.2/build/components/sha1.js"></script>
+<script src="http://crypto-js.googlecode.com/svn/tags/3.1.2/build/components/hmac.js"></script>
+<script src="http://crypto-js.googlecode.com/svn/tags/3.1.2/build/components/pbkdf2.js"></script>
+
+<!-- EC -->
+<script src="../ext/ec.js"></script>
+<script src="../ext/ec-patch.js"></script>
+<script src="../ecdsa-modified-1.0.js"></script>
+<script src="../ecparam-1.0.js"></script>
+
+<script src="../keyutil-1.0.js"></script>
+
+<script type="text/javascript">
+<!--
+
+function checkRSA(keypair, keyLen) {
+ var nLen = keypair.prvKeyObj.n.bitLength();
+ var dLen = keypair.prvKeyObj.d.bitLength();
+ expect(10);
+ equal(keyLen * 0.99 < nLen && nLen <= keyLen, true, "n.bitlength " + nLen);
+ equal(keyLen * 0.99 < dLen && dLen <= keyLen, true, "d.bitlength " + dLen);
+ equal(keypair.prvKeyObj.e.toString(16), '10001', "e(hex)");
+ equal(keypair.prvKeyObj.p !== undefined, true, "p not undefined");
+ equal(keypair.prvKeyObj.q !== undefined, true, "q not undefined");
+ equal(keypair.prvKeyObj.dmp1 !== undefined, true, "dmp1 not undefined");
+ equal(keypair.prvKeyObj.dmq1 !== undefined, true, "dmq1 not undefined");
+ equal(keypair.prvKeyObj.coeff !== undefined, true, "coeff not undefined");
+
+ var nLen2 = keypair.pubKeyObj.n.bitLength();
+ equal(keyLen * 0.99 < nLen2 && nLen <= keyLen, true, "pub n.bitlength " + nLen2);
+ equal(keypair.pubKeyObj.e.toString(16), '10001', "pub e(hex)");
+}
+
+$(document).ready(function(){
+
+test("generate RSA 512", function() {
+ var keyLen = 512;
+ var keypair = KEYUTIL.generateKeypair("RSA", keyLen);
+ checkRSA(keypair, keyLen);
+});
+
+test("generate RSA 1024", function() {
+ var keyLen = 1024;
+ var keypair = KEYUTIL.generateKeypair("RSA", keyLen);
+ checkRSA(keypair, keyLen);
+});
+
+test("generate EC", function() {
+ var curve = "secp256r1";
+ var keypair = KEYUTIL.generateKeypair("EC", curve);
+
+ expect(4);
+ equal(keypair.prvKeyObj.curveName, curve, "prv curve " + curve);
+ equal(keypair.prvKeyObj.prvKeyHex !== undefined, true, "prv keyhex not undefined:" + keypair.prvKeyObj.prvKeyHex);
+
+ equal(keypair.pubKeyObj.curveName, curve, "pub curve " + curve);
+ equal(keypair.pubKeyObj.pubKeyHex !== undefined, true, "pub keyhex undefined:" + keypair.pubKeyObj.pubKeyHex);
+});
+
+});
+-->
+</script>
+
+</head>
+<body>
+<div id="qunit"></div>
+<div id="qunit-fixture">test markup</div>
+QUnit for
+<a href="qunit-do-keyutil.html">keyutil</a> |
+<a href="qunit-do-keyutil-eprv.html">keyutil-eprv</a> |
+<a href="qunit-do-keyutil-pub.html">keyutil-pub</a> |
+<a href="qunit-do-keyutil-pub.html">keyutil-gen</a> |
+</body>
+</html>
+
+
View
6 test/qunit-do-keyutil-pub.html
@@ -2,7 +2,7 @@
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
-<title>QUnit for PKCS5 RSA key reader 'pkcs5pkey.js' for RSA public key</title>
+<title>QUnit for PKCS5 RSA key reader 'keyutil.js' for RSA public key</title>
<script type="text/javascript" src="jquery-1.4.2.min.js"></script>
<!-- script type="text/javascript" src="qunit.js" /script -->
@@ -113,6 +113,10 @@
<body>
<div id="qunit"></div>
<div id="qunit-fixture">test markup</div>
+QUnit for
+<a href="qunit-do-keyutil.html">keyutil</a> |
+<a href="qunit-do-keyutil-eprv.html">keyutil-eprv</a> |
+<a href="qunit-do-keyutil-pub.html">keyutil-pub</a> |
</body>
</html>
View
4 test/qunit-do-keyutil.html
@@ -267,6 +267,10 @@
<body>
<div id="qunit"></div>
<div id="qunit-fixture">test markup</div>
+QUnit for
+<a href="qunit-do-keyutil.html">keyutil</a> |
+<a href="qunit-do-keyutil-eprv.html">keyutil-eprv</a> |
+<a href="qunit-do-keyutil-pub.html">keyutil-pub</a> |
</body>
</html>
Please sign in to comment.
Something went wrong with that request. Please try again.