Difference between revisions of "Unit X.509"
(3 intermediate revisions by the same user not shown) | |||
Line 5: | Line 5: | ||
---- | ---- | ||
− | '''Ultibo X.509 | + | '''Ultibo X.509 Interface unit''' |
X.509 is a standard that defines the format of public key certificates. An X.509 certificate contains a public key and an identity (a hostname, or an organization, or an individual), and is either signed by a certificate authority or self-signed. When a certificate is signed by a trusted certificate authority, or validated by other means, someone holding that certificate can rely on the public key it contains to establish secure communications with another party, or validate documents digitally signed by the corresponding private key. | X.509 is a standard that defines the format of public key certificates. An X.509 certificate contains a public key and an identity (a hostname, or an organization, or an individual), and is either signed by a certificate authority or self-signed. When a certificate is signed by a trusted certificate authority, or validated by other means, someone holding that certificate can rely on the public key it contains to establish secure communications with another party, or validate documents digitally signed by the corresponding private key. | ||
Line 139: | Line 139: | ||
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | |colspan="2"|Note: RFC5280 Section 4.2.1.3. - Key Usage | ||
|- | |- | ||
| <code>X509_KEY_USAGE_DIGITAL_SIGNATURE = (1 shl 0);</code> | | <code>X509_KEY_USAGE_DIGITAL_SIGNATURE = (1 shl 0);</code> | ||
− | | | + | | digitalSignature - The digitalSignature bit is asserted when the subject public key is used for verifying digital signatures, other than signatures on certificates. |
|- | |- | ||
| <code>X509_KEY_USAGE_NON_REPUDIATION = (1 shl 1);</code> | | <code>X509_KEY_USAGE_NON_REPUDIATION = (1 shl 1);</code> | ||
− | | | + | | nonRepudiation - The nonRepudiation bit is asserted when the subject public key is used to verify digital signatures, other than signatures on certificates. |
|- | |- | ||
| <code>X509_KEY_USAGE_KEY_ENCIPHERMENT = (1 shl 2);</code> | | <code>X509_KEY_USAGE_KEY_ENCIPHERMENT = (1 shl 2);</code> | ||
− | | | + | | keyEncipherment - The keyEncipherment bit is asserted when the subject public key is used for enciphering private or secret keys, i.e., for key transport |
|- | |- | ||
| <code>X509_KEY_USAGE_DATA_ENCIPHERMENT = (1 shl 3);</code> | | <code>X509_KEY_USAGE_DATA_ENCIPHERMENT = (1 shl 3);</code> | ||
− | | | + | | dataEncipherment - The dataEncipherment bit is asserted when the subject public key is used for directly enciphering raw user data without the use of an intermediate symmetric cipher. |
|- | |- | ||
| <code>X509_KEY_USAGE_KEY_AGREEMENT = (1 shl 4);</code> | | <code>X509_KEY_USAGE_KEY_AGREEMENT = (1 shl 4);</code> | ||
− | | | + | | keyAgreement - The keyAgreement bit is asserted when the subject public key is used for key agreement |
|- | |- | ||
| <code>X509_KEY_USAGE_KEY_CERT_SIGN = (1 shl 5);</code> | | <code>X509_KEY_USAGE_KEY_CERT_SIGN = (1 shl 5);</code> | ||
− | | | + | | keyCertSign - The keyCertSign bit is asserted when the subject public key is used for verifying signatures on public key certificates |
|- | |- | ||
| <code>X509_KEY_USAGE_CRL_SIGN = (1 shl 6);</code> | | <code>X509_KEY_USAGE_CRL_SIGN = (1 shl 6);</code> | ||
− | | | + | | cRLSign - The cRLSign bit is asserted when the subject public key is used for verifying signatures on certificate revocation lists |
|- | |- | ||
| <code>X509_KEY_USAGE_ENCIPHER_ONLY = (1 shl 7);</code> | | <code>X509_KEY_USAGE_ENCIPHER_ONLY = (1 shl 7);</code> | ||
− | | | + | | encipherOnly - When the encipherOnly bit is asserted and the keyAgreement bit is also set, the subject public key may be used only for enciphering data while performing key agreement. |
|- | |- | ||
| <code>X509_KEY_USAGE_DECIPHER_ONLY = (1 shl 8);</code> | | <code>X509_KEY_USAGE_DECIPHER_ONLY = (1 shl 8);</code> | ||
− | | | + | | decipherOnly - When the decipherOnly bit is asserted and the keyAgreement bit is also set, the subject public key may be used only for deciphering data while performing key agreement. |
|- | |- | ||
|} | |} | ||
</div></div> | </div></div> | ||
− | <br /> | + | <br /> |
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;"> | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;"> | ||
<div style="font-size: 14px; padding-left: 12px;">'''X509 certificate extended key usage''' <code> X509_EXT_KEY_USAGE_* </code></div> | <div style="font-size: 14px; padding-left: 12px;">'''X509 certificate extended key usage''' <code> X509_EXT_KEY_USAGE_* </code></div> | ||
Line 175: | Line 177: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | | <code>X509_EXT_KEY_USAGE_ANY = (1 shl 0);</code> | + | | <code>X509_EXT_KEY_USAGE_ANY = (1 shl 0);</code> |
| style="width: 50%;"| | | style="width: 50%;"| | ||
|- | |- | ||
Line 185: | Line 187: | ||
|- | |- | ||
| <code>X509_EXT_KEY_USAGE_OCSP = (1 shl 3);</code> | | <code>X509_EXT_KEY_USAGE_OCSP = (1 shl 3);</code> | ||
+ | | | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;"> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''X509 certificate file types''' <code> NAME_* </code></div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | | <code>X509_FILETYPE_PEM = 1;</code> | ||
+ | | style="width: 50%;"| | ||
+ | |- | ||
+ | | <code>X509_FILETYPE_ASN1 = 2;</code> | ||
| | | | ||
|- | |- | ||
Line 284: | Line 300: | ||
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | | <code>Algorithm:TX509AlgorithmIdentifier;</code> | ||
+ | | style="width: 50%;"| | ||
+ | |- | ||
+ | | <code>Key:PByte;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>Length:Integer;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>procedure Release;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function ToString:String;</code> | ||
+ | | | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | |||
+ | '''X509 private key''' | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"> | ||
+ | <code>PX509PrivateKey = ^TX509PrivateKey;</code> | ||
+ | |||
+ | <code>TX509PrivateKey = record</code> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | |colspan="2"|Note: RFC3447 - Appendix A.1.2 - RSA private key syntax | ||
+ | |- | ||
+ | |colspan="2"| | ||
|- | |- | ||
| <code>Algorithm:TX509AlgorithmIdentifier;</code> | | <code>Algorithm:TX509AlgorithmIdentifier;</code> | ||
Line 481: | Line 532: | ||
− | '''X509 | + | '''X509 specific classes''' |
− | + | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;" | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
|- | |- | ||
− | | | + | | [[TX509Name|<code>TX509Name = class(TObject)</code>]] |
− | + | ||
− | | <code> | + | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
|- | |- | ||
|} | |} | ||
− | + | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;" | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
|- | |- | ||
− | | | + | | [[TX509CertificateList|<code>TX509CertificateList = class(TObject)</code>]] |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
|- | |- | ||
|} | |} | ||
− | + | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;" | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
|- | |- | ||
− | | | + | | [[TX509CertificateChain|<code>TX509CertificateChain = class(TObject)</code>]] |
− | + | ||
− | | <code> | + | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
|- | |- | ||
|} | |} | ||
− | + | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;" | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
|- | |- | ||
− | | | + | | [[TX509Certificate|<code>TX509Certificate = class(TObject)</code>]] |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | | <code> | + | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
|- | |- | ||
|} | |} | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
<br /> | <br /> | ||
Latest revision as of 04:48, 31 August 2021
Return to Unit Reference
Contents
[hide]Description
Ultibo X.509 Interface unit
X.509 is a standard that defines the format of public key certificates. An X.509 certificate contains a public key and an identity (a hostname, or an organization, or an individual), and is either signed by a certificate authority or self-signed. When a certificate is signed by a trusted certificate authority, or validated by other means, someone holding that certificate can rely on the public key it contains to establish secure communications with another party, or validate documents digitally signed by the corresponding private key.
This unit currently only provides the basic functionality required to read and parse an X.509 certificate in DER or PEM format and extract basic information such as the issuer, subject, validity, algorithm and public key.
It is expected that this unit will be expanded to incorporate additional functions over time.
Constants
X509_*
X509_NAME_ATTR_*
X509_VALIDATE_*
X509_CERT_V*
X509_EXT_*
X509_KEY_USAGE_*
X509_EXT_KEY_USAGE_*
NAME_*
Type definitions
X509 serial number
X509 name attribute
X509 name attributes
PX509NameAttributes = ^TX509NameAttributes;
TX509NameAttributes = array[0..X509_MAX_NAME_ATTRIBUTES - 1] of TX509NameAttribute;
X509 algorithm identifier
X509 public key
X509 private key
X509 signature
X509 RSA public key
X509 RSA private key
X509 ECDSA public key
X509 ECDSA private key
Class definitions
X509 specific classes
TX509Name = class(TObject)
|
TX509CertificateList = class(TObject)
|
TX509CertificateChain = class(TObject)
|
TX509Certificate = class(TObject)
|
Public variables
None defined
Function declarations
X509 helper functions
function X509NameAttributeTypeToString(AType:LongWord):String;
Return to Unit Reference