AppendPrivateKeyInfo (Stringlist function)

From m204wiki
Jump to navigation Jump to search

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 base-64 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

0All is well.
1Encrypted but no password specified.
2Encrypted and wrong password specified.
3Out of CCATEMP.
5Stringlist identifier missing.
6Invalid Stringlist identifier.
7Insufficient storage.
10Input Stringlist identifier missing.
11Invalid input Stringlist identifier.
12Invalid input Stringlist data (not correctly base-64 encoded).
13Invalid 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.CSubject country
    S.SSubject state or province
    S.LSubject locality - city, town, village, etc.
    S.OSubject organization
    S.OUSubject organization unit
    S.CNSubject common name
    I.CIssuer country
    I.SIssuer state or province
    I.LIssuer locality - city, town, village, etc.
    I.OIssuer organization
    I.OUIssuer organization unit
    I.CNIssuer common name
    EFFEffective date in YYMMDDHHMISS format (GMT)
    EXPExpiration date in YYMMDDHHMISS format (GMT)
    ALGKey algorithm - currently always RSA
    NPublic modulus in hexadecimal
    EPublic 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