|
|
Line 532: |
Line 532: |
| | | |
| | | |
− | '''X509 name''' | + | '''X509 specific classes''' |
| | | |
− | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
| + | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;" |
− | | + | |
− | <code>TX509Name = class(TObject)</code>
| + | |
− | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
| + | |
− | {| class="wikitable" style="font-size: 14px; background: white;"
| + | |
| |- | | |- |
− | |colspan="2"|<div style="font-family: monospace,courier;">'''private'''</div> | + | | [[TX509Name|<code>TX509Name = class(TObject)</code>]] |
− | |-
| + | |
− | | <code>function StringCompare(const AValue1,AValue2:String):Integer;</code> | + | |
− | |
| + | |
− | |-
| + | |
− | |colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
| + | |
− | |-
| + | |
− | | <code>NameAttributes:TX509NameAttributes;</code>
| + | |
− | |
| + | |
− | |-
| + | |
− | | <code>NameAttributeCount:LongWord;</code>
| + | |
− | |
| + | |
− | |-
| + | |
− | |colspan="2"|
| + | |
− | |-
| + | |
− | | <code>Email:String;</code>
| + | |
− | | emailAddress
| + | |
− | |-
| + | |
− | |colspan="2"|''From subjectAltName extension''
| + | |
− | |-
| + | |
− | | <code>AltEmail:String;</code>
| + | |
− | | rfc822Name
| + | |
− | |-
| + | |
− | | <code>DNS:String;</code>
| + | |
− | | dNSName
| + | |
− | |-
| + | |
− | | <code>URI:String;</code>
| + | |
− | | uniformResourceIdentifier
| + | |
− | |-
| + | |
− | | <code>IP:PByte;</code>
| + | |
− | | iPAddress
| + | |
− | |-
| + | |
− | | <code>IPLen:Longword;</code>
| + | |
− | | IPv4 = 4,IPv6 = 16
| + | |
− | |-
| + | |
− | | <code>RegisteredID:TASN1OID;</code>
| + | |
− | | registeredID
| + | |
− | |-
| + | |
− | |colspan="2"|
| + | |
− | |-
| + | |
− | | <code>destructor Destroy; override;</code>
| + | |
− | |
| + | |
− | |-
| + | |
− | |colspan="2"|
| + | |
− | |-
| + | |
− | | <code>function GetCN:String;</code>
| + | |
− | |
| + | |
− | |-
| + | |
− | | <code>function GetDN:String;</code>
| + | |
− | |
| + | |
− | |-
| + | |
− | |colspan="2"|
| + | |
− | |-
| + | |
− | | <code>function Compare(AName:TX509Name):Integer;</code>
| + | |
− | |
| + | |
| |- | | |- |
| |} | | |} |
− | </div></div>
| + | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;" |
− |
| + | |
− | '''X509 certificate'''
| + | |
− |
| + | |
− | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
| + | |
− | | + | |
− | <code>TX509Certificate = class;</code>
| + | |
− | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
| + | |
− | {| class="wikitable" style="font-size: 14px; background: white;"
| + | |
| |- | | |- |
− | |colspan="2"|<div style="font-family: monospace,courier;">'''private'''</div> | + | | [[TX509CertificateList|<code>TX509CertificateList = class(TObject)</code>]] |
− | |-
| + | |
− | |colspan="2"|
| + | |
− | |-
| + | |
− | |colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
| + | |
− | |-
| + | |
− | |colspan="2"|
| + | |
| |- | | |- |
| |} | | |} |
− | </div></div>
| + | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;" |
− |
| + | |
− | '''X509 certificate list'''
| + | |
− | | + | |
− | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
| + | |
− | | + | |
− | <code>TX509CertificateList = class(TObject)</code>
| + | |
− | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
| + | |
− | {| class="wikitable" style="font-size: 14px; background: white;"
| + | |
| |- | | |- |
− | |colspan="2"|<div style="font-family: monospace,courier;">'''protected'''</div> | + | | [[TX509CertificateChain|<code>TX509CertificateChain = class(TObject)</code>]] |
− | |-
| + | |
− | | <code>FList:TList;</code> | + | |
− | | style="width: 50%;"|
| + | |
− | |-
| + | |
− | | <code>FLock: TCriticalSectionHandle;</code>
| + | |
− | |
| + | |
− | |-
| + | |
− | |colspan="2"|
| + | |
− | |-
| + | |
− | | <code>procedure Clear;</code>
| + | |
− | |
| + | |
− | |-
| + | |
− | |colspan="2"|
| + | |
− | |-
| + | |
− | | <code>function AcquireLock:Boolean;</code>
| + | |
− | |
| + | |
− | |-
| + | |
− | | <code>function ReleaseLock:Boolean;</code>
| + | |
− | |
| + | |
− | |-
| + | |
− | |colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
| + | |
− | |-
| + | |
− | | <code>constructor Create;</code>
| + | |
− | |
| + | |
− | |-
| + | |
− | | <code>destructor Destroy; override;</code>
| + | |
− | |
| + | |
− | |-
| + | |
− | |colspan="2"|
| + | |
− | |-
| + | |
− | | <code>function First:TX509Certificate; virtual;</code>
| + | |
− | |
| + | |
− | |-
| + | |
− | | <code>function Last:TX509Certificate; virtual;</code>
| + | |
− | |
| + | |
− | |-
| + | |
− | |colspan="2"|
| + | |
− | |-
| + | |
− | | <code>function Prev(ACertificate:TX509Certificate):TX509Certificate; virtual;</code>
| + | |
− | |
| + | |
− | |-
| + | |
− | | <code>function Next(ACertificate:TX509Certificate):TX509Certificate; virtual;</code>
| + | |
− | |
| + | |
− | |-
| + | |
− | |colspan="2"|
| + | |
− | |-
| + | |
− | | <code>function Add(ACertificate:TX509Certificate):Boolean; virtual;</code>
| + | |
− | |
| + | |
− | |-
| + | |
− | | <code>function Remove(ACertificate:TX509Certificate):Boolean; virtual;</code>
| + | |
− | |
| + | |
− | |-
| + | |
− | |colspan="2"|
| + | |
− | |-
| + | |
− | | <code>function FindByIssuer(AName:TX509Name):TX509Certificate; virtual;</code>
| + | |
− | |
| + | |
− | |-
| + | |
− | | <code>function FindBySubject(AName:TX509Name):TX509Certificate; virtual;</code>
| + | |
− | |
| + | |
− | |-
| + | |
− | |colspan="2"|
| + | |
− | |-
| + | |
− | | <code>function ImportDER(ABuffer:Pointer; ASize:Integer):TX509Certificate; virtual;</code>
| + | |
− | |
| + | |
− | |-
| + | |
− | | <code>function ImportPEM(ABuffer:Pointer; var ASize:Integer):TX509Certificate; virtual;</code>
| + | |
− | |
| + | |
− | |-
| + | |
− | |colspan="2"|
| + | |
− | |-
| + | |
− | | <code>function ExportDER(ABuffer:Pointer; var ASize:Integer; ACertificate:TX509Certificate):Boolean; virtual;</code>
| + | |
− | |
| + | |
− | |-
| + | |
− | | <code>function ExportPEM(ABuffer:Pointer; var ASize:Integer; AStart:TX509Certificate):Boolean; virtual;</code>
| + | |
− | |
| + | |
| |- | | |- |
| |} | | |} |
− | </div></div>
| + | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;" |
− | | + | |
− | '''X509 certificate chain'''
| + | |
− | | + | |
− | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
| + | |
− | | + | |
− | <code>TX509CertificateChain = class(TObject)</code>
| + | |
− | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
| + | |
− | {| class="wikitable" style="font-size: 14px; background: white;" | + | |
− | |-
| + | |
− | |colspan="2"|<div style="font-family: monospace,courier;">'''protected'''</div>
| + | |
− | |-
| + | |
− | | <code>FRoot:TX509Certificate;</code>
| + | |
− | | style="width: 50%;"|
| + | |
− | |-
| + | |
− | | <code>FLock: TCriticalSectionHandle;</code>
| + | |
− | |
| + | |
− | |-
| + | |
− | |colspan="2"|
| + | |
− | |-
| + | |
− | | <code>procedure Clear; virtual;</code>
| + | |
− | |
| + | |
− | |-
| + | |
− | |colspan="2"|
| + | |
− | |-
| + | |
− | | <code>function AcquireLock:Boolean;</code>
| + | |
− | |
| + | |
− | |-
| + | |
− | | <code>function ReleaseLock:Boolean;</code>
| + | |
− | |
| + | |
− | |-
| + | |
− | |colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
| + | |
− | |-
| + | |
− | | <code>property Root:TX509Certificate read FRoot;</code>
| + | |
− | |
| + | |
− | |-
| + | |
− | |colspan="2"|
| + | |
− | |-
| + | |
− | | <code>constructor Create(ARoot:TX509Certificate); virtual;</code>
| + | |
− | |
| + | |
− | |-
| + | |
− | | <code>destructor Destroy; override;</code>
| + | |
− | |
| + | |
− | |-
| + | |
− | |colspan="2"|
| + | |
− | |-
| + | |
− | | <code>function Last:TX509Certificate; virtual;</code>
| + | |
− | |
| + | |
− | |-
| + | |
− | |colspan="2"|
| + | |
− | |-
| + | |
− | | <code>function Prev(ACertificate:TX509Certificate):TX509Certificate; virtual;</code>
| + | |
− | |
| + | |
− | |-
| + | |
− | | <code>function Next(ACertificate:TX509Certificate):TX509Certificate; virtual;</code>
| + | |
− | |
| + | |
− | |-
| + | |
− | |colspan="2"|
| + | |
− | |-
| + | |
− | | <code>function InsertAfter(AParent,ACertificate:TX509Certificate):Boolean; virtual;</code>
| + | |
− | |
| + | |
− | |-
| + | |
− | | <code>function InsertBefore(AChild,ACertificate:TX509Certificate):Boolean; virtual;</code>
| + | |
− | |
| + | |
− | |-
| + | |
− | | <code>function Remove(ACertificate:TX509Certificate):Boolean; virtual;</code>
| + | |
− | |
| + | |
− | |-
| + | |
− | |colspan="2"|
| + | |
− | |-
| + | |
− | | <code>function FindByIssuer(AName:TX509Name):TX509Certificate; virtual;</code>
| + | |
− | |
| + | |
− | |-
| + | |
− | | <code>function FindBySubject(AName:TX509Name):TX509Certificate; virtual;</code>
| + | |
− | |
| + | |
− | |-
| + | |
− | |colspan="2"|
| + | |
− | |-
| + | |
− | | <code>function FindBySubjectCN(const AName:String):TX509Certificate; virtual;</code>
| + | |
− | |
| + | |
− | |-
| + | |
− | | <code>function FindBySubjectDN(const AName:String):TX509Certificate; virtual;</code>
| + | |
− | |
| + | |
− | |-
| + | |
− | |colspan="2"|
| + | |
− | |-
| + | |
− | | <code>function ImportDER(ABuffer:Pointer; ASize:Integer; AParent:TX509Certificate):TX509Certificate; virtual;</code>
| + | |
− | |
| + | |
− | |-
| + | |
− | | <code>function ImportPEM(ABuffer:Pointer; var ASize:Integer; AParent:TX509Certificate):TX509Certificate; virtual;</code>
| + | |
− | |
| + | |
− | |-
| + | |
− | |colspan="2"|
| + | |
− | |-
| + | |
− | | <code>function ExportDER(ABuffer:Pointer; var ASize:Integer; ACertificate:TX509Certificate):Boolean; virtual;</code>
| + | |
− | |
| + | |
− | |-
| + | |
− | | <code>function ExportPEM(ABuffer:Pointer; var ASize:Integer; AStart:TX509Certificate):Boolean; virtual;</code>
| + | |
− | |
| + | |
− | |-
| + | |
− | |colspan="2"|
| + | |
− | |-
| + | |
− | | <code>function GetPathLength(ACertificate:TX509Certificate):LongWord; virtual;</code>
| + | |
− | |
| + | |
− | |-
| + | |
− | |colspan="2"|
| + | |
− | |-
| + | |
− | | <code>function ValidateChain(ATrust:TX509CertificateList):Integer; virtual;</code>
| + | |
− | |
| + | |
− | |-
| + | |
− | |}
| + | |
− | </div></div>
| + | |
− |
| + | |
− | '''X509 certificate'''
| + | |
− | | + | |
− | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
| + | |
− | | + | |
− | <code>TX509Certificate = class(TObject)</code>
| + | |
− | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
| + | |
− | {| class="wikitable" style="font-size: 14px; background: white;"
| + | |
− | |-
| + | |
− | |colspan="2"|<div style="font-family: monospace,courier;">'''protected'''</div>
| + | |
− | |-
| + | |
− | | <code>FList:TX509CertificateList;</code>
| + | |
− | |
| + | |
− | |-
| + | |
− | | <code>FChain:TX509CertificateChain;</code>
| + | |
− | |
| + | |
− | |-
| + | |
− | |colspan="2"|
| + | |
− | |-
| + | |
− | | <code>FParent:TX509Certificate;</code>
| + | |
− | |
| + | |
− | |-
| + | |
− | | <code>FChild:TX509Certificate;</code>
| + | |
− | |
| + | |
− | |-
| + | |
− | |colspan="2"|
| + | |
− | |-
| + | |
− | | <code>FData:PByte;</code>
| + | |
− | | Copy of certificate data from import
| + | |
− | |-
| + | |
− | | <code>FSize:LongWord;</code>
| + | |
− | | Total size of certificate data
| + | |
− | |-
| + | |
− | |colspan="2"|
| + | |
− | |-
| + | |
− | | <code>FTBSData:PByte;</code>
| + | |
− | | Pointer to start of TBS (To Be Signed) data
| + | |
− | |-
| + | |
− | | <code>FTBSSize:LongWord;</code>
| + | |
− | | Length of TBS (To Be Signed) data
| + | |
− | |-
| + | |
− | |colspan="2"|
| + | |
− | |-
| + | |
− | | <code>function ImportTime(ABuffer:PByte; ASize:Integer; ATag:LongWord ADateTime:TDateTime):Boolean;</code>
| + | |
− | |
| + | |
− | |-
| + | |
− | |colspan="2"|
| + | |
− | |-
| + | |
− | | <code>function ImportName(ABuffer:PByte; ASize:Integer; AName:TX509Name; var ANext:PByte):Boolean;</code>
| + | |
− | |
| + | |
− | |-
| + | |
− | | <code>function ImportExtensionAltName(ABuffer:PByte; ASize:Integer; AName:TX509Name):Boolean;</code>
| + | |
− | |
| + | |
− | |-
| + | |
− | |colspan="2"|
| + | |
− | |-
| + | |
− | | <code>function ImportAlgorithmIdentifier(ABuffer:PByte; ASize:Integer; var AIdentifier:TX509AlgorithmIdentifier; var ANext:PByte):Boolean;</code>
| + | |
− | |
| + | |
− | |-
| + | |
− | |colspan="2"|
| + | |
− | |-
| + | |
− | | <code>function ImportValidity(ABuffer:PByte; ASize:Integer; var ANext:PByte):Boolean;</code>
| + | |
− | |
| + | |
− | |-
| + | |
− | |colspan="2"|
| + | |
− | |-
| + | |
− | | <code>function ImportPublicKey(ABuffer:PByte; ASize:Integer; var ANext:PByte):Boolean;</code>
| + | |
− | |
| + | |
− | |-
| + | |
− | |colspan="2"|
| + | |
− | |-
| + | |
− | | <code>function ImportExtension(ABuffer:PByte; ASize:Integer; var ANext:PByte):Boolean;</code>
| + | |
− | |
| + | |
− | |-
| + | |
− | | <code>function ImportExtensionData(ABuffer:PByte; ASize:Integer; const AOID:TASN1OID):Boolean;</code>
| + | |
− | |
| + | |
− | |-
| + | |
− | | <code>function ImportExtensionKeyUsage(ABuffer:PByte; ASize:Integer):Boolean;</code>
| + | |
− | |
| + | |
− | |-
| + | |
− | | <code>function ImportExtensionSubjectAltName(ABuffer:PByte; ASize:Integer):Boolean;</code>
| + | |
− | |
| + | |
− | |-
| + | |
− | | <code>function ImportExtensionIssuerAltName(ABuffer:PByte; ASize:Integer):Boolean;</code>
| + | |
− | |
| + | |
− | |-
| + | |
− | | <code>function ImportExtensionBasicContraints(ABuffer:PByte; ASize:Integer):Boolean;</code>
| + | |
− | |
| + | |
− | |-
| + | |
− | | <code>function ImportExtensionExtKeyUsage(ABuffer:PByte; ASize:Integer):Boolean;</code>
| + | |
− | |
| + | |
− | |-
| + | |
− | |colspan="2"|
| + | |
− | |-
| + | |
− | | <code>function ImportExtensions(ABuffer:PByte; ASize:Integer):Boolean;</code>
| + | |
− | |
| + | |
− | |-
| + | |
− | |colspan="2"|
| + | |
− | |-
| + | |
− | | <code>function ImportTBSCertificate(ABuffer:PByte; ASize:Integer; var ANext:PByte):Boolean;</code>
| + | |
− | |
| + | |
− | |-
| + | |
− | |colspan="2"|
| + | |
− | |-
| + | |
− | | <code>function VerifyRSASignature(AIssuer:TX509Certificate):Boolean;</code>
| + | |
− | |
| + | |
− | |-
| + | |
− | |colspan="2"|
| + | |
− | |-
| + | |
− | | <code>function VerifyMD5Digest(ABuffer:PByte; ASize:Integer):Boolean;</code>
| + | |
− | |
| + | |
− | |-
| + | |
− | | <code>function VerifySHA1Digest(ABuffer:PByte; ASize:Integer):Boolean;</code>
| + | |
− | |
| + | |
− | |-
| + | |
− | | <code>function VerifySHA256Digest(ABuffer:PByte; ASize:Integer):Boolean;</code>
| + | |
− | |
| + | |
− | |-
| + | |
− | | <code>function VerifySHA384Digest(ABuffer:PByte; ASize:Integer):Boolean;</code>
| + | |
− | |
| + | |
− | |-
| + | |
− | | <code>function VerifySHA512Digest(ABuffer:PByte; ASize:Integer):Boolean;</code>
| + | |
− | |
| + | |
− | |-
| + | |
− | |colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
| + | |
− | |-
| + | |
− | |colspan="2"|''Properties''
| + | |
− | |-
| + | |
− | | <code>Version:LongWord;</code>
| + | |
− | |
| + | |
− | |-
| + | |
− | | <code>SerialNumber:TX509SerialNumber;</code>
| + | |
− | |
| + | |
− | |-
| + | |
− | | <code>SignatureAlgorithm:TX509AlgorithmIdentifier;</code>
| + | |
− | |
| + | |
− | |-
| + | |
− | |colspan="2"|
| + | |
− | |-
| + | |
− | | <code>Issuer:TX509Name;</code>
| + | |
− | |
| + | |
− | |-
| + | |
− | | <code>Subject:TX509Name;</code>
| + | |
− | |
| + | |
− | |-
| + | |
− | | <code>SubjectDN:String;</code>
| + | |
− | |
| + | |
− | |-
| + | |
− | |colspan="2"|
| + | |
− | |-
| + | |
− | | <code>NotBefore:TDateTime;</code>
| + | |
− | |
| + | |
− | |-
| + | |
− | | <code>NotAfter:TDateTime;</code>
| + | |
− | |
| + | |
− | |-
| + | |
− | |colspan="2"|
| + | |
− | |-
| + | |
− | | <code>PublicKey:TX509PublicKey;</code>
| + | |
− | |
| + | |
− | |-
| + | |
− | |colspan="2"|
| + | |
− | |-
| + | |
− | | <code>Signature:TX509Signature;</code>
| + | |
− | |
| + | |
− | |-
| + | |
− | |colspan="2"|''Extensions''
| + | |
− | |-
| + | |
− | | <code>ExtensionsPresent:LongWord;</code>
| + | |
− | |
| + | |
− | |-
| + | |
− | |colspan="2"|
| + | |
− | |-
| + | |
− | | <code>CA:Boolean;</code>
| + | |
− | |
| + | |
− | |-
| + | |
− | | <code>PathLenConstraint:LongWord;</code>
| + | |
− | |
| + | |
− | |-
| + | |
− | |colspan="2"|
| + | |
− | |-
| + | |
− | | <code>KeyUsage:LongWord;</code>
| + | |
− | |
| + | |
− | |-
| + | |
− | | <code>ExtendedKeyUsage:LongWord;</code>
| + | |
− | |
| + | |
− | |-
| + | |
− | |colspan="2"|
| + | |
− | |-
| + | |
− | | <code>property List:TX509CertificateList read FList;</code>
| + | |
− | |
| + | |
− | |-
| + | |
− | | <code>property Chain:TX509CertificateChain read FChain;</code>
| + | |
− | |
| + | |
− | |-
| + | |
− | | <code>property Parent:TX509Certificate read FParent;</code>
| + | |
− | |
| + | |
− | |-
| + | |
− | | <code>property Child:TX509Certificate read FChild;</code>
| + | |
− | |
| + | |
− | |-
| + | |
− | |colspan="2"|
| + | |
− | |-
| + | |
− | | <code>constructor Create(AChain:TX509CertificateChain; AParent:TX509Certificate); virtual;</code>
| + | |
− | |
| + | |
− | |-
| + | |
− | | <code>destructor Destroy; override;</code>
| + | |
− | |
| + | |
− | |-
| + | |
− | |colspan="2"|
| + | |
− | |-
| + | |
− | | <code>function ImportDER(ABuffer:Pointer; ASize:Integer):Boolean; virtual;</code>
| + | |
− | |
| + | |
− | |-
| + | |
− | | <code>function ImportPEM(ABuffer:Pointer; var ASize:Integer):Boolean; virtual;</code>
| + | |
− | |
| + | |
− | |-
| + | |
− | |colspan="2"|
| + | |
− | |-
| + | |
− | | <code>function ExportDER(ABuffer:Pointer; var ASize:Integer):Boolean; virtual;</code>
| + | |
− | |
| + | |
− | |-
| + | |
− | | <code>function ExportPEM(ABuffer:Pointer; var ASize:Integer):Boolean; virtual;</code>
| + | |
− | |
| + | |
− | |-
| + | |
− | |colspan="2"|
| + | |
− | |-
| + | |
− | | <code>function IsValidIssuer:Boolean; virtual;</code>
| + | |
− | |
| + | |
− | |-
| + | |
− | | <code>function IsSelfSigned:Boolean; virtual;</code>
| + | |
− | |
| + | |
− | |-
| + | |
− | |colspan="2"|
| + | |
− | |-
| + | |
− | | <code>function VerifySignature(AIssuer:TX509Certificate):Boolean; virtual;</code>
| + | |
− | |
| + | |
| |- | | |- |
− | | <code>function ValidateCertificate(AIssuer:TX509Certificate):Integer; virtual;</code> | + | | [[TX509Certificate|<code>TX509Certificate = class(TObject)</code>]] |
− | |
| + | |
| |- | | |- |
| |} | | |} |
− | </div></div>
| |
| <br /> | | <br /> |
| | | |