AppendGeneratedPrivateKey (Stringlist subroutine): Difference between revisions
m (→See also: add method to list) |
|||
(11 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
{{Template:Stringlist:AppendGeneratedPrivateKey subtitle}} | {{Template:Stringlist:AppendGeneratedPrivateKey subtitle}} | ||
==Syntax== | ==Syntax== | ||
{{Template:Stringlist:AppendGeneratedPrivateKey syntax}} | {{Template:Stringlist:AppendGeneratedPrivateKey syntax}} | ||
===Syntax terms=== | ===Syntax terms=== | ||
<table | <table> | ||
<tr><th>sl</th> | <tr><th>sl</th> | ||
<td>A <var>Stringlist</var> object to contain the generated private key.</td></tr> | <td>A <var>Stringlist</var> object to contain the generated private key.</td></tr> | ||
<tr><th><var>Length</var></th> | <tr><th><var>Length</var></th> | ||
<td>This optional, [[Notation conventions for methods#Named parameters|name allowed]], parameter specifies the number of bits in the private key. The value must be at least 64 and no greater than 2048. The default is 512. </td></tr> | <td>This optional, [[Notation conventions for methods#Named parameters|name allowed]], parameter specifies the number of bits in the private key. The value must be at least 64 and no greater than 4096 (as of version 7.7 of Model 204). The pre-7.7 maximum is 2048. The default is 512. | ||
<p class="note"><b>Note:</b> While AppendGeneratedPrivateKey can generate keys whose length is less than 512, such keys are of purely academic interest. To use a key in a certificate request (see <var>[[AppendCertificateRequest (Stringlist function)|AppendCertificateRequest]]</var>, for example, requires a key whose length is 512 or greater. </p></td></tr> | |||
<tr><th><var>Exponent</var></th> | <tr><th><var>Exponent</var></th> | ||
<td>This optional, name allowed, parameter specifies the number | <td>This optional, name allowed, parameter specifies the number of bits in the public exponent (E). This must be either 3 or X'10001'. The default is 3. </td></tr> | ||
<tr><th><var>Salt</var></th> | <tr><th><var>Salt</var></th> | ||
Line 20: | Line 20: | ||
==Examples== | ==Examples== | ||
In the following example, a private key is generated into a <var>Stringlist</var> and displayed in base64 format, then the private key is extracted to a string, loaded into an <var>XmlDoc</var>, and printed: | In the following example, a private key is generated into a <var>Stringlist</var> and displayed in base64 format, then the private key is extracted to a binary string, loaded into an <var>XmlDoc</var>, and printed: | ||
<p class="code">b | <p class="code">b | ||
Line 35: | Line 35: | ||
</p> | </p> | ||
The result is something like: | The result is something like: | ||
<p class="output"> | <p class="output">-----BEGIN RSA PRIVATE KEY----- | ||
-----BEGIN RSA PRIVATE KEY----- | |||
MIICWwIBAAKBgQCPcaITVcyiT2zx4aKymt9u+NEZ4FzbPvlhbBQs+WkYhbErBeOb | MIICWwIBAAKBgQCPcaITVcyiT2zx4aKymt9u+NEZ4FzbPvlhbBQs+WkYhbErBeOb | ||
FR2e5dmch7h5anX5xG6OneIzJ95ylMMmyWiTAjH5nEH1zI7P3k34/3QjN7YgN+f4 | FR2e5dmch7h5anX5xG6OneIzJ95ylMMmyWiTAjH5nEH1zI7P3k34/3QjN7YgN+f4 | ||
Line 71: | Line 70: | ||
303026918447360800362338060867429057473</coefficient> | 303026918447360800362338060867429057473</coefficient> | ||
</RSAPrivateKey> | </RSAPrivateKey> | ||
</p> | </p> | ||
==See also== | ==See also== | ||
<p> | |||
<var>Stringlist</var> methods: </p> | |||
{{Template:Stringlist crypto methods}} | |||
<p> | |||
<var>String</var> methods:</p> | |||
<ul> | |||
<li><var>[[CertificateRequest (String function)|CertificateRequest]]</var> </li> | |||
<li><var>[[SignedCertificate (String function)|SignedCertificate]]</var> </li> | |||
<li><var>[[SignedClientCertificate (String function)|SignedClientCertificate]]</var> </li> | |||
<li><var>[[DerToXmlDoc (String function)|DerToXmlDoc]]</var> </li> | |||
<li><var>[[RSAPrivateKeyToXmlDoc (String function)|RSAPrivateKeyToXmlDoc]]</var></li> | |||
<li><var>[[X509CertificateToXmlDoc (String function)|X509CertificateToXmlDoc]]</var> </li> | |||
<li><var>[[X509CrlToXmlDoc (String function)|X509CrlToXmlDoc]]</var> </li> | |||
<li>Multiple cryptographic cipher methods </li> | |||
</ul> | |||
<p> | |||
<var>System</var> methods: </p> | |||
<ul> | |||
<li><var>[[ClientCertificate (System function)|ClientCertificate]]</var> </li><li><var>[[GeneratedPrivateKey (System function)|GeneratedPrivateKey]]</var> </li> | |||
</ul> | |||
<p> | |||
<var>Socket</var> methods: </p> | |||
<ul> | <ul> | ||
<li><var>[[ | <li><var>[[Certificate (Socket function)|Certificate]]</var> </li> | ||
</ul> | </ul> | ||
{{Template:Stringlist:AppendGeneratedPrivateKey footer}} | {{Template:Stringlist:AppendGeneratedPrivateKey footer}} |
Latest revision as of 15:13, 6 September 2018
Add base64 encoded RSA private key to a Stringlist (Stringlist class)
[Requires Janus Network Security]
Syntax
sl:AppendGeneratedPrivateKey[( [[Length=] number], [[Exponent=] number], - [[Salt=] string])]
Syntax terms
sl | A Stringlist object to contain the generated private key. |
---|---|
Length | This optional, name allowed, parameter specifies the number of bits in the private key. The value must be at least 64 and no greater than 4096 (as of version 7.7 of Model 204). The pre-7.7 maximum is 2048. The default is 512.
Note: While AppendGeneratedPrivateKey can generate keys whose length is less than 512, such keys are of purely academic interest. To use a key in a certificate request (see AppendCertificateRequest, for example, requires a key whose length is 512 or greater. |
Exponent | This optional, name allowed, parameter specifies the number of bits in the public exponent (E). This must be either 3 or X'10001'. The default is 3. |
Salt | This optional, name allowed, parameter is a string that contains seed data for a random number generator. |
Examples
In the following example, a private key is generated into a Stringlist and displayed in base64 format, then the private key is extracted to a binary string, loaded into an XmlDoc, and printed:
b %sl is object stringlist %ls is longstring %sl = new %sl:appendGeneratedPrivateKey(Length=1024) %sl:print %ls = %sl:pemToString('RSA PRIVATE KEY') %ls:RSAPRIVATEKEYTOXMLDOC:print end
The result is something like:
-----BEGIN RSA PRIVATE KEY----- MIICWwIBAAKBgQCPcaITVcyiT2zx4aKymt9u+NEZ4FzbPvlhbBQs+WkYhbErBeOb FR2e5dmch7h5anX5xG6OneIzJ95ylMMmyWiTAjH5nEH1zI7P3k34/3QjN7YgN+f4 R+z7SHraInHc4QoN6uujWVfCvv1aA6YLjONz72JHrWxLgFZiHHLWSA3Z1wIBAwKB gBfoRa3johsNPNL68HMZz+fUItmlZM81KZA8rgd+5tlrnYcrpe8uL5p7pETBSWmR vlRLZ8JvpbMxT73DddvMPBhAdsTRWPg3Ef0vFd/+W2icZ4B1qSlVsy7FIHBzxULX 4DHCgNEPa0YM9vD4pTv7Y4EQSoi1PhQk/8S8O7vDFsFHAkEAxSKHX3wu6EyExpFg y1MSDyaro9Tm+/Coy72znEsO9IkikE3YsoQeS/ohqMVn1U9o4pp0zktEVh2m5XOn GcuyhQJBALpG1VSv9ZnWW/05WD38nX4icdIcGUnJOd36g8+HPN0/wMuY5EpQACU5 kocBO9M/BKsInp+sjkw6Hs2YyJu5n6sCQQCDbFo/qB9FiFiEYOsyN2Ffbx0X40Sn 9cXdKSJoMgn4W2xgM+XMWBQypsEbLkU435tBvE3e3Ng5aRnuTRoRMncDAkB8Lzjj H/kROZKo0OV+qGj+waE2vWYxMNE+pwKKWiiTf9XdEJgxiqrDe7cEq303f1hyBb8V HbQy0WneZdsSe7/HAkEAj7yu1YIx+78xRa2zI494/QCzTcocC3S1tm1VjI6yLChE 6XRE80rGrU5xtiaqYnABdS1uPQAyyRzcDh1swvnDwQ== -----END RSA PRIVATE KEY----- <RSAPrivateKey> <version>0</version> <modulus>100729717618318585848486 ... 070347486493510338730901- 817890230060500171831435 ... 947861190265885563641189- 612871869577433527035045 ... 102393395848393488456151</modulus> <publicExponent>3</publicExponent> <privateExponent>167882862697197643080811 ... 203586267839124774891838- 978848363631503834341669 ... 3621646783354544762317395- 123358365246652607958565 ... 784368917835086686503239</privateExponent> <prime1>103247913368407610232689 ... 170858989455376441749390- 58859505943349295342502743592645253</prime1> <primes>975610202008600046064537 ... 272137236445431323153153- 9829343947046884546335129776791467</primes> <exponent1>688319422456050734884593 ... 361139059929702509611662- 6039239670628899530228335162395096835</exponent1> <exponent2>650406801339066697376358 ... 890181424824296954215435- 4359886229298031256364223419851194311</exponent2> <coefficient>7528119772196662607878768 ... 656935021038455079267606- 303026918447360800362338060867429057473</coefficient> </RSAPrivateKey>
See also
Stringlist methods:
- AppendCertificateInfo
- AppendCertificateRequest
- AppendCertificateRequestInfo
- AppendClientCertificateRequest
- AppendEncryptedSecurityData
- AppendGeneratedPrivateKey
- AppendPemData
- AppendPrivateKeyInfo
- AppendSignedCertificate
- AppendSignedClientCertificate
- CheckCertificate
- CheckCertificateRequest
- PemToString
String methods:
- CertificateRequest
- SignedCertificate
- SignedClientCertificate
- DerToXmlDoc
- RSAPrivateKeyToXmlDoc
- X509CertificateToXmlDoc
- X509CrlToXmlDoc
- Multiple cryptographic cipher methods
System methods:
Socket methods: