SignedCertificate (String function): Difference between revisions

From m204wiki
Jump to navigation Jump to search
m (method should be not callable)
Line 30: Line 30:


<tr><th><var>SignatureAlgorithm</var></th>
<tr><th><var>SignatureAlgorithm</var></th>
<td>This optional, [[Notation conventions for methods#Named parameters|name required]], argument is a <var>[[DigestAlgorithm enumeration|DigestAlgorithm]]</var> enumeration value. Valid options are: <var>MD5</var>, <var>SHA1</var>, <var>SHA256</var>. The default value is <var>SHA256</var> as of Model 204 7.7 (and zap maintenance for versions 7.6 and 7.5).
<td>This optional, [[Notation conventions for methods#Named parameters|name required]], argument is a <var>[[DigestAlgorithm enumeration|DigestAlgorithm]]</var> enumeration value. Valid options are: <var>MD5</var>, <var>SHA1</var>, <var>SHA256</var>, <var>SHA384</var> (Model 204 7.7 and later), and <var>SHA512</var> (Model 204 7.7 and later). The default value is <var>SHA256</var> as of Model 204 7.7 (and zap maintenance for versions 7.6 and 7.5).
<p class="note"><b>Note:</b> Although supported and formerly the default, most modern browsers are deprecating <var>SHA1</var>.</p></td></tr>
<p class="note"><b>Note:</b> Although supported and formerly the default, most modern browsers are deprecating <var>SHA1</var>.</p></td></tr>
</table>
</table>

Revision as of 03:13, 11 April 2016

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 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.
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 options 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: