AppendPrivateKeyInfo (Stringlist function): Difference between revisions

From m204wiki
Jump to navigation Jump to search
(Automatically generated page update)
m (→‎See also: add method to list)
 
Line 165: Line 165:


<li><var>[[SignedCertificate (String function)|SignedCertificate]]</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>[[DerToXmlDoc (String function)|DerToXmlDoc]]</var> </li>

Latest revision as of 15:14, 6 September 2018

Add RSA private key information to a Stringlist (Stringlist class)

[Requires Janus Network Security]

This callable method adds lines from the information section of an SSL private key to the end of a Stringlist.

Syntax

[%number =] sl:AppendPrivateKeyInfo[( [sl], [[Password=] string])]

Syntax terms

%numberAn, optional, numeric variable that is set to zero if the function is a success. The possible return codes are described below in Return codes.
sl A Stringlist object to receive the private key information.
sl A Stringlist object that contains the base64 encoded text of an RSA private key.
Password This optional, name allowed, parameter is a string that contains a password to decrypt the private key, if necessary.

Return codes

0 All is well.
1 Encrypted but no password specified.
2 Encrypted and wrong password specified.
3 Out of CCATEMP.
5 Stringlist identifier missing.
6 Invalid Stringlist identifier.
7 Insufficient storage.
10 Input Stringlist identifier missing.
11 Invalid input Stringlist identifier.
12 Invalid input Stringlist data (not correctly base-64 encoded).
13 Invalid request/certificate (internal structure of certificate is not valid).

Usage notes

  • The updated Stringlist contains an arbitrary amount of information in an arbitrary order. Each list item is in ID=value format. These are the possible IDs:
    S.C Subject country
    S.S Subject state or province
    S.L Subject locality - city, town, village, etc.
    S.O Subject organization
    S.OU Subject organization unit
    S.CN Subject common name
    I.C Issuer country
    I.S Issuer state or province
    I.L Issuer locality: city, town, village, etc.
    I.O Issuer organization
    I.OU Issuer organization unit
    I.CN Issuer common name
    EFF Effective date in YYMMDDHHMISS format (GMT)
    EXP Expiration date in YYMMDDHHMISS format (GMT)
    ALG Key algorithm - currently always RSA
    N Public modulus in hexadecimal
    E Public exponent in hexadecimal

Examples

In the following example, a private key is hard-coded into one Stringlist, then the information contained in the private key is extracted via AppendPrivateKeyInfo into another Stringlist:

b %sl is object stringlist %pkey is object stringlist %sl = new %pkey = new text to %pkey raw ----BEGIN RSA PRIVATE KEY----- MIIEogIBAAKCAQEAm6TwmSXt4+lyrhwy9SBq2LVjdTeJ5kUbU9jzmBCfw/NuC1tX YAAdc0UG5DDJYPHkWkYa7+z50SYzmoxKI8PfCLyxSOPeVW9CEhRSyiIIlyjQikIK a0YMeOXVetGiutl/y346yQYltkbQXb1SOogTg07fTRs7NWcQ4Rrcd6DEnSkrHxbv T04Z0MwoSojA+NRyBCMpa+w+R0dzrBNZIT11WOccecYjEyuPSS2ydcdgr/Rp4WKC UHmRulXWQjhEjwqFPRG4f8BkYJGr8lN262M4ti4Z11KV/lYA/lEpYUkmCaY936p4 IoVoQy8GFn7mj50sxwSa446bTvKlVPsySMDK2wIBAwKCAQAZ8NLEMPz7UZMdBLMo ... aQmxZUwUo7em8Ci6dX17AoGAcmpQ5AUj5vMdRnOmiIhLM+jgbbQjBD+52hwbkkIn sZ00cQ5asvdrHt3ziIqN7RMu5okuwdFTdk5IGHTA43qykel0e7wxwADI7qybJXWF rsIve5XyKCD55gAM4W8y4+CLkCv6dPwmkTq4vfdaYr0/NPIvigzUq0NEXFVPJfQc GncCgYEAlFIEKq0mVWLBtZRwNjehKOaWGkVVHJnoWqlBngfamQkOiGvWScQ0MVbw K3U00KpuNHRF5RVy035uoU2tnQDLyG+RmUO7j2+t90MOmgXqiZlTz08uf/fQaprd NzpmjANA/9cT3rwHD31LsjaDXASM5IW0q7h+vhvVLtVkDzDnW5w= -----END RSA PRIVATE KEY----- end text %sl:appendPrivateKeyInfo(%pkey) %sl:print end

The result is something like:

ALG=RSA N=9BA4F09925EDE3E972AE1C32F5206AD8 ... A461AEFECF9D126339A8C4A23C3DF08B- CB148E3DE556F42121452CA22089728D08 ... 4D1B3B356710E11ADC77A0C49D292B1F- 16EF4F4E19D0CC284A88C0F8D472042329 ... 2507991BA55D64238448F0A853D11B87- FC0646091ABF25376EB6338B62E19D7529 ... E38E9B4EF2A554FB3248C0CADB E=03

See also

Stringlist methods:

String methods:

System methods:

Socket methods: