SignedCertificate (String function): Difference between revisions

From m204wiki
Jump to navigation Jump to search
m (add 7.7 maximum length)
m (→‎See also: add method bto list)
 
(One intermediate revision by one other user not shown)
Line 23: Line 23:


<tr><th><var>EndDate</var></th>
<tr><th><var>EndDate</var></th>
<td>This optional, name allowed, argument is a string that contains the End date for the signed certificate (in YYMMDDHHMISS format). The default is 24 hours from <var>StartDate</var>.</td></tr>
<td>This optional, name allowed, argument is a string that contains the End date for the signed certificate (in YYMMDDHHMISS format). The default is 24 hours from <var>StartDate</var>.  <code>YY</code> may not be less then the current 2-digit year.</td></tr>


<tr><th><var>SerialNumber</var></th>
<tr><th><var>SerialNumber</var></th>
Line 97: Line 97:


<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:06, 6 September 2018

Sign a certificate request (String class)

[Requires Janus Network Security]

This method generates a signed SSL certificate from a given certificate request and private key. It adds the lines of the signed certificate to the end of the object certificate-request.

Syntax

[%signedCert =] string:SignedCertificate( [PrivateKey=] string, - [[Signer=] string], - [[StartDate=] string], - [[EndDate=] string], - [[SerialNumber=] number], - [SignatureAlgorithm= digestAlgorithm]) Throws PKCSError

Syntax terms

%signedCert A String or Longstring to contain the signed certificate that the method creates.
string A String or Longstring that contains a base64 encoded X.509 certificate request.
PrivateKey This name allowed parameter is a String or Longstring that contains the RSA-generated private key used to create the signature. This value must be less than or equal to 4096 (as of version 7.7 of Model 204). The pre-7.7 maximum is 2048 bits.
Signer This optional, name allowed, argument is a string that contains a base64 encoded CA (certifying authority) X.509 certificate. If not specified, the method object string is used, and the certificate is self-signed.
StartDate This optional, name allowed, argument is a string that contains the Start date for the signed certificate (in YYMMDDHHMISS format). The default is today's date.
EndDate This optional, name allowed, argument is a string that contains the End date for the signed certificate (in YYMMDDHHMISS format). The default is 24 hours from StartDate. YY may not be less then the current 2-digit year.
SerialNumber This optional, name allowed, argument is a numeric value that is the Serial number for the signed certificate. The default is a number guaranteed to increase by 1 for every call and guaranteed to increase from run to run, unless there is an extreme amount of signing occurrences.
SignatureAlgorithm This optional, name required, argument is a DigestAlgorithm enumeration value. Valid values are: MD5, SHA1, SHA256, SHA384 (Model 204 7.7 and later), and SHA512 (Model 204 7.7 and later). The default value is SHA256 as of Model 204 7.7 (and zap maintenance for versions 7.6 and 7.5).

Note: Although supported and formerly the default, most modern browsers are deprecating SHA1.

Usage notes

For some background information concerning certificates, see Public-key cryptography and Certificate signing request.

Example

This example uses a self-generated private key and certificate request and then prints a view of the SignedCertificate output. The DerToXmlDoc method that is used to "unpack" the content does not understand the semantics of the standard tags for the signed certificate items, so the output tags are somewhat generic. No SOUL method interprets signed certificate items as well as, for example, the RSAPrivateKeyToXmlDoc does for a private key.

b %ls is longstring %cr is longstring %sc is longstring %ls = %(System):GeneratedPrivateKey(Length=512) %cr = %ls:CertificateRequest %sc = %cr:SignedCertificate(%ls) %sc:derToXmlDoc:print end

The result is:

%sc:derToXmlDoc:print: <Sequence> <Sequence> <Integer>16030188579305029649</Integer> <Sequence> <ObjectIdentifier>1.2.840.113549.1.1.11</ObjectIdentifier> <Null/> </Sequence> <Sequence/> <Sequence> <UTCTime>20160330222419.000Z</UTCTime> <UTCTime>20160330222419.000Z</UTCTime> </Sequence> <Sequence/> <Sequence> <Sequence> <ObjectIdentifier>1.2.840.113549.1.1.1</ObjectIdentifier> <Null/> </Sequence> <BitString bits="576"> 304602410082FCF711CB0B1C ... 06B82C686516711F8769127D0D- BE318606B7529E5020103 </BitString> </Sequence> </Sequence> <Sequence> <ObjectIdentifier>1.2.840.113549.1.1.11</ObjectIdentifier> <Null/> </Sequence> <BitString bits="512"> 5D076DA8C002B5077047EA27 ... 5C9CEBB9ED37CF1A0096B47220 </BitString> </Sequence>

See also

String methods:

Stringlist methods:

System methods:

Socket methods: