summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/luaossl.tex194
1 files changed, 176 insertions, 18 deletions
diff --git a/doc/luaossl.tex b/doc/luaossl.tex
index 347c2fe..e7d4c2d 100644
--- a/doc/luaossl.tex
+++ b/doc/luaossl.tex
@@ -351,6 +351,22 @@ Returns a key-value iterator over the alternative names. The key is one of ``ema
351\end{Module} 351\end{Module}
352 352
353 353
354\begin{Module}{openssl.x509.extension}
355
356Binds the X.509 extension OpenSSL object.
357
358\subsubsection[\fn{extension.new}]{\fn{extension.new($name$, $value$ [, $conf$])}}
359
360Returns a new X.509 extension. $name$, $value$, and $conf$ are [currently] plain text strings.
361$value$ and $conf$ should use \href{https://www.openssl.org/docs/apps/x509v3_config.html#ARBITRARY_EXTENSIONS}{OpenSSL's arbitrary extension format}.
362
363\subsubsection[\fn{extension.interpose}]{\fn{extension.interpose($name$, $function$)}}
364
365Add or interpose an extension class method. Returns the previous method, if any.
366
367\end{Module}
368
369
354\begin{Module}{openssl.x509} 370\begin{Module}{openssl.x509}
355 371
356Binds the X.509 certificate OpenSSL ASN.1 object. 372Binds the X.509 certificate OpenSSL ASN.1 object.
@@ -455,6 +471,10 @@ Returns the basic constraints critical flag as a boolean.
455 471
456Sets the basic constraints critical flag. 472Sets the basic constraints critical flag.
457 473
474\subsubsection[\fn{x509:addExtension}]{\fn{x509:addExtension($ext$)}}
475
476Adds \module{x509.extension} object to the certificate.
477
458\subsubsection[\fn{x509:isIssuedBy}]{\fn{x509:isIssuedBy($issuer$)}} 478\subsubsection[\fn{x509:isIssuedBy}]{\fn{x509:isIssuedBy($issuer$)}}
459 479
460Returns a boolean according to whether the specified issuer---an \module{openssl.x509.name} object---signed the instance certificate. 480Returns a boolean according to whether the specified issuer---an \module{openssl.x509.name} object---signed the instance certificate.
@@ -471,6 +491,10 @@ Sets the public key component referenced by the \module{openssl.pkey} object $ke
471 491
472Signs and updates the instance certificate using the \module{openssl.pkey} $key$. $type$ is an optional string describing the digest type. See \module{pkey:sign}, regarding which types of digests are valid. If $type$ is omitted than a default type is used---``sha1'' for RSA keys, ``dss1'' for DSA keys, and ``ecdsa-with-SHA1'' for EC keys. 492Signs and updates the instance certificate using the \module{openssl.pkey} $key$. $type$ is an optional string describing the digest type. See \module{pkey:sign}, regarding which types of digests are valid. If $type$ is omitted than a default type is used---``sha1'' for RSA keys, ``dss1'' for DSA keys, and ``ecdsa-with-SHA1'' for EC keys.
473 493
494\subsubsection[\fn{x509:text}]{\fn{x509:text()}}
495
496Returns a human-readable textual representation of the X.509 certificate.
497
474\subsubsection[\fn{x509:\_\_tostring}]{\fn{x509:\_\_tostring}} 498\subsubsection[\fn{x509:\_\_tostring}]{\fn{x509:\_\_tostring}}
475 499
476Returns the PEM encoded representation of the instance certificate. 500Returns the PEM encoded representation of the instance certificate.
@@ -494,7 +518,7 @@ Add or interpose a request class method. Returns the previous method, if any.
494 518
495Returns the X.509 version of the request. 519Returns the X.509 version of the request.
496 520
497\subsubsection[\fn{car:setVersion}]{\fn{csr:setVersion($number$)}} 521\subsubsection[\fn{csr:setVersion}]{\fn{csr:setVersion($number$)}}
498 522
499Sets the X.509 version of the request. 523Sets the X.509 version of the request.
500 524
@@ -504,7 +528,7 @@ Returns the subject distinguished name as an \module{x509.name} object.
504 528
505\subsubsection[\fn{csr:setSubject}]{\fn{csr:setSubject($name$)}} 529\subsubsection[\fn{csr:setSubject}]{\fn{csr:setSubject($name$)}}
506 530
507Sets the subject distinguished name. 531Sets the subject distinguished name. $name$ should be an \module{x509.name} object.
508 532
509\subsubsection[\fn{csr:getPublicKey}]{\fn{csr:getPublicKey()}} 533\subsubsection[\fn{csr:getPublicKey}]{\fn{csr:getPublicKey()}}
510 534
@@ -514,7 +538,7 @@ Returns the public key component as an \module{openssl.pkey} object.
514 538
515Sets the public key component referenced by the \module{openssl.pkey} object $key$. 539Sets the public key component referenced by the \module{openssl.pkey} object $key$.
516 540
517\subsubsection[\fn{car:sign}]{\fn{csr:sign($key$)}} 541\subsubsection[\fn{csr:sign}]{\fn{csr:sign($key$)}}
518 542
519Signs the instance request using the \module{openssl.pkey} $key$. 543Signs the instance request using the \module{openssl.pkey} $key$.
520 544
@@ -525,6 +549,69 @@ Returns the PEM encoded representation of the instance request.
525\end{Module} 549\end{Module}
526 550
527 551
552\begin{Module}{openssl.x509.crl}
553
554Binds the X.509 certificate revocation list OpenSSL ASN.1 object.
555
556\subsubsection[\fn{crl.new}]{\fn{crl.new([$string$[, $format$]])}}
557
558Returns a new CRL object, optionally initialized to the specified PEM- or DER-encoded CRL $string$. $format$ is as described in \fn{openssl.pkey.new}---``PEM'', ``DER'', or ``*'' (default).
559
560\subsubsection[\fn{crl.interpose}]{\fn{crl.interpose($name$, $function$)}}
561
562Add or interpose a request class method. Returns the previous method, if any.
563
564\subsubsection[\fn{crl:getVersion}]{\fn{crl:getVersion()}}
565
566Returns the CRL version.
567
568\subsubsection[\fn{crl:setVersion}]{\fn{crl:setVersion($number$)}}
569
570Sets the CRL version.
571
572\subsubsection[\fn{crl:getLastUpdate}]{\fn{crl:getLastUpdate()}}
573
574Returns the Last Update time of the CRL as a Unix timestamp, or $nil$ if not set.
575
576\subsubsection[\fn{crl:setLastUpdate}]{\fn{crl:setLastUpdate($time$)}}
577
578Sets the Last Update time of the CRL. $time$ should be a Unix timestamp.
579
580\subsubsection[\fn{crl:getNextUpdate}]{\fn{crl:getNextUpdate()}}
581
582Returns the Next Update time of the CRL as a Unix timestamp, or $nil$ if not set.
583
584\subsubsection[\fn{crl:setNextUpdate}]{\fn{crl:setNextUpdate($time$)}}
585
586Sets the Next Update time of the CRL. $time$ should be a Unix timestamp.
587
588\subsubsection[\fn{crl:getIssuer}]{\fn{crl:getIssuer()}}
589
590Returns the issuer distinguished name as an \module{x509.name} object.
591
592\subsubsection[\fn{crl:setIssuer}]{\fn{crl:setIssuer($name$)}}
593
594Sets the issuer distinguished name. $name$ should be an \module{x509.name} object.
595
596\subsubsection[\fn{crl:add}]{\fn{crl:add($serial$ [, $time$])}}
597
598Add the certificate identified by $serial$ to the revocation list. $serial$ should be a \module{openssl.bignum} object, as returned by \fn{x509:getSerial}. $time$ is the revocation date as a Unix timestamp. If unspecified $time$ defaults to the current time.
599
600\subsubsection[\fn{crl:sign}]{\fn{crl:sign($key$)}}
601
602Signs the instance CRL using the \module{openssl.pkey} $key$.
603
604\subsubsection[\fn{crl:text}]{\fn{crl:text()}}
605
606Returns a human-readable textual representation of the instance CRL.
607
608\subsubsection[\fn{crl:\_\_tostring}]{\fn{crl:\_\_tostring}}
609
610Returns the PEM encoded representation of the instance CRL.
611
612\end{Module}
613
614
528\begin{Module}{openssl.x509.chain} 615\begin{Module}{openssl.x509.chain}
529 616
530Binds the ``STACK\_OF(X509)'' OpenSSL object, principally used in the OpenSSL library for representing a validation chain. 617Binds the ``STACK\_OF(X509)'' OpenSSL object, principally used in the OpenSSL library for representing a validation chain.
@@ -571,23 +658,34 @@ Returns two values. The first is a boolean value for whether the specified certi
571\end{Module} 658\end{Module}
572 659
573 660
661\begin{Module}{openssl.pkcs12}
662
663Binds the PKCS \#12 container OpenSSL object.
664
665\subsubsection[\fn{pkcs12.new}]{\fn{pkcs12.new\{ $\ldots$ \}}}
666
667Returns a new PKCS12 object initialized according to the named parameters---$password$, $key$, $certs$.
668
669FIXME.
670
671\subsubsection[\fn{pkcs12.interpose}]{\fn{pkcs12.interpose($name$, $function$)}}
672
673Add or interpose a store class method. Returns the previous method, if any.
674
675\subsubsection[\fn{pkcs12:\_\_tostring}]{\fn{pkcs12:\_\_tostring()}}
676
677Returns a PKCS \#12 binary encoded string.
678
679\end{Module}
680
681
574\begin{Module}{openssl.ssl.context} 682\begin{Module}{openssl.ssl.context}
575 683
576Binds the ``SSL\_CTX'' OpenSSL object, used as a configuration prototype for SSL connection instances. See \method{socket.starttls}. 684Binds the ``SSL\_CTX'' OpenSSL object, used as a configuration prototype for SSL connection instances. See \method{socket.starttls}.
577 685
578\subsubsection[\fn{context[]}]{\fn{context[]}} 686\subsubsection[\fn{context[]}]{\fn{context[]}}
579 687
580A table mapping bitwise flags to names. 688A table mapping OpenSSL named constants. The available constants are documented with the relevant method.
581
582\begin{tabular}{ c | l }
583name & description \\\hline
584VERIFY\_NONE & disable client peer certificate verification \\
585VERIFY\_PEER & enable client peer certificate verification \\
586VERIFY\_FAIL\_IF\_NO\_PEER\_CERT & require a peer certificate \\
587VERIFY\_CLIENT\_ONCE & do not request peer certificates after initial handshake
588\end{tabular}
589
590See the \href{http://www.openssl.org/docs/ssl/SSL_CTX_set_verify.html#NOTES}{NOTES section} in the OpenSSL documentation for \fn{SSL\_CTX\_set\_verify\_mode}.
591 689
592\subsubsection[\fn{context.new}]{\fn{context.new([$protocol$][, $server$])}} 690\subsubsection[\fn{context.new}]{\fn{context.new([$protocol$][, $server$])}}
593 691
@@ -597,18 +695,70 @@ Returns a new context object. $protocol$ is an optional string identifier select
597 695
598Add or interpose a context class method. Returns the previous method, if any. 696Add or interpose a context class method. Returns the previous method, if any.
599 697
600\subsubsection[\fn{context:setStore}]{\fn{context:setStore($store$)}} 698\subsubsection[\fn{context:setOptions}]{\fn{context:setOptions($flags$)}}
601 699
602Sets the \module{openssl.x509.store} of the context instance. 700Sets the option flags of the context instance. $flags$ is a bit-wise set of option flags to be ORd with the current set. The resultant option flags of the context instance will be the union of the old and new flags.\footnote{This idiosyncratic union behavior is how the OpenSSL routine works.}
603 701
604\subsubsection[\fn{context:getVerify}]{\fn{context:getVerify()}} 702\begin{ctabular}{ c | p{8cm} }
703name & description \\\hline
704\small{\texttt{OP\_MICROSOFT\_SESS\_ID\_BUG}} & When talking SSLv2, if session-id reuse is performed, the session-id passed back in the server-finished message is different from the one decided upon. \\
705\small{\texttt{OP\_NETSCAPE\_CHALLENGE\_BUG}} & Netscape-Commerce/1.12, when talking SSLv2, accepts a 32 byte challenge but then appears to only use 16 bytes when generating the encryption keys. According to the SSLv3 spec, one should use 32 bytes for the challenge when operating in SSLv2/v3 compatibility mode, but as mentioned above, this breaks this server so 16 bytes is the way to go. \\
706\small{\texttt{OP\_LEGACY\_SERVER\_CONNECT}} & $\ldots$ \\
707\small{\texttt{OP\_NETSCAPE\_REUSE\_CIPHER\_CHANGE\_BUG}} & As of OpenSSL 0.9.8q and 1.0.0c, this option has no effect. \\
708\small{\texttt{OP\_MICROSOFT\_BIG\_SSLV3\_BUFFER}} & $\ldots$ \\
709\small{\texttt{OP\_SSLEAY\_080\_CLIENT\_DH\_BUG}} & $\ldots$ \\
710\small{\texttt{OP\_TLS\_D5\_BUG}} & $\ldots$ \\
711\small{\texttt{OP\_TLS\_BLOCK\_PADDING\_BUG}} & $\ldots$ \\
712\small{\texttt{OP\_DONT\_INSERT\_EMPTY\_FRAGMENTS}} & $\ldots$ \\
713\small{\texttt{OP\_NO\_QUERY\_MTU}} & $\ldots$ \\
714\small{\texttt{OP\_COOKIE\_EXCHANGE}} & $\ldots$ \\
715\small{\texttt{OP\_NO\_TICKET}} & $\ldots$ \\
716\small{\texttt{OP\_CISCO\_ANYCONNECT}} & $\ldots$ \\
717\small{\texttt{OP\_NO\_SESSION\_RESUMPTION\_ON\_RENEGOTIATION}} & $\ldots$ \\
718\small{\texttt{OP\_NO\_COMPRESSION}} & $\ldots$ \\
719\small{\texttt{OP\_ALLOW\_UNSAFE\_LEGACY\_RENEGOTIATION}} & $\ldots$ \\
720\small{\texttt{OP\_SINGLE\_ECDH\_USE}} & $\ldots$ \\
721\small{\texttt{OP\_SINGLE\_DH\_USE}} & $\ldots$ \\
722\small{\texttt{OP\_EPHEMERAL\_RSA}} & $\ldots$ \\
723\small{\texttt{OP\_CIPHER\_SERVER\_PREFERENCE}} & $\ldots$ \\
724\small{\texttt{OP\_TLS\_ROLLBACK\_BUG}} & $\ldots$ \\
725\small{\texttt{OP\_NO\_SSLv2}} & $\ldots$ \\
726\small{\texttt{OP\_NO\_SSLv3}} & $\ldots$ \\
727\small{\texttt{OP\_NO\_TLSv1}} & $\ldots$ \\
728\small{\texttt{OP\_NO\_TLSv1\_2}} & $\ldots$ \\
729\small{\texttt{OP\_NO\_TLSv1\_1}} & $\ldots$ \\
730\small{\texttt{OP\_NETSCAPE\_CA\_DN\_BUG}} & $\ldots$ \\
731\small{\texttt{OP\_NETSCAPE\_DEMO\_CIPHER\_CHANGE\_BUG}} & $\ldots$ \\
732\small{\texttt{OP\_CRYPTOPRO\_TLSEXT\_BUG}} & $\ldots$ \\
733\small{\texttt{OP\_ALL}} & $\ldots$ \\
734\end{ctabular}
605 735
606Returns two values: the bitwise verification mode flags, and the maximum validation depth. 736\subsubsection[\fn{context:getOptions}]{\fn{context:getOptions()}}
737
738Returns the option flags of the context instance as an integer.
739
740\subsubsection[\fn{context:clearOptions}]{\fn{context:clearOptions()}}
741
742Clears the option flags of the context instance.
607 743
608\subsubsection[\fn{context:setVerify}]{\fn{context:setVerify([$mode$][, $depth$])}} 744\subsubsection[\fn{context:setVerify}]{\fn{context:setVerify([$mode$][, $depth$])}}
609 745
610Sets the verification mode flags and maximum validation chain depth. 746Sets the verification mode flags and maximum validation chain depth.
611 747
748\begin{tabular}{ c | l }
749name & description \\\hline
750VERIFY\_NONE & disable client peer certificate verification \\
751VERIFY\_PEER & enable client peer certificate verification \\
752VERIFY\_FAIL\_IF\_NO\_PEER\_CERT & require a peer certificate \\
753VERIFY\_CLIENT\_ONCE & do not request peer certificates after initial handshake
754\end{tabular}
755
756See the \href{http://www.openssl.org/docs/ssl/SSL_CTX_set_verify.html#NOTES}{NOTES section} in the OpenSSL documentation for \fn{SSL\_CTX\_set\_verify\_mode}.
757
758\subsubsection[\fn{context:getVerify}]{\fn{context:getVerify()}}
759
760Returns two values: the bitwise verification mode flags, and the maximum validation depth.
761
612\subsubsection[\fn{context:setCertificate}]{\fn{context:setCertificate($crt$)}} 762\subsubsection[\fn{context:setCertificate}]{\fn{context:setCertificate($crt$)}}
613 763
614Sets the X.509 certificate \module{openssl.x509} object $crt$ to send during SSL connection instance handshakes. 764Sets the X.509 certificate \module{openssl.x509} object $crt$ to send during SSL connection instance handshakes.
@@ -621,6 +771,14 @@ Sets the private key \module{openssl.pkey} object $key$ for use during SSL conne
621 771
622Sets the allowed public key and private key algorithms. The string format is documented in the \href{http://www.openssl.org/docs/apps/ciphers.html#CIPHER_LIST_FORMAT}{OpenSSL ciphers(1) utility documentation}. 772Sets the allowed public key and private key algorithms. The string format is documented in the \href{http://www.openssl.org/docs/apps/ciphers.html#CIPHER_LIST_FORMAT}{OpenSSL ciphers(1) utility documentation}.
623 773
774\subsubsection[\fn{context:setEphemeralKey}]{\fn{context:setEphemeralKey($key$)}}
775
776Sets \module{openssl.pkey} object $key$ as the ephemeral key during key exchanges which use that particular key type. Typically $key$ will be either a Diffie-Hellman or Elliptic Curve key.
777
778\emph{In order to configure an SSL server to support an ephemeral key exchange cipher suite (i.e. DHE-* and ECDHE-*), the application must explicitly set the ephemeral keys. Simply enabling the cipher suite is not sufficient. The application can statically generate Diffie-Hellman public key parameters, and many servers ship with such a key compiled into the software. Elliptic curve keys are necessarily static, and instantiated by curve name\footnote{\href{http://en.wikipedia.org/w/index.php?title=Comparison\_of\_TLS\_implementations&oldid=629779090\#Supported\_elliptic\_curves}{According to Wikipedia} the most widely supported curve is prime256v1, so to enable ECDHE-* applications can simply do \texttt{ctx:setEphemeralKey(pkey.new\{ type = ``EC'', curve = ``prime256v1'' \})}. To achieve Perfect Forward Secrecy for ECDHE-*, applications must also do \texttt{ctx:setOptions(context.OP\_SINGLE\_ECDH\_USE)}. The \texttt{ctx} object must then be used to configure each SSL session, such as by passing it to \fn{cqueues.socket:starttls()}.}.}
779
780\emph{In addition, to attain Perfect Forward Secrecy the options \texttt{OP\_SINGLE\_DH\_USE} and \texttt{OP\_SINGLE\_ECDH\_USE} must be set so that OpenSSL discards and regenerates the secret keying parameters for each key exchange.}
781
624\end{Module} 782\end{Module}
625 783
626 784