From d63ac7c3ac6956274d9100a8e782309c3ea0efda Mon Sep 17 00:00:00 2001 From: "mauro@maurobaso.com" Date: Sat, 25 Jan 2020 00:47:01 +0100 Subject: [PATCH 01/15] Replaced PKCS7 methods with CMS ones to completely support eletronic invoice (OpenSSL 1.0.1c needed) Reference: https://security.stackexchange.com/questions/41399/openssl-pkcs7-vs-s-mime Reference: https://forum.italia.it/t/problema-decodifica-fattura-elettronica-p7m-di-e-distribuzione/12258 --- Source/OpenSSL.CMSHeaders.pas | 165 ++++++++++++++++++++++++++++++++++ Source/OpenSSL.SMIMEUtils.pas | 12 +-- Source/OpenSSL.libeay32.pas | 8 +- 3 files changed, 178 insertions(+), 7 deletions(-) create mode 100644 Source/OpenSSL.CMSHeaders.pas diff --git a/Source/OpenSSL.CMSHeaders.pas b/Source/OpenSSL.CMSHeaders.pas new file mode 100644 index 0000000..6357e39 --- /dev/null +++ b/Source/OpenSSL.CMSHeaders.pas @@ -0,0 +1,165 @@ +unit OpenSSL.CMSHeaders; + +interface + +uses + IdSSLOpenSSLHeaders; + +type + {$IFDEF DEBUG_SAFESTACK} + {$EXTERNALSYM STACK_OF_CMS_CertificateChoices} + STACK_OF_CMS_CertificateChoices = record + _stack: stack; + end; + {$EXTERNALSYM PSTACK_OF_CMS_CertificateChoices} + PSTACK_OF_CMS_CertificateChoices = ^STACK_OF_CMS_CertificateChoices; + + {$EXTERNALSYM PSTACK_OF_CMS_RevocationInfoChoice} + PSTACK_OF_CMS_RevocationInfoChoice = ^STACK_OF_CMS_RevocationInfoChoice; + {$EXTERNALSYM STACK_OF_CMS_RevocationInfoChoice} + STACK_OF_CMS_RevocationInfoChoice = record + _stack: stack; + end; + + {$EXTERNALSYM PSTACK_OF_CMS_RecipientInfo} + PSTACK_OF_CMS_RecipientInfo = ^STACK_OF_CMS_RecipientInfo; + {$EXTERNALSYM STACK_OF_CMS_RecipientInfo} + STACK_OF_CMS_RecipientInfo = record + _stack: stack; + end; + {$ELSE} + {$EXTERNALSYM PSTACK_OF_CMS_CertificateChoices} + PSTACK_OF_CMS_CertificateChoices = PSTACK; + {$EXTERNALSYM PSTACK_OF_CMS_RevocationInfoChoice} + PSTACK_OF_CMS_RevocationInfoChoice = PSTACK; + {$EXTERNALSYM PSTACK_OF_CMS_RecipientInfo} + PSTACK_OF_CMS_RecipientInfo = PSTACK; + {$ENDIF} + + {$EXTERNALSYM PCMS_EncapsulatedContentInfo} + PCMS_EncapsulatedContentInfo = ^CMS_EncapsulatedContentInfo; + {$EXTERNALSYM CMS_EncapsulatedContentInfo} + CMS_EncapsulatedContentInfo = record + eContentType: PASN1_OBJECT; + eContent: PASN1_OCTET_STRING; + // Set to 1 if incomplete structure only part set up + partial: Integer; + end; + + {$EXTERNALSYM PCMS_SignedData} + PCMS_SignedData = ^CMS_SignedData; + {$EXTERNALSYM CMS_SignedData} + CMS_SignedData = record + version: Int32; + digestAlgorithms: PSTACK_OF_X509_ALGOR; + encapContentInfo: PCMS_EncapsulatedContentInfo; + certificates: PSTACK_OF_CMS_CertificateChoices; + crls: PSTACK_OF_CMS_RevocationInfoChoice; + signerInfos: PSTACK_OF_CMS_SignerInfo; + end; + + {$EXTERNALSYM PCMS_OriginatorInfo} + PCMS_OriginatorInfo = ^CMS_OriginatorInfo; + {$EXTERNALSYM CMS_OriginatorInfo} + CMS_OriginatorInfo = record + certificates: PSTACK_OF_CMS_CertificateChoices; + crls: PSTACK_OF_CMS_RevocationInfoChoice; + end; + + {$EXTERNALSYM PCMS_EncryptedContentInfo} + PCMS_EncryptedContentInfo = ^CMS_EncryptedContentInfo; + {$EXTERNALSYM CMS_EncryptedContentInfo} + CMS_EncryptedContentInfo = record + contentType: PASN1_OBJECT; + contentEncryptionAlgorithm: PX509_ALGOR; + encryptedContent: PASN1_OCTET_STRING; + // Content encryption algorithm and key + cipher: PEVP_CIPHER; //const ? + key: PAnsiChar; + keylen: Cardinal; + //Set to 1 if we are debugging decrypt and don't fake keys for MMA + debug: Integer; + // Set to 1 if we have no cert and need extra safety measures for MMA + havenocert: Integer; + end; + + {$EXTERNALSYM PCMS_EnvelopedData} + PCMS_EnvelopedData = ^CMS_EnvelopedData; + {$EXTERNALSYM CMS_EnvelopedData} + CMS_EnvelopedData = record + version: Int32; + originatorInfo: PCMS_OriginatorInfo; + recipientInfos: PSTACK_OF_CMS_RecipientInfo; + encryptedContentInfo: PCMS_EncryptedContentInfo; + unprotectedAttrs: PSTACK_OF_X509_ATTRIBUTE; + end; + + {$EXTERNALSYM PCMS_DigestedData} + PCMS_DigestedData = ^CMS_DigestedData; + {$EXTERNALSYM CMS_DigestedData} + CMS_DigestedData = record + version: Int32; + digestAlgorithm: PX509_ALGOR; + encapContentInfo: PCMS_EncapsulatedContentInfo; + digest: PASN1_OCTET_STRING; + end; + + {$EXTERNALSYM PCMS_EncryptedData} + PCMS_EncryptedData = ^CMS_EncryptedData; + {$EXTERNALSYM CMS_EncryptedData} + CMS_EncryptedData = record + version: Int32; + encryptedContentInfo: PCMS_EncryptedContentInfo; + unprotectedAttrs: PSTACK_OF_X509_ATTRIBUTE; + end; + + {$EXTERNALSYM PCMS_AuthenticatedData} + PCMS_AuthenticatedData = ^CMS_AuthenticatedData; + {$EXTERNALSYM CMS_AuthenticatedData} + CMS_AuthenticatedData = record + version: Int32; + originatorInfo: PCMS_OriginatorInfo; + recipientInfos: PSTACK_OF_CMS_RecipientInfo; + macAlgorithm: PX509_ALGOR; + digestAlgorithm: PX509_ALGOR; + encapContentInfo: PCMS_EncapsulatedContentInfo; + authAttrs: PSTACK_OF_X509_ATTRIBUTE; + mac: PASN1_OCTET_STRING; + unauthAttrs: PSTACK_OF_X509_ATTRIBUTE; + end; + + {$EXTERNALSYM PCMS_CompressedData} + PCMS_CompressedData = ^CMS_CompressedData; + {$EXTERNALSYM CMS_CompressedData} + CMS_CompressedData = record + version: Int32; + compressionAlgorithm: PX509_ALGOR; + recipientInfos: PSTACK_OF_CMS_RecipientInfo; + encapContentInfo: PCMS_EncapsulatedContentInfo; + end; + + {$EXTERNALSYM CMS_ContentInfo_union} + CMS_ContentInfo_union = record + case Integer of + 0 : (data: PASN1_OCTET_STRING); + 1 : (signedData: PCMS_SignedData); + 2 : (envelopedData: PCMS_EnvelopedData); + 3 : (digestedData: PCMS_DigestedData); + 4 : (encryptedData: PCMS_EncryptedData); + 5 : (authenticatedData: PCMS_AuthenticatedData); + 6 : (compressedData: PCMS_CompressedData); + 7 : (other: PASN1_TYPE); + 8 : (otherData: Pointer); + end; + + {$EXTERNALSYM PCMS_ContentInfo} + PCMS_ContentInfo = ^CMS_ContentInfo; + {$EXTERNALSYM CMS_ContentInfo} + CMS_ContentInfo = record + contentType: PASN1_OBJECT; + d: CMS_ContentInfo_union; + end; + +implementation + +end. diff --git a/Source/OpenSSL.SMIMEUtils.pas b/Source/OpenSSL.SMIMEUtils.pas index 2a97537..f6db5a3 100644 --- a/Source/OpenSSL.SMIMEUtils.pas +++ b/Source/OpenSSL.SMIMEUtils.pas @@ -29,7 +29,7 @@ interface uses System.Classes, System.SysUtils, - OpenSSL.libeay32, OpenSSL.Core, IdSSLOpenSSLHeaders; + OpenSSL.libeay32, OpenSSL.Core, OpenSSL.CMSHeaders, IdSSLOpenSSLHeaders; type TSMIMEUtil = class(TOpenSLLBase) @@ -44,7 +44,7 @@ implementation function TSMIMEUtil.Decrypt(InputStream, OutputStream: TStream; Verify, NoVerify: Boolean): Integer; var LInput, LOutput, LContent: PBIO; - LPKCS7: PPKCS7; + LCMS_ContentInfo: PCMS_ContentInfo; LStore: PX509_STORE; LCerts: PSTACK_OF_X509; LFlags, LOutputLen: Integer; @@ -68,10 +68,10 @@ function TSMIMEUtil.Decrypt(InputStream, OutputStream: TStream; Verify, NoVerify if not Assigned(LInput) then RaiseOpenSSLError('BIO_new_file'); - LPKCS7 := nil; - LPKCS7 := d2i_PKCS7_bio(LInput, LPKCS7); + LCMS_ContentInfo := nil; + LCMS_ContentInfo := d2i_CMS_bio(LInput, LCMS_ContentInfo); - if not Assigned(LPKCS7) then + if not Assigned(LCMS_ContentInfo) then RaiseOpenSSLError('FSMIME_read_PKCS7'); LOutput := BIO_new(BIO_s_mem()); @@ -80,7 +80,7 @@ function TSMIMEUtil.Decrypt(InputStream, OutputStream: TStream; Verify, NoVerify if Verify then begin - Result := PKCS7_verify(LPKCS7, LCerts, LStore, LContent, LOutput, LFlags); + Result := CMS_verify(LCMS_ContentInfo, LCerts, LStore, LContent, LOutput, LFlags); if Assigned(LOutput) and Assigned(OutputStream) then begin diff --git a/Source/OpenSSL.libeay32.pas b/Source/OpenSSL.libeay32.pas index 752588f..8d1675d 100644 --- a/Source/OpenSSL.libeay32.pas +++ b/Source/OpenSSL.libeay32.pas @@ -24,7 +24,7 @@ interface uses - System.Classes, System.SysUtils, IdSSLOpenSSLHeaders, IdSSLOpenSSL; + System.Classes, System.SysUtils, OpenSSL.CMSHeaders, IdSSLOpenSSLHeaders, IdSSLOpenSSL; const { S/MIME related flags } @@ -78,6 +78,8 @@ interface d2i_PKCS7_bio: function(bp: PBIO; var pkcs7: PPKCS7): PPKCS7; cdecl; PKCS7_verify: function(p7: PPKCS7; certs: PSTACK_OF_X509; store: PX509_STORE; indata, outdata: PBIO; flags: Integer): Integer cdecl; + d2i_CMS_bio: function(bp: PBIO; var cms: PCMS_ContentInfo): PCMS_ContentInfo; cdecl; + CMS_verify: function(cms: PCMS_ContentInfo; certs: PSTACK_OF_X509; store: PX509_STORE; indata, outdata: PBIO; flags: Integer): Integer cdecl; X509_STORE_new: function(): PX509_STORE; cdecl; RAND_bytes : function (buf: PAnsiChar; num: Integer): Integer cdecl; @@ -161,6 +163,8 @@ procedure ResetFuncPointers; d2i_PKCS7_bio := nil; PKCS7_verify := nil; + d2i_CMS_bio := nil; + CMS_verify := nil; X509_STORE_new := nil; RAND_bytes := nil; RAND_pseudo_bytes := nil; @@ -198,6 +202,8 @@ function LoadOpenSSLLibraryEx :Boolean; d2i_PKCS7_bio := GetProcAddress(hSSL, 'd2i_PKCS7_bio'); PKCS7_verify := GetProcAddress(hSSL, 'PKCS7_verify'); + d2i_CMS_bio := GetProcAddress(hSSL, 'd2i_CMS_bio'); + CMS_verify := GetProcAddress(hSSL, 'CMS_verify'); X509_STORE_new := GetProcAddress(hSSL, 'X509_STORE_new'); RAND_bytes := GetProcAddress(hSSL, 'RAND_bytes'); RAND_pseudo_bytes := GetProcAddress(hSSL, 'RAND_pseudo_bytes'); From f7b02ca43cce63551148da48b45634cae9461c99 Mon Sep 17 00:00:00 2001 From: "mauro@maurobaso.com" Date: Sat, 25 Jan 2020 03:17:54 +0100 Subject: [PATCH 02/15] Extract content even without verify --- Packages/10.3Rio/OpenSSL.dproj | 404 ++++++++++++++++- Samples/SSLDemo/SSLDemo.UnpackPKCS7Frame.pas | 19 +- Samples/SSLDemo/SSLDemo.dpr | 3 +- Samples/SSLDemo/SSLDemo.dproj | 441 ++++++++++++++++++- Samples/SSLDemo/SSLDemo.res | Bin 2044 -> 2040 bytes Source/OpenSSL.SMIMEUtils.pas | 46 +- Source/OpenSSL.libeay32.pas | 30 ++ 7 files changed, 920 insertions(+), 23 deletions(-) diff --git a/Packages/10.3Rio/OpenSSL.dproj b/Packages/10.3Rio/OpenSSL.dproj index 7f7e3e7..db80cda 100644 --- a/Packages/10.3Rio/OpenSSL.dproj +++ b/Packages/10.3Rio/OpenSSL.dproj @@ -2,7 +2,7 @@ {4D944443-DB16-471B-BCD5-AE06947E67E3} OpenSSL.dpk - 18.5 + 18.8 None True Debug @@ -174,12 +174,20 @@ classes 1 + + classes + 1 + res\xml 1 + + res\xml + 1 + @@ -192,12 +200,26 @@ library\lib\armeabi 1 + + library\lib\armeabi + 1 + + + + + library\lib\armeabi-v7a + 1 + library\lib\mips 1 + + library\lib\mips + 1 + @@ -205,84 +227,216 @@ library\lib\armeabi-v7a 1 + + library\lib\arm64-v8a + 1 + + + + + library\lib\armeabi-v7a + 1 + res\drawable 1 + + res\drawable + 1 + res\values 1 + + res\values + 1 + res\values-v21 1 + + res\values-v21 + 1 + + + + + res\values + 1 + + + res\values + 1 + res\drawable 1 + + res\drawable + 1 + res\drawable-xxhdpi 1 + + res\drawable-xxhdpi + 1 + res\drawable-ldpi 1 + + res\drawable-ldpi + 1 + res\drawable-mdpi 1 + + res\drawable-mdpi + 1 + res\drawable-hdpi 1 + + res\drawable-hdpi + 1 + res\drawable-xhdpi 1 + + res\drawable-xhdpi + 1 + + + + + res\drawable-mdpi + 1 + + + res\drawable-mdpi + 1 + + + + + res\drawable-hdpi + 1 + + + res\drawable-hdpi + 1 + + + + + res\drawable-xhdpi + 1 + + + res\drawable-xhdpi + 1 + + + + + res\drawable-xxhdpi + 1 + + + res\drawable-xxhdpi + 1 + + + + + res\drawable-xxxhdpi + 1 + + + res\drawable-xxxhdpi + 1 + res\drawable-small 1 + + res\drawable-small + 1 + res\drawable-normal 1 + + res\drawable-normal + 1 + res\drawable-large 1 + + res\drawable-large + 1 + res\drawable-xlarge 1 + + res\drawable-xlarge + 1 + + + + + res\values + 1 + + + res\values + 1 + @@ -352,6 +506,9 @@ 0 + + 0 + 0 @@ -382,6 +539,17 @@ 1 + + + 1 + + + 1 + + + 1 + + 1 @@ -393,6 +561,39 @@ 1 + + + 1 + + + 1 + + + 1 + + + + + 1 + + + 1 + + + 1 + + + + + 1 + + + 1 + + + 1 + + 1 @@ -404,6 +605,61 @@ 1 + + + 1 + + + 1 + + + 1 + + + + + 1 + + + 1 + + + 1 + + + + + 1 + + + 1 + + + 1 + + + + + 1 + + + 1 + + + 1 + + + + + 1 + + + 1 + + + 1 + + 1 @@ -415,6 +671,116 @@ 1 + + + 1 + + + 1 + + + 1 + + + + + 1 + + + 1 + + + 1 + + + + + 1 + + + 1 + + + 1 + + + + + 1 + + + 1 + + + 1 + + + + + 1 + + + 1 + + + 1 + + + + + 1 + + + 1 + + + 1 + + + + + 1 + + + 1 + + + 1 + + + + + 1 + + + 1 + + + 1 + + + + + 1 + + + 1 + + + 1 + + + + + 1 + + + 1 + + + 1 + + 1 @@ -448,10 +814,35 @@ 1 + + + 1 + + + 1 + + + 1 + + + + + 1 + + + 1 + + + 1 + + 1 + + 1 + @@ -495,6 +886,10 @@ library\lib\armeabi-v7a 1 + + library\lib\arm64-v8a + 1 + 1 @@ -517,6 +912,12 @@ 0 + + + library\lib\armeabi-v7a + 1 + + 1 @@ -554,6 +955,7 @@ + True diff --git a/Samples/SSLDemo/SSLDemo.UnpackPKCS7Frame.pas b/Samples/SSLDemo/SSLDemo.UnpackPKCS7Frame.pas index b96057b..781458f 100644 --- a/Samples/SSLDemo/SSLDemo.UnpackPKCS7Frame.pas +++ b/Samples/SSLDemo/SSLDemo.UnpackPKCS7Frame.pas @@ -33,7 +33,7 @@ implementation procedure TUnpackPKCS7Frame.btnUnpackClick(Sender: TObject); var SMIME: TSMIMEUtil; - Verify: Integer; + Verify: Boolean; InputStream, OutputStream: TMemoryStream; begin SMIME := TSMIMEUtil.Create; @@ -41,17 +41,20 @@ procedure TUnpackPKCS7Frame.btnUnpackClick(Sender: TObject); OutputStream := TMemoryStream.Create; try InputStream.LoadFromFile(edtInputFileName.Text); - Verify := SMIME.Decrypt(InputStream, OutputStream, chkVerify.Checked, chkNoVerify.Checked); - - if chkVerify.Checked then + if not SMIME.Decrypt(InputStream, OutputStream, chkVerify.Checked, chkNoVerify.Checked) then begin - if Verify = 1 then - ShowMessage('Verification Successfull') - else - ShowMessage('Verification Failure') + if chkVerify.Checked + then ShowMessage('Verification Failure') + else ShowMessage('Decrypt Failure'); + Exit; end; OutputStream.SaveToFile(edtOutputFileName.Text); + + if chkVerify.Checked + then ShowMessage('Verification Successfull') + else ShowMessage('Decrypt Successfull'); + ShellExecute(Handle, 'open', PChar(edtOutputFileName.Text), '', '', SW_SHOWDEFAULT); finally InputStream.Free; diff --git a/Samples/SSLDemo/SSLDemo.dpr b/Samples/SSLDemo/SSLDemo.dpr index 8db6c8f..50b1d1a 100644 --- a/Samples/SSLDemo/SSLDemo.dpr +++ b/Samples/SSLDemo/SSLDemo.dpr @@ -35,7 +35,8 @@ uses SSLDemo.RandFrame in 'SSLDemo.RandFrame.pas' {RandomFrame: TFrame}, SSLDemo.UnpackPKCS7Frame in 'SSLDemo.UnpackPKCS7Frame.pas' {UnpackPKCS7Frame: TFrame}, OpenSSL.RandUtils in '..\..\Source\OpenSSL.RandUtils.pas', - SSLDemo.KeyPairFrame in 'SSLDemo.KeyPairFrame.pas' {KeyPairFrame: TFrame}; + SSLDemo.KeyPairFrame in 'SSLDemo.KeyPairFrame.pas' {KeyPairFrame: TFrame}, + OpenSSL.CMSHeaders in '..\..\Source\OpenSSL.CMSHeaders.pas'; {$R *.res} diff --git a/Samples/SSLDemo/SSLDemo.dproj b/Samples/SSLDemo/SSLDemo.dproj index dd3e519..5a646f6 100644 --- a/Samples/SSLDemo/SSLDemo.dproj +++ b/Samples/SSLDemo/SSLDemo.dproj @@ -7,7 +7,7 @@ 1 Application VCL - 18.5 + 18.8 Win32 @@ -115,6 +115,7 @@ dfm TFrame + Cfg_2 Base @@ -159,7 +160,6 @@ 1 - Contents\MacOS 0 @@ -168,12 +168,20 @@ classes 1 + + classes + 1 + res\xml 1 + + res\xml + 1 + @@ -186,12 +194,26 @@ library\lib\armeabi 1 + + library\lib\armeabi + 1 + + + + + library\lib\armeabi-v7a + 1 + library\lib\mips 1 + + library\lib\mips + 1 + @@ -199,84 +221,216 @@ library\lib\armeabi-v7a 1 + + library\lib\arm64-v8a + 1 + + + + + library\lib\armeabi-v7a + 1 + res\drawable 1 + + res\drawable + 1 + res\values 1 + + res\values + 1 + res\values-v21 1 + + res\values-v21 + 1 + + + + + res\values + 1 + + + res\values + 1 + res\drawable 1 + + res\drawable + 1 + res\drawable-xxhdpi 1 + + res\drawable-xxhdpi + 1 + res\drawable-ldpi 1 + + res\drawable-ldpi + 1 + res\drawable-mdpi 1 + + res\drawable-mdpi + 1 + res\drawable-hdpi 1 + + res\drawable-hdpi + 1 + res\drawable-xhdpi 1 + + res\drawable-xhdpi + 1 + + + + + res\drawable-mdpi + 1 + + + res\drawable-mdpi + 1 + + + + + res\drawable-hdpi + 1 + + + res\drawable-hdpi + 1 + + + + + res\drawable-xhdpi + 1 + + + res\drawable-xhdpi + 1 + + + + + res\drawable-xxhdpi + 1 + + + res\drawable-xxhdpi + 1 + + + + + res\drawable-xxxhdpi + 1 + + + res\drawable-xxxhdpi + 1 + res\drawable-small 1 + + res\drawable-small + 1 + res\drawable-normal 1 + + res\drawable-normal + 1 + res\drawable-large 1 + + res\drawable-large + 1 + res\drawable-xlarge 1 + + res\drawable-xlarge + 1 + + + + + res\values + 1 + + + res\values + 1 + @@ -296,6 +450,11 @@ 1 .framework + + Contents\MacOS + 1 + .framework + 0 @@ -318,6 +477,11 @@ 1 .dylib + + Contents\MacOS + 1 + .dylib + 0 .dll;.bpl @@ -341,6 +505,11 @@ 1 .dylib + + Contents\MacOS + 1 + .dylib + 0 .bpl @@ -350,6 +519,9 @@ 0 + + 0 + 0 @@ -363,6 +535,10 @@ Contents\Resources\StartUp\ 0 + + Contents\Resources\StartUp\ + 0 + 0 @@ -378,6 +554,17 @@ 1 + + + 1 + + + 1 + + + 1 + + 1 @@ -389,6 +576,39 @@ 1 + + + 1 + + + 1 + + + 1 + + + + + 1 + + + 1 + + + 1 + + + + + 1 + + + 1 + + + 1 + + 1 @@ -400,6 +620,61 @@ 1 + + + 1 + + + 1 + + + 1 + + + + + 1 + + + 1 + + + 1 + + + + + 1 + + + 1 + + + 1 + + + + + 1 + + + 1 + + + 1 + + + + + 1 + + + 1 + + + 1 + + 1 @@ -411,6 +686,116 @@ 1 + + + 1 + + + 1 + + + 1 + + + + + 1 + + + 1 + + + 1 + + + + + 1 + + + 1 + + + 1 + + + + + 1 + + + 1 + + + 1 + + + + + 1 + + + 1 + + + 1 + + + + + 1 + + + 1 + + + 1 + + + + + 1 + + + 1 + + + 1 + + + + + 1 + + + 1 + + + 1 + + + + + 1 + + + 1 + + + 1 + + + + + 1 + + + 1 + + + 1 + + 1 @@ -444,10 +829,35 @@ 1 + + + 1 + + + 1 + + + 1 + + + + + 1 + + + 1 + + + 1 + + 1 + + 1 + @@ -510,24 +920,40 @@ ..\ 1 + + ..\ + 1 + Contents 1 + + Contents + 1 + Contents\Resources 1 + + Contents\Resources + 1 + library\lib\armeabi-v7a 1 + + library\lib\arm64-v8a + 1 + 1 @@ -544,10 +970,20 @@ Contents\MacOS 1 + + Contents\MacOS + 1 + 0 + + + library\lib\armeabi-v7a + 1 + + 1 @@ -585,6 +1021,7 @@ + 12 diff --git a/Samples/SSLDemo/SSLDemo.res b/Samples/SSLDemo/SSLDemo.res index e918c5f541a874d0181a107ced2715c2d0b8f814..e81b52309701497a01115d01ca208a91d5b93b55 100644 GIT binary patch delta 23 fcmeyv|AT+S0Y=8_n-4OcX4>4xqQg9S54!^Zf&U4p delta 25 hcmeyt|A&9W0Y=7~n-4OcX4>4vqQ}h0FnK$>BLI>e38er4 diff --git a/Source/OpenSSL.SMIMEUtils.pas b/Source/OpenSSL.SMIMEUtils.pas index f6db5a3..2ccf2ab 100644 --- a/Source/OpenSSL.SMIMEUtils.pas +++ b/Source/OpenSSL.SMIMEUtils.pas @@ -34,27 +34,32 @@ interface type TSMIMEUtil = class(TOpenSLLBase) public - function Decrypt(InputStream, OutputStream :TStream; Verify, NoVerify: Boolean): Integer; + function Decrypt(InputStream, OutputStream :TStream; Verify, NoVerify: Boolean): Boolean; end; implementation { TSMIMEUtil } -function TSMIMEUtil.Decrypt(InputStream, OutputStream: TStream; Verify, NoVerify: Boolean): Integer; +function TSMIMEUtil.Decrypt(InputStream, OutputStream: TStream; Verify, NoVerify: Boolean): Boolean; +const + BSIZE = 1024*8; var LInput, LOutput, LContent: PBIO; LCMS_ContentInfo: PCMS_ContentInfo; LStore: PX509_STORE; LCerts: PSTACK_OF_X509; - LFlags, LOutputLen: Integer; + LFlags, LRead, LOutputLen: Integer; LOutputBuffer, LInputBuffer: TBytes; begin + Result := False; + + if not (Assigned(InputStream) and Assigned(OutputStream)) + then Exit; //raise? - Result := 0; LFlags := 0; - if NoVerify then - LFlags := PKCS7_NOVERIFY; + if NoVerify + then LFlags := CMS_NOVERIFY; LContent := nil; LCerts := nil; LInput := nil; @@ -78,20 +83,39 @@ function TSMIMEUtil.Decrypt(InputStream, OutputStream: TStream; Verify, NoVerify if not Assigned(LOutput) then RaiseOpenSSLError('BIO_new'); + LOutputLen := 0; if Verify then begin - Result := CMS_verify(LCMS_ContentInfo, LCerts, LStore, LContent, LOutput, LFlags); - - if Assigned(LOutput) and Assigned(OutputStream) then + if CMS_verify(LCMS_ContentInfo, LCerts, LStore, LContent, LOutput, LFlags) > 0 then begin LOutputLen := LOutput.num_write; SetLength(LOutputBuffer, LOutputLen); BIO_read(LOutput, LOutputBuffer, LOutputLen); - - OutputStream.WriteBuffer(LOutputBuffer, LOutputLen); + end; + end else + begin + LContent := CMS_dataInit(LCMS_ContentInfo, nil); + if Assigned(LContent) then + begin + SetLength(LOutputBuffer, BSIZE); + while ((BIO_pending(LContent) > 0)or(BIO_eof(LContent) = 0)) do + begin + LRead := BIO_read(LContent, LOutputBuffer, BSIZE); + if LRead < 0 + then RaiseOpenSSLError('BIO_read'); + if LRead = 0 + then Break; + end; + LOutputLen := LContent.num_read; end; end; + + Result := LOutputLen > 0; + if Result + then OutputStream.WriteBuffer(LOutputBuffer, LOutputLen); finally + if Assigned(LCMS_ContentInfo) + then CMS_free(LCMS_ContentInfo); BIO_free(LInput); BIO_free(LOutput); BIO_free(LContent); diff --git a/Source/OpenSSL.libeay32.pas b/Source/OpenSSL.libeay32.pas index 8d1675d..521b675 100644 --- a/Source/OpenSSL.libeay32.pas +++ b/Source/OpenSSL.libeay32.pas @@ -28,6 +28,30 @@ interface const { S/MIME related flags } + CMS_TEXT = $1; + CMS_NOCERTS = $2; + CMS_NO_CONTENT_VERIFY = $4; + CMS_NO_ATTR_VERIFY = $8; + CMS_NOSIGS = CMS_NO_CONTENT_VERIFY or CMS_NO_ATTR_VERIFY; + CMS_NOINTERN = $10; + CMS_NO_SIGNER_CERT_VERIFY = $20; + CMS_NOVERIFY = $20; + CMS_DETACHED = $40; + CMS_BINARY = $80; + CMS_NOATTR = $100; + CMS_NOSMIMECAP = $200; + CMS_NOOLDMIMETYPE = $400; + CMS_CRLFEOL = $800; + CMS_STREAM = $1000; + CMS_NOCRL = $2000; + CMS_PARTIAL = $4000; + CMS_REUSE_DIGEST = $8000; + CMS_USE_KEYID = $10000; + CMS_DEBUG_DECRYPT = $20000; + CMS_KEY_PARAM = $40000; + CMS_ASCIICRLF = $80000; + CMS_CADES = $100000; + PKCS7_TEXT = $1; PKCS7_NOCERTS = $2; PKCS7_NOSIGS = $4; @@ -80,6 +104,8 @@ interface PKCS7_verify: function(p7: PPKCS7; certs: PSTACK_OF_X509; store: PX509_STORE; indata, outdata: PBIO; flags: Integer): Integer cdecl; d2i_CMS_bio: function(bp: PBIO; var cms: PCMS_ContentInfo): PCMS_ContentInfo; cdecl; CMS_verify: function(cms: PCMS_ContentInfo; certs: PSTACK_OF_X509; store: PX509_STORE; indata, outdata: PBIO; flags: Integer): Integer cdecl; + CMS_dataInit: function(cms: PCMS_ContentInfo; bp: PBIO): PBIO cdecl; + CMS_free: procedure(cms: PCMS_ContentInfo) cdecl; X509_STORE_new: function(): PX509_STORE; cdecl; RAND_bytes : function (buf: PAnsiChar; num: Integer): Integer cdecl; @@ -165,6 +191,8 @@ procedure ResetFuncPointers; PKCS7_verify := nil; d2i_CMS_bio := nil; CMS_verify := nil; + CMS_dataInit := nil; + CMS_free := nil; X509_STORE_new := nil; RAND_bytes := nil; RAND_pseudo_bytes := nil; @@ -204,6 +232,8 @@ function LoadOpenSSLLibraryEx :Boolean; PKCS7_verify := GetProcAddress(hSSL, 'PKCS7_verify'); d2i_CMS_bio := GetProcAddress(hSSL, 'd2i_CMS_bio'); CMS_verify := GetProcAddress(hSSL, 'CMS_verify'); + CMS_dataInit := GetProcAddress(hSSL, 'CMS_dataInit'); + CMS_free := GetProcAddress(hSSL, 'CMS_ContentInfo_free'); X509_STORE_new := GetProcAddress(hSSL, 'X509_STORE_new'); RAND_bytes := GetProcAddress(hSSL, 'RAND_bytes'); RAND_pseudo_bytes := GetProcAddress(hSSL, 'RAND_pseudo_bytes'); From 983b751a32cef6bd9947344a973e3cb029649fcf Mon Sep 17 00:00:00 2001 From: "mauro@maurobaso.com" Date: Sun, 26 Jan 2020 03:06:42 +0100 Subject: [PATCH 03/15] Url update (from bitbucket to github) --- Source/OpenSSL.Core.pas | 2 +- Source/OpenSSL.EncUtils.pas | 2 +- Source/OpenSSL.RSAUtils.pas | 2 +- Source/OpenSSL.RandUtils.pas | 2 +- Source/OpenSSL.SMIMEUtils.pas | 2 +- Source/OpenSSL.libeay32.pas | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Source/OpenSSL.Core.pas b/Source/OpenSSL.Core.pas index bba9246..7a1cf70 100644 --- a/Source/OpenSSL.Core.pas +++ b/Source/OpenSSL.Core.pas @@ -2,7 +2,7 @@ { } { Delphi OPENSSL Library } { Copyright (c) 2016 Luca Minuti } -{ https://bitbucket.org/lminuti/delphi-openssl } +{ https://github.com/lminuti/Delphi-OpenSSL } { } {******************************************************************************} { } diff --git a/Source/OpenSSL.EncUtils.pas b/Source/OpenSSL.EncUtils.pas index b23a2d8..038c122 100644 --- a/Source/OpenSSL.EncUtils.pas +++ b/Source/OpenSSL.EncUtils.pas @@ -2,7 +2,7 @@ { } { Delphi OPENSSL Library } { Copyright (c) 2016 Luca Minuti } -{ https://bitbucket.org/lminuti/delphi-openssl } +{ https://github.com/lminuti/Delphi-OpenSSL } { } {******************************************************************************} { } diff --git a/Source/OpenSSL.RSAUtils.pas b/Source/OpenSSL.RSAUtils.pas index a2be13c..7bb400a 100644 --- a/Source/OpenSSL.RSAUtils.pas +++ b/Source/OpenSSL.RSAUtils.pas @@ -2,7 +2,7 @@ { } { Delphi OPENSSL Library } { Copyright (c) 2016 Luca Minuti } -{ https://bitbucket.org/lminuti/delphi-openssl } +{ https://github.com/lminuti/Delphi-OpenSSL } { } {******************************************************************************} { } diff --git a/Source/OpenSSL.RandUtils.pas b/Source/OpenSSL.RandUtils.pas index 61a4e38..fd8899d 100644 --- a/Source/OpenSSL.RandUtils.pas +++ b/Source/OpenSSL.RandUtils.pas @@ -2,7 +2,7 @@ { } { Delphi OPENSSL Library } { Copyright (c) 2018 Luca Minuti } -{ https://bitbucket.org/lminuti/delphi-openssl } +{ https://github.com/lminuti/Delphi-OpenSSL } { } {******************************************************************************} { } diff --git a/Source/OpenSSL.SMIMEUtils.pas b/Source/OpenSSL.SMIMEUtils.pas index 2ccf2ab..99edd77 100644 --- a/Source/OpenSSL.SMIMEUtils.pas +++ b/Source/OpenSSL.SMIMEUtils.pas @@ -2,7 +2,7 @@ { } { Delphi OPENSSL Library } { Copyright (c) 2016 Luca Minuti } -{ https://bitbucket.org/lminuti/delphi-openssl } +{ https://github.com/lminuti/Delphi-OpenSSL } { } {******************************************************************************} { } diff --git a/Source/OpenSSL.libeay32.pas b/Source/OpenSSL.libeay32.pas index 521b675..9f148c0 100644 --- a/Source/OpenSSL.libeay32.pas +++ b/Source/OpenSSL.libeay32.pas @@ -2,7 +2,7 @@ { } { Delphi OPENSSL Library } { Copyright (c) 2016 Luca Minuti } -{ https://bitbucket.org/lminuti/delphi-openssl } +{ https://github.com/lminuti/Delphi-OpenSSL } { } {******************************************************************************} { } From cc64835eb08947e5f52a437e9548b370b9fc75c5 Mon Sep 17 00:00:00 2001 From: "mauro@maurobaso.com" Date: Sun, 26 Jan 2020 03:08:09 +0100 Subject: [PATCH 04/15] New cms headers file added to project (previously forgotten) --- Packages/10.3Rio/OpenSSL.dpk | 3 ++- Packages/10.3Rio/OpenSSL.dproj | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Packages/10.3Rio/OpenSSL.dpk b/Packages/10.3Rio/OpenSSL.dpk index 91d5c55..fcb4bc6 100644 --- a/Packages/10.3Rio/OpenSSL.dpk +++ b/Packages/10.3Rio/OpenSSL.dpk @@ -41,6 +41,7 @@ contains OpenSSL.libeay32 in '..\..\Source\OpenSSL.libeay32.pas', OpenSSL.RandUtils in '..\..\Source\OpenSSL.RandUtils.pas', OpenSSL.RSAUtils in '..\..\Source\OpenSSL.RSAUtils.pas', - OpenSSL.SMIMEUtils in '..\..\Source\OpenSSL.SMIMEUtils.pas'; + OpenSSL.SMIMEUtils in '..\..\Source\OpenSSL.SMIMEUtils.pas', + OpenSSL.CMSHeaders in '..\..\Source\OpenSSL.CMSHeaders.pas'; end. diff --git a/Packages/10.3Rio/OpenSSL.dproj b/Packages/10.3Rio/OpenSSL.dproj index db80cda..ceae955 100644 --- a/Packages/10.3Rio/OpenSSL.dproj +++ b/Packages/10.3Rio/OpenSSL.dproj @@ -92,6 +92,7 @@ + Cfg_2 Base @@ -119,7 +120,7 @@ - + OpenSSL.bpl true From a224553abc16bfe60ca4d49fe566f5436441f38d Mon Sep 17 00:00:00 2001 From: "mauro@maurobaso.com" Date: Sun, 26 Jan 2020 04:03:11 +0100 Subject: [PATCH 05/15] Read loop was obviously wrong --- Source/OpenSSL.SMIMEUtils.pas | 52 +++++++++++++++++++++++++++++------ 1 file changed, 43 insertions(+), 9 deletions(-) diff --git a/Source/OpenSSL.SMIMEUtils.pas b/Source/OpenSSL.SMIMEUtils.pas index 99edd77..c5311f7 100644 --- a/Source/OpenSSL.SMIMEUtils.pas +++ b/Source/OpenSSL.SMIMEUtils.pas @@ -35,6 +35,8 @@ interface TSMIMEUtil = class(TOpenSLLBase) public function Decrypt(InputStream, OutputStream :TStream; Verify, NoVerify: Boolean): Boolean; + class function Extract(InputStream, OutputStream: TStream): Boolean; + class function Verify(InputStream, OutputStream: TStream; const Complete: Boolean = False): Boolean; end; implementation @@ -49,7 +51,7 @@ function TSMIMEUtil.Decrypt(InputStream, OutputStream: TStream; Verify, NoVerify LCMS_ContentInfo: PCMS_ContentInfo; LStore: PX509_STORE; LCerts: PSTACK_OF_X509; - LFlags, LRead, LOutputLen: Integer; + LFlags, LOutputLen: Integer; LOutputBuffer, LInputBuffer: TBytes; begin Result := False; @@ -83,14 +85,19 @@ function TSMIMEUtil.Decrypt(InputStream, OutputStream: TStream; Verify, NoVerify if not Assigned(LOutput) then RaiseOpenSSLError('BIO_new'); - LOutputLen := 0; if Verify then begin if CMS_verify(LCMS_ContentInfo, LCerts, LStore, LContent, LOutput, LFlags) > 0 then begin LOutputLen := LOutput.num_write; + if LOutputLen < 0 + then RaiseOpenSSLError('CMS_verify'); + if LOutputLen = 0 + then Exit; SetLength(LOutputBuffer, LOutputLen); BIO_read(LOutput, LOutputBuffer, LOutputLen); + OutputStream.WriteBuffer(LOutputBuffer, LOutputLen); + Result := True; end; end else begin @@ -100,19 +107,17 @@ function TSMIMEUtil.Decrypt(InputStream, OutputStream: TStream; Verify, NoVerify SetLength(LOutputBuffer, BSIZE); while ((BIO_pending(LContent) > 0)or(BIO_eof(LContent) = 0)) do begin - LRead := BIO_read(LContent, LOutputBuffer, BSIZE); - if LRead < 0 + LOutputLen := BIO_read(LContent, LOutputBuffer, BSIZE); + if LOutputLen < 0 then RaiseOpenSSLError('BIO_read'); - if LRead = 0 + if LOutputLen = 0 then Break; + OutputStream.WriteBuffer(LOutputBuffer, LOutputLen); + Result := True; end; LOutputLen := LContent.num_read; end; end; - - Result := LOutputLen > 0; - if Result - then OutputStream.WriteBuffer(LOutputBuffer, LOutputLen); finally if Assigned(LCMS_ContentInfo) then CMS_free(LCMS_ContentInfo); @@ -122,4 +127,33 @@ function TSMIMEUtil.Decrypt(InputStream, OutputStream: TStream; Verify, NoVerify end; end; +class function TSMIMEUtil.Extract(InputStream, OutputStream: TStream): Boolean; +begin + try + with TSMIMEUtil.Create do + try + Result := Decrypt(InputStream, OutputStream, False, False); + finally + Free; + end; + except + Result := False; + end; +end; + +class function TSMIMEUtil.Verify(InputStream, OutputStream: TStream; + const Complete: Boolean): Boolean; +begin + try + with TSMIMEUtil.Create do + try + Result := Decrypt(InputStream, OutputStream, True, not Complete); + finally + Free; + end; + except + Result := False; + end; +end; + end. From 04d2a58460919fe06643c1ae43d627dc5a2c36df Mon Sep 17 00:00:00 2001 From: "mauro@maurobaso.com" Date: Sun, 26 Jan 2020 04:05:30 +0100 Subject: [PATCH 06/15] Just one more orphan row... --- Source/OpenSSL.SMIMEUtils.pas | 1 - 1 file changed, 1 deletion(-) diff --git a/Source/OpenSSL.SMIMEUtils.pas b/Source/OpenSSL.SMIMEUtils.pas index c5311f7..005014e 100644 --- a/Source/OpenSSL.SMIMEUtils.pas +++ b/Source/OpenSSL.SMIMEUtils.pas @@ -115,7 +115,6 @@ function TSMIMEUtil.Decrypt(InputStream, OutputStream: TStream; Verify, NoVerify OutputStream.WriteBuffer(LOutputBuffer, LOutputLen); Result := True; end; - LOutputLen := LContent.num_read; end; end; finally From 05b062624c83223c239bbb36ecc54d86a4e66cf4 Mon Sep 17 00:00:00 2001 From: "mauro@maurobaso.com" Date: Mon, 27 Jan 2020 04:32:57 +0100 Subject: [PATCH 07/15] Minor changes in demo app --- Samples/SSLDemo/SSLDemo.UnpackPKCS7Frame.dfm | 4 ++-- Samples/SSLDemo/SSLDemo.UnpackPKCS7Frame.pas | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Samples/SSLDemo/SSLDemo.UnpackPKCS7Frame.dfm b/Samples/SSLDemo/SSLDemo.UnpackPKCS7Frame.dfm index 5bb2c7b..ac90a73 100644 --- a/Samples/SSLDemo/SSLDemo.UnpackPKCS7Frame.dfm +++ b/Samples/SSLDemo/SSLDemo.UnpackPKCS7Frame.dfm @@ -25,7 +25,7 @@ object UnpackPKCS7Frame: TUnpackPKCS7Frame object edtInputFileName: TEdit Left = 60 Top = 16 - Width = 380 + Width = 374 Height = 21 Anchors = [akLeft, akTop, akRight] TabOrder = 0 @@ -34,7 +34,7 @@ object UnpackPKCS7Frame: TUnpackPKCS7Frame object edtOutputFileName: TEdit Left = 60 Top = 43 - Width = 380 + Width = 374 Height = 21 Anchors = [akLeft, akTop, akRight] TabOrder = 1 diff --git a/Samples/SSLDemo/SSLDemo.UnpackPKCS7Frame.pas b/Samples/SSLDemo/SSLDemo.UnpackPKCS7Frame.pas index 781458f..d74f2fa 100644 --- a/Samples/SSLDemo/SSLDemo.UnpackPKCS7Frame.pas +++ b/Samples/SSLDemo/SSLDemo.UnpackPKCS7Frame.pas @@ -45,7 +45,7 @@ procedure TUnpackPKCS7Frame.btnUnpackClick(Sender: TObject); begin if chkVerify.Checked then ShowMessage('Verification Failure') - else ShowMessage('Decrypt Failure'); + else ShowMessage('Extraction Failure'); Exit; end; @@ -53,7 +53,7 @@ procedure TUnpackPKCS7Frame.btnUnpackClick(Sender: TObject); if chkVerify.Checked then ShowMessage('Verification Successfull') - else ShowMessage('Decrypt Successfull'); + else ShowMessage('Extraction Successfull'); ShellExecute(Handle, 'open', PChar(edtOutputFileName.Text), '', '', SW_SHOWDEFAULT); finally From efabd039592327d58268a61f6e421c362c3ce099 Mon Sep 17 00:00:00 2001 From: "mauro@maurobaso.com" Date: Mon, 27 Jan 2020 10:06:52 +0100 Subject: [PATCH 08/15] A stricter definition of CMS headers (especially regarding the size_t data type) --- Source/OpenSSL.CMSHeaders.pas | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/Source/OpenSSL.CMSHeaders.pas b/Source/OpenSSL.CMSHeaders.pas index 6357e39..0c38e68 100644 --- a/Source/OpenSSL.CMSHeaders.pas +++ b/Source/OpenSSL.CMSHeaders.pas @@ -3,13 +3,13 @@ interface uses - IdSSLOpenSSLHeaders; + IdSSLOpenSSLHeaders, idCTypes; type {$IFDEF DEBUG_SAFESTACK} {$EXTERNALSYM STACK_OF_CMS_CertificateChoices} STACK_OF_CMS_CertificateChoices = record - _stack: stack; + _stack: STACK; end; {$EXTERNALSYM PSTACK_OF_CMS_CertificateChoices} PSTACK_OF_CMS_CertificateChoices = ^STACK_OF_CMS_CertificateChoices; @@ -18,14 +18,14 @@ STACK_OF_CMS_CertificateChoices = record PSTACK_OF_CMS_RevocationInfoChoice = ^STACK_OF_CMS_RevocationInfoChoice; {$EXTERNALSYM STACK_OF_CMS_RevocationInfoChoice} STACK_OF_CMS_RevocationInfoChoice = record - _stack: stack; + _stack: STACK; end; {$EXTERNALSYM PSTACK_OF_CMS_RecipientInfo} PSTACK_OF_CMS_RecipientInfo = ^STACK_OF_CMS_RecipientInfo; {$EXTERNALSYM STACK_OF_CMS_RecipientInfo} STACK_OF_CMS_RecipientInfo = record - _stack: stack; + _stack: STACK; end; {$ELSE} {$EXTERNALSYM PSTACK_OF_CMS_CertificateChoices} @@ -43,14 +43,14 @@ CMS_EncapsulatedContentInfo = record eContentType: PASN1_OBJECT; eContent: PASN1_OCTET_STRING; // Set to 1 if incomplete structure only part set up - partial: Integer; + partial: TIdC_INT; end; {$EXTERNALSYM PCMS_SignedData} PCMS_SignedData = ^CMS_SignedData; {$EXTERNALSYM CMS_SignedData} CMS_SignedData = record - version: Int32; + version: TIdC_INT32; digestAlgorithms: PSTACK_OF_X509_ALGOR; encapContentInfo: PCMS_EncapsulatedContentInfo; certificates: PSTACK_OF_CMS_CertificateChoices; @@ -76,18 +76,18 @@ CMS_EncryptedContentInfo = record // Content encryption algorithm and key cipher: PEVP_CIPHER; //const ? key: PAnsiChar; - keylen: Cardinal; + keylen: NativeUInt; //size_t in C //Set to 1 if we are debugging decrypt and don't fake keys for MMA - debug: Integer; + debug: TIdC_INT; // Set to 1 if we have no cert and need extra safety measures for MMA - havenocert: Integer; + havenocert: TIdC_INT; end; {$EXTERNALSYM PCMS_EnvelopedData} PCMS_EnvelopedData = ^CMS_EnvelopedData; {$EXTERNALSYM CMS_EnvelopedData} CMS_EnvelopedData = record - version: Int32; + version: TIdC_INT32; originatorInfo: PCMS_OriginatorInfo; recipientInfos: PSTACK_OF_CMS_RecipientInfo; encryptedContentInfo: PCMS_EncryptedContentInfo; @@ -98,7 +98,7 @@ CMS_EnvelopedData = record PCMS_DigestedData = ^CMS_DigestedData; {$EXTERNALSYM CMS_DigestedData} CMS_DigestedData = record - version: Int32; + version: TIdC_INT32; digestAlgorithm: PX509_ALGOR; encapContentInfo: PCMS_EncapsulatedContentInfo; digest: PASN1_OCTET_STRING; @@ -108,7 +108,7 @@ CMS_DigestedData = record PCMS_EncryptedData = ^CMS_EncryptedData; {$EXTERNALSYM CMS_EncryptedData} CMS_EncryptedData = record - version: Int32; + version: TIdC_INT32; encryptedContentInfo: PCMS_EncryptedContentInfo; unprotectedAttrs: PSTACK_OF_X509_ATTRIBUTE; end; @@ -117,7 +117,7 @@ CMS_EncryptedData = record PCMS_AuthenticatedData = ^CMS_AuthenticatedData; {$EXTERNALSYM CMS_AuthenticatedData} CMS_AuthenticatedData = record - version: Int32; + version: TIdC_INT32; originatorInfo: PCMS_OriginatorInfo; recipientInfos: PSTACK_OF_CMS_RecipientInfo; macAlgorithm: PX509_ALGOR; @@ -132,7 +132,7 @@ CMS_AuthenticatedData = record PCMS_CompressedData = ^CMS_CompressedData; {$EXTERNALSYM CMS_CompressedData} CMS_CompressedData = record - version: Int32; + version: TIdC_INT32; compressionAlgorithm: PX509_ALGOR; recipientInfos: PSTACK_OF_CMS_RecipientInfo; encapContentInfo: PCMS_EncapsulatedContentInfo; From a0c1c75d85d440fc7f8e57fd1286e4fe547b6fc7 Mon Sep 17 00:00:00 2001 From: "mauro@maurobaso.com" Date: Mon, 27 Jan 2020 13:48:34 +0100 Subject: [PATCH 09/15] Added PKCS7 signers certificate verification against an external ca file Added code to free certicate store after use --- Samples/SSLDemo/SSLDemo.UnpackPKCS7Frame.dfm | 25 ++++++++++++++++--- Samples/SSLDemo/SSLDemo.UnpackPKCS7Frame.pas | 6 +++-- Source/OpenSSL.SMIMEUtils.pas | 26 +++++++++++++------- Source/OpenSSL.libeay32.pas | 4 +++ 4 files changed, 46 insertions(+), 15 deletions(-) diff --git a/Samples/SSLDemo/SSLDemo.UnpackPKCS7Frame.dfm b/Samples/SSLDemo/SSLDemo.UnpackPKCS7Frame.dfm index ac90a73..51dc70f 100644 --- a/Samples/SSLDemo/SSLDemo.UnpackPKCS7Frame.dfm +++ b/Samples/SSLDemo/SSLDemo.UnpackPKCS7Frame.dfm @@ -22,6 +22,14 @@ object UnpackPKCS7Frame: TUnpackPKCS7Frame Anchors = [akLeft, akTop, akRight] Caption = 'Output file:' end + object lblCertFile: TLabel + Left = 5 + Top = 73 + Width = 35 + Height = 13 + Anchors = [akLeft, akTop, akRight] + Caption = 'CA file:' + end object edtInputFileName: TEdit Left = 60 Top = 16 @@ -38,12 +46,12 @@ object UnpackPKCS7Frame: TUnpackPKCS7Frame Height = 21 Anchors = [akLeft, akTop, akRight] TabOrder = 1 - Text = 'edtInputFileName' + Text = 'edtOutputFileName' end object btnUnpack: TButton AlignWithMargins = True Left = 3 - Top = 70 + Top = 102 Width = 431 Height = 25 Caption = 'Unpack' @@ -52,7 +60,7 @@ object UnpackPKCS7Frame: TUnpackPKCS7Frame end object chkVerify: TCheckBox Left = 3 - Top = 120 + Top = 152 Width = 182 Height = 17 Caption = 'Verify (no output data provided)' @@ -62,7 +70,7 @@ object UnpackPKCS7Frame: TUnpackPKCS7Frame end object chkNoVerify: TCheckBox Left = 221 - Top = 112 + Top = 144 Width = 213 Height = 33 Caption = @@ -73,4 +81,13 @@ object UnpackPKCS7Frame: TUnpackPKCS7Frame TabOrder = 4 WordWrap = True end + object edtCertFileName: TEdit + Left = 60 + Top = 70 + Width = 374 + Height = 21 + Anchors = [akLeft, akTop, akRight] + TabOrder = 5 + Text = 'edtCertFileName' + end end diff --git a/Samples/SSLDemo/SSLDemo.UnpackPKCS7Frame.pas b/Samples/SSLDemo/SSLDemo.UnpackPKCS7Frame.pas index d74f2fa..1888037 100644 --- a/Samples/SSLDemo/SSLDemo.UnpackPKCS7Frame.pas +++ b/Samples/SSLDemo/SSLDemo.UnpackPKCS7Frame.pas @@ -15,6 +15,8 @@ TUnpackPKCS7Frame = class(TFrame) btnUnpack: TButton; chkVerify: TCheckBox; chkNoVerify: TCheckBox; + edtCertFileName: TEdit; + lblCertFile: TLabel; procedure btnUnpackClick(Sender: TObject); private { Private declarations } @@ -33,7 +35,6 @@ implementation procedure TUnpackPKCS7Frame.btnUnpackClick(Sender: TObject); var SMIME: TSMIMEUtil; - Verify: Boolean; InputStream, OutputStream: TMemoryStream; begin SMIME := TSMIMEUtil.Create; @@ -41,7 +42,7 @@ procedure TUnpackPKCS7Frame.btnUnpackClick(Sender: TObject); OutputStream := TMemoryStream.Create; try InputStream.LoadFromFile(edtInputFileName.Text); - if not SMIME.Decrypt(InputStream, OutputStream, chkVerify.Checked, chkNoVerify.Checked) then + if not SMIME.Decrypt(InputStream, OutputStream, AnsiString(edtCertFileName.Text), chkVerify.Checked, chkNoVerify.Checked) then begin if chkVerify.Checked then ShowMessage('Verification Failure') @@ -71,6 +72,7 @@ constructor TUnpackPKCS7Frame.Create(AOwner: TComponent); TestFolder := StringReplace(ExtractFilePath(ParamStr(0)), 'Samples\SSLDemo', 'TestData', [rfReplaceAll, rfIgnoreCase]); edtInputFileName.Text := TestFolder + 'TestPKCS7.pdf.p7m'; edtOutputFileName.Text := TestFolder + 'TestPKCS7-out.pdf'; + edtCertFileName.Text := TestFolder + 'TestPKCS7-cert.pem'; end; end. diff --git a/Source/OpenSSL.SMIMEUtils.pas b/Source/OpenSSL.SMIMEUtils.pas index 005014e..30ca74e 100644 --- a/Source/OpenSSL.SMIMEUtils.pas +++ b/Source/OpenSSL.SMIMEUtils.pas @@ -34,16 +34,17 @@ interface type TSMIMEUtil = class(TOpenSLLBase) public - function Decrypt(InputStream, OutputStream :TStream; Verify, NoVerify: Boolean): Boolean; + function Decrypt(InputStream, OutputStream: TStream; const CAfile: AnsiString; Verify, NoVerify: Boolean): Boolean; class function Extract(InputStream, OutputStream: TStream): Boolean; - class function Verify(InputStream, OutputStream: TStream; const Complete: Boolean = False): Boolean; + class function Verify(InputStream, OutputStream: TStream; const CAfile: AnsiString = ''): Boolean; end; implementation { TSMIMEUtil } -function TSMIMEUtil.Decrypt(InputStream, OutputStream: TStream; Verify, NoVerify: Boolean): Boolean; +function TSMIMEUtil.Decrypt(InputStream, OutputStream: TStream; + const CAfile: AnsiString; Verify, NoVerify: Boolean): Boolean; const BSIZE = 1024*8; var @@ -66,7 +67,7 @@ function TSMIMEUtil.Decrypt(InputStream, OutputStream: TStream; Verify, NoVerify LCerts := nil; LInput := nil; LOutput := nil; - LStore := X509_STORE_new(); + LStore := nil; try SetLength(LInputBuffer, InputStream.Size); InputStream.ReadBuffer(LInputBuffer[0], InputStream.Size); @@ -87,6 +88,13 @@ function TSMIMEUtil.Decrypt(InputStream, OutputStream: TStream; Verify, NoVerify if Verify then begin + LStore := X509_STORE_new(); + if (not NoVerify)and(CAfile <> '') then + begin + if X509_STORE_load_locations(LStore, PAnsiChar(CAfile), nil) = 0 + then RaiseOpenSSLError('X509_STORE_load_locations'); + end; + if CMS_verify(LCMS_ContentInfo, LCerts, LStore, LContent, LOutput, LFlags) > 0 then begin LOutputLen := LOutput.num_write; @@ -118,11 +126,11 @@ function TSMIMEUtil.Decrypt(InputStream, OutputStream: TStream; Verify, NoVerify end; end; finally - if Assigned(LCMS_ContentInfo) - then CMS_free(LCMS_ContentInfo); BIO_free(LInput); BIO_free(LOutput); BIO_free(LContent); + CMS_free(LCMS_ContentInfo); + X509_STORE_free(LStore); end; end; @@ -131,7 +139,7 @@ class function TSMIMEUtil.Extract(InputStream, OutputStream: TStream): Boolean; try with TSMIMEUtil.Create do try - Result := Decrypt(InputStream, OutputStream, False, False); + Result := Decrypt(InputStream, OutputStream, '', False, False); finally Free; end; @@ -141,12 +149,12 @@ class function TSMIMEUtil.Extract(InputStream, OutputStream: TStream): Boolean; end; class function TSMIMEUtil.Verify(InputStream, OutputStream: TStream; - const Complete: Boolean): Boolean; + const CAfile: AnsiString): Boolean; begin try with TSMIMEUtil.Create do try - Result := Decrypt(InputStream, OutputStream, True, not Complete); + Result := Decrypt(InputStream, OutputStream, CAfile, True, CAfile = ''); finally Free; end; diff --git a/Source/OpenSSL.libeay32.pas b/Source/OpenSSL.libeay32.pas index 9f148c0..df203e5 100644 --- a/Source/OpenSSL.libeay32.pas +++ b/Source/OpenSSL.libeay32.pas @@ -107,6 +107,7 @@ interface CMS_dataInit: function(cms: PCMS_ContentInfo; bp: PBIO): PBIO cdecl; CMS_free: procedure(cms: PCMS_ContentInfo) cdecl; X509_STORE_new: function(): PX509_STORE; cdecl; + X509_STORE_free: procedure(v: PX509_STORE); cdecl; RAND_bytes : function (buf: PAnsiChar; num: Integer): Integer cdecl; RAND_pseudo_bytes : function (buf: PAnsiChar; num: Integer): Integer cdecl; @@ -194,6 +195,7 @@ procedure ResetFuncPointers; CMS_dataInit := nil; CMS_free := nil; X509_STORE_new := nil; + X509_STORE_free := nil; RAND_bytes := nil; RAND_pseudo_bytes := nil; RAND_status := nil; @@ -235,6 +237,8 @@ function LoadOpenSSLLibraryEx :Boolean; CMS_dataInit := GetProcAddress(hSSL, 'CMS_dataInit'); CMS_free := GetProcAddress(hSSL, 'CMS_ContentInfo_free'); X509_STORE_new := GetProcAddress(hSSL, 'X509_STORE_new'); + X509_STORE_free := GetProcAddress(hSSL, 'X509_STORE_free'); + RAND_bytes := GetProcAddress(hSSL, 'RAND_bytes'); RAND_pseudo_bytes := GetProcAddress(hSSL, 'RAND_pseudo_bytes'); RAND_status := GetProcAddress(hSSL, 'RAND_status'); From 1bc525dfecc5fcf5d261e77dabab9d0bccaeea66 Mon Sep 17 00:00:00 2001 From: "mauro@maurobaso.com" Date: Mon, 3 Feb 2020 08:07:50 +0100 Subject: [PATCH 10/15] OutputStream allowed to be nil (useful in case you just want to test InputStream for correctness) --- Source/OpenSSL.SMIMEUtils.pas | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Source/OpenSSL.SMIMEUtils.pas b/Source/OpenSSL.SMIMEUtils.pas index 30ca74e..5ab26d8 100644 --- a/Source/OpenSSL.SMIMEUtils.pas +++ b/Source/OpenSSL.SMIMEUtils.pas @@ -57,7 +57,7 @@ function TSMIMEUtil.Decrypt(InputStream, OutputStream: TStream; begin Result := False; - if not (Assigned(InputStream) and Assigned(OutputStream)) + if not Assigned(InputStream) then Exit; //raise? LFlags := 0; @@ -104,7 +104,8 @@ function TSMIMEUtil.Decrypt(InputStream, OutputStream: TStream; then Exit; SetLength(LOutputBuffer, LOutputLen); BIO_read(LOutput, LOutputBuffer, LOutputLen); - OutputStream.WriteBuffer(LOutputBuffer, LOutputLen); + if Assigned(OutputStream) + then OutputStream.WriteBuffer(LOutputBuffer, LOutputLen); Result := True; end; end else @@ -120,7 +121,8 @@ function TSMIMEUtil.Decrypt(InputStream, OutputStream: TStream; then RaiseOpenSSLError('BIO_read'); if LOutputLen = 0 then Break; - OutputStream.WriteBuffer(LOutputBuffer, LOutputLen); + if Assigned(OutputStream) + then OutputStream.WriteBuffer(LOutputBuffer, LOutputLen); Result := True; end; end; From 854fa5c0d1641702fe4f74c7c78562f5687a5ba9 Mon Sep 17 00:00:00 2001 From: Mauro Baso Date: Thu, 14 May 2020 23:15:25 +0200 Subject: [PATCH 11/15] Added 10.4Sydney package --- Packages/10.4Sydney/OpenSSL.dpk | 46 ++ Packages/10.4Sydney/OpenSSL.dproj | 800 ++++++++++++++++++++++++++++++ Packages/10.4Sydney/OpenSSL.res | Bin 0 -> 628 bytes 3 files changed, 846 insertions(+) create mode 100644 Packages/10.4Sydney/OpenSSL.dpk create mode 100644 Packages/10.4Sydney/OpenSSL.dproj create mode 100644 Packages/10.4Sydney/OpenSSL.res diff --git a/Packages/10.4Sydney/OpenSSL.dpk b/Packages/10.4Sydney/OpenSSL.dpk new file mode 100644 index 0000000..6da13ac --- /dev/null +++ b/Packages/10.4Sydney/OpenSSL.dpk @@ -0,0 +1,46 @@ +package OpenSSL; + +{$R *.res} +{$IFDEF IMPLICITBUILDING This IFDEF should not be used by users} +{$ALIGN 8} +{$ASSERTIONS ON} +{$BOOLEVAL OFF} +{$DEBUGINFO OFF} +{$EXTENDEDSYNTAX ON} +{$IMPORTEDDATA ON} +{$IOCHECKS ON} +{$LOCALSYMBOLS ON} +{$LONGSTRINGS ON} +{$OPENSTRINGS ON} +{$OPTIMIZATION OFF} +{$OVERFLOWCHECKS OFF} +{$RANGECHECKS OFF} +{$REFERENCEINFO ON} +{$SAFEDIVIDE OFF} +{$STACKFRAMES ON} +{$TYPEDADDRESS OFF} +{$VARSTRINGCHECKS ON} +{$WRITEABLECONST OFF} +{$MINENUMSIZE 1} +{$IMAGEBASE $400000} +{$DEFINE DEBUG} +{$ENDIF IMPLICITBUILDING} +{$DESCRIPTION 'Delphi OpenSSL Wrapper'} +{$LIBSUFFIX '270'} +{$IMPLICITBUILD OFF} + +requires + rtl, + IndySystem, + IndyProtocols, + IndyCore; + +contains + OpenSSL.Core in '..\..\Source\OpenSSL.Core.pas', + OpenSSL.EncUtils in '..\..\Source\OpenSSL.EncUtils.pas', + OpenSSL.libeay32 in '..\..\Source\OpenSSL.libeay32.pas', + OpenSSL.RandUtils in '..\..\Source\OpenSSL.RandUtils.pas', + OpenSSL.RSAUtils in '..\..\Source\OpenSSL.RSAUtils.pas', + OpenSSL.SMIMEUtils in '..\..\Source\OpenSSL.SMIMEUtils.pas'; + +end. diff --git a/Packages/10.4Sydney/OpenSSL.dproj b/Packages/10.4Sydney/OpenSSL.dproj new file mode 100644 index 0000000..09d8e72 --- /dev/null +++ b/Packages/10.4Sydney/OpenSSL.dproj @@ -0,0 +1,800 @@ + + + {4D944443-DB16-471B-BCD5-AE06947E67E3} + OpenSSL.dpk + 19.0 + None + True + Debug + Win32 + 1 + Package + + + true + + + true + Base + true + + + true + Base + true + + + true + Cfg_1 + true + true + + + true + Base + true + + + Delphi OpenSSL Wrapper + CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments= + 1040 + OpenSSL + 270 + System;Xml;Data;Datasnap;Web;Soap;$(DCC_Namespace) + true + true + ../../Lib/$(DLLSUFFIX)/$(Platform)/$(Config) + .\$(Platform)\$(Config) + false + false + false + false + false + true + + + 1033 + Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace) + true + CompanyName=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(ModuleName);FileDescription=$(ModuleName);ProductName=$(ModuleName) + rtl;IndySystem;IndyProtocols;IndyCore;$(DCC_UsePackage) + + + DEBUG;$(DCC_Define) + true + false + true + true + true + + + CompanyName=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(MSBuildProjectName);FileDescription=$(MSBuildProjectName);ProductName=$(MSBuildProjectName) + 1033 + true + false + + + false + RELEASE;$(DCC_Define) + 0 + 0 + + + + MainSource + + + + + + + + + + + + + Cfg_2 + Base + + + Base + + + Cfg_1 + Base + + + + Delphi.Personality.12 + Package + + + + OpenSSL.dpk + + + DBExpress Enterprise Data Explorer Integration + Microsoft Office 2000 Sample Automation Server Wrapper Components + Microsoft Office XP Sample Automation Server Wrapper Components + + + + + + OpenSSL.bpl + true + + + + + OpenSSL.bpl + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + 1 + + + 0 + + + + + classes + 1 + + + classes + 1 + + + + + res\xml + 1 + + + res\xml + 1 + + + + + library\lib\armeabi-v7a + 1 + + + + + library\lib\armeabi + 1 + + + library\lib\armeabi + 1 + + + + + library\lib\armeabi-v7a + 1 + + + + + library\lib\mips + 1 + + + library\lib\mips + 1 + + + + + + library\lib\armeabi-v7a + 1 + + + library\lib\arm64-v8a + 1 + + + + + library\lib\armeabi-v7a + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\values + 1 + + + res\values + 1 + + + + + res\values-v21 + 1 + + + res\values-v21 + 1 + + + + + res\values + 1 + + + res\values + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable-xxhdpi + 1 + + + res\drawable-xxhdpi + 1 + + + + + res\drawable-ldpi + 1 + + + res\drawable-ldpi + 1 + + + + + res\drawable-mdpi + 1 + + + res\drawable-mdpi + 1 + + + + + res\drawable-hdpi + 1 + + + res\drawable-hdpi + 1 + + + + + res\drawable-xhdpi + 1 + + + res\drawable-xhdpi + 1 + + + + + res\drawable-mdpi + 1 + + + res\drawable-mdpi + 1 + + + + + res\drawable-hdpi + 1 + + + res\drawable-hdpi + 1 + + + + + res\drawable-xhdpi + 1 + + + res\drawable-xhdpi + 1 + + + + + res\drawable-xxhdpi + 1 + + + res\drawable-xxhdpi + 1 + + + + + res\drawable-xxxhdpi + 1 + + + res\drawable-xxxhdpi + 1 + + + + + res\drawable-small + 1 + + + res\drawable-small + 1 + + + + + res\drawable-normal + 1 + + + res\drawable-normal + 1 + + + + + res\drawable-large + 1 + + + res\drawable-large + 1 + + + + + res\drawable-xlarge + 1 + + + res\drawable-xlarge + 1 + + + + + res\values + 1 + + + res\values + 1 + + + + + 1 + + + 1 + + + 0 + + + + + 1 + .framework + + + 1 + .framework + + + 0 + + + + + 1 + .dylib + + + 1 + .dylib + + + 0 + .dll;.bpl + + + + + 1 + .dylib + + + 1 + .dylib + + + 1 + .dylib + + + 1 + .dylib + + + 1 + .dylib + + + 0 + .bpl + + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + 1 + + + 1 + + + 1 + + + + + 1 + + + 1 + + + 1 + + + + + 1 + + + 1 + + + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + 1 + + + 1 + + + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + 1 + + + 1 + + + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + 1 + + + 1 + + + 1 + + + + + 1 + + + 1 + + + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + 1 + + + 1 + + + + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + 1 + + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + 1 + + + + + + + + + 1 + + + 1 + + + 1 + + + + + + + + Contents\Resources + 1 + + + Contents\Resources + 1 + + + + + library\lib\armeabi-v7a + 1 + + + library\lib\arm64-v8a + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + 0 + + + + + library\lib\armeabi-v7a + 1 + + + + + 1 + + + 1 + + + + + Assets + 1 + + + Assets + 1 + + + + + Assets + 1 + + + Assets + 1 + + + + + + + + + + + + + + + True + + + 12 + + + + + diff --git a/Packages/10.4Sydney/OpenSSL.res b/Packages/10.4Sydney/OpenSSL.res new file mode 100644 index 0000000000000000000000000000000000000000..d65fdc7f3ee0e39e371f2f52463c27bb46d17582 GIT binary patch literal 628 zcmZ9KK}*9x5QSeP2kXhBM-QGQLJkUo6sl6Ft+b(6i8YpjO-iCa&wu0HOV7q{HeG8n zFq_HFdoOQxBT1)ZT{lVDif!Qg$6$CNBK1NK+6FP@Tr)kf-fBuU)I?+6hpczh7N6nw zk7WEt!#{6aS2980*=;FdBS7z6rB=$dL~W%vWhm!*RRJ(^m`E|MuE-b<<|xu3T#ui_ zDOJHPU|L-09E?xFG5jN_LNEHzg0FU2UCu}+f1D-ERBN0Koc;oxHToIrGo2E}6lL>K zus_j;I%m3>Mldd0eh2g_7&i9?Cwt#rUNdLg_t-hfoR2Qv+yzW#j{NEDPg6Q`H<8dy uaaVELY3uvF@GCq( Date: Wed, 31 Mar 2021 12:15:34 +0200 Subject: [PATCH 12/15] Project updated to Delphi 10.4.2 --- Packages/10.4Sydney/OpenSSL.dpk | 3 +- Packages/10.4Sydney/OpenSSL.dproj | 174 ++++++++++++++++++++++++++++-- 2 files changed, 166 insertions(+), 11 deletions(-) diff --git a/Packages/10.4Sydney/OpenSSL.dpk b/Packages/10.4Sydney/OpenSSL.dpk index 6da13ac..fac9b73 100644 --- a/Packages/10.4Sydney/OpenSSL.dpk +++ b/Packages/10.4Sydney/OpenSSL.dpk @@ -41,6 +41,7 @@ contains OpenSSL.libeay32 in '..\..\Source\OpenSSL.libeay32.pas', OpenSSL.RandUtils in '..\..\Source\OpenSSL.RandUtils.pas', OpenSSL.RSAUtils in '..\..\Source\OpenSSL.RSAUtils.pas', - OpenSSL.SMIMEUtils in '..\..\Source\OpenSSL.SMIMEUtils.pas'; + OpenSSL.SMIMEUtils in '..\..\Source\OpenSSL.SMIMEUtils.pas', + OpenSSL.CMSHeaders in '..\..\Source\OpenSSL.CMSHeaders.pas'; end. diff --git a/Packages/10.4Sydney/OpenSSL.dproj b/Packages/10.4Sydney/OpenSSL.dproj index 09d8e72..8c5b45b 100644 --- a/Packages/10.4Sydney/OpenSSL.dproj +++ b/Packages/10.4Sydney/OpenSSL.dproj @@ -2,7 +2,7 @@ {4D944443-DB16-471B-BCD5-AE06947E67E3} OpenSSL.dpk - 19.0 + 19.2 None True Debug @@ -18,6 +18,11 @@ Base true + + true + Base + true + true Base @@ -59,6 +64,13 @@ CompanyName=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(ModuleName);FileDescription=$(ModuleName);ProductName=$(ModuleName) rtl;IndySystem;IndyProtocols;IndyCore;$(DCC_UsePackage) + + Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace) + Debug + true + CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments= + 1033 + DEBUG;$(DCC_Define) true @@ -93,6 +105,7 @@ + Cfg_2 Base @@ -120,23 +133,17 @@ - - - OpenSSL.bpl + + true - + OpenSSL.bpl true - - - true - - true @@ -299,6 +306,16 @@ 1 + + + res\drawable-xxxhdpi + 1 + + + res\drawable-xxxhdpi + 1 + + res\drawable-ldpi @@ -529,6 +546,32 @@ 0 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + 1 @@ -593,6 +636,56 @@ 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset @@ -666,6 +759,66 @@ 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + 1 @@ -790,6 +943,7 @@ True + False 12 From b54747615d2e7b3986ca4e8f1ef3dc4526aaf1f3 Mon Sep 17 00:00:00 2001 From: Mauro Baso Date: Sat, 25 Sep 2021 00:03:52 +0200 Subject: [PATCH 13/15] Added 11.0Alexandria package --- Packages/11.0Alexandria/OpenSSL.dpk | 47 ++ Packages/11.0Alexandria/OpenSSL.dproj | 987 ++++++++++++++++++++++++++ Packages/11.0Alexandria/OpenSSL.res | Bin 0 -> 628 bytes 3 files changed, 1034 insertions(+) create mode 100644 Packages/11.0Alexandria/OpenSSL.dpk create mode 100644 Packages/11.0Alexandria/OpenSSL.dproj create mode 100644 Packages/11.0Alexandria/OpenSSL.res diff --git a/Packages/11.0Alexandria/OpenSSL.dpk b/Packages/11.0Alexandria/OpenSSL.dpk new file mode 100644 index 0000000..ed0ea43 --- /dev/null +++ b/Packages/11.0Alexandria/OpenSSL.dpk @@ -0,0 +1,47 @@ +package OpenSSL; + +{$R *.res} +{$IFDEF IMPLICITBUILDING This IFDEF should not be used by users} +{$ALIGN 8} +{$ASSERTIONS ON} +{$BOOLEVAL OFF} +{$DEBUGINFO OFF} +{$EXTENDEDSYNTAX ON} +{$IMPORTEDDATA ON} +{$IOCHECKS ON} +{$LOCALSYMBOLS ON} +{$LONGSTRINGS ON} +{$OPENSTRINGS ON} +{$OPTIMIZATION OFF} +{$OVERFLOWCHECKS OFF} +{$RANGECHECKS OFF} +{$REFERENCEINFO ON} +{$SAFEDIVIDE OFF} +{$STACKFRAMES ON} +{$TYPEDADDRESS OFF} +{$VARSTRINGCHECKS ON} +{$WRITEABLECONST OFF} +{$MINENUMSIZE 1} +{$IMAGEBASE $400000} +{$DEFINE DEBUG} +{$ENDIF IMPLICITBUILDING} +{$DESCRIPTION 'Delphi OpenSSL Wrapper'} +{$LIBSUFFIX '280'} +{$IMPLICITBUILD OFF} + +requires + rtl, + IndySystem, + IndyProtocols, + IndyCore; + +contains + OpenSSL.Core in '..\..\Source\OpenSSL.Core.pas', + OpenSSL.EncUtils in '..\..\Source\OpenSSL.EncUtils.pas', + OpenSSL.libeay32 in '..\..\Source\OpenSSL.libeay32.pas', + OpenSSL.RandUtils in '..\..\Source\OpenSSL.RandUtils.pas', + OpenSSL.RSAUtils in '..\..\Source\OpenSSL.RSAUtils.pas', + OpenSSL.SMIMEUtils in '..\..\Source\OpenSSL.SMIMEUtils.pas', + OpenSSL.CMSHeaders in '..\..\Source\OpenSSL.CMSHeaders.pas'; + +end. diff --git a/Packages/11.0Alexandria/OpenSSL.dproj b/Packages/11.0Alexandria/OpenSSL.dproj new file mode 100644 index 0000000..ce26cd5 --- /dev/null +++ b/Packages/11.0Alexandria/OpenSSL.dproj @@ -0,0 +1,987 @@ + + + {4D944443-DB16-471B-BCD5-AE06947E67E3} + OpenSSL.dpk + 19.3 + None + True + Debug + Win32 + 1 + Package + + + true + + + true + Base + true + + + true + Base + true + + + true + Base + true + + + true + Cfg_1 + true + true + + + true + Base + true + + + Delphi OpenSSL Wrapper + CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments= + 1040 + OpenSSL + 280 + System;Xml;Data;Datasnap;Web;Soap;$(DCC_Namespace) + true + true + ../../Lib/$(DLLSUFFIX)/$(Platform)/$(Config) + .\$(Platform)\$(Config) + false + false + false + false + false + true + + + 1033 + Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace) + true + CompanyName=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(ModuleName);FileDescription=$(ModuleName);ProductName=$(ModuleName) + rtl;IndySystem;IndyProtocols;IndyCore;$(DCC_UsePackage) + + + Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace) + Debug + true + CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments= + 1033 + + + DEBUG;$(DCC_Define) + true + false + true + true + true + + + CompanyName=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(MSBuildProjectName);FileDescription=$(MSBuildProjectName);ProductName=$(MSBuildProjectName) + 1033 + true + false + + + false + RELEASE;$(DCC_Define) + 0 + 0 + + + + MainSource + + + + + + + + + + + + + + Base + + + Cfg_1 + Base + + + Cfg_2 + Base + + + + Delphi.Personality.12 + Package + + + + OpenSSL.dpk + + + DBExpress Enterprise Data Explorer Integration + Microsoft Office 2000 Sample Automation Server Wrapper Components + Microsoft Office XP Sample Automation Server Wrapper Components + + + + + + true + + + + + true + + + + + OpenSSL.bpl + true + + + + + true + + + + + true + + + + + true + + + + + true + + + + + 1 + + + 0 + + + + + classes + 64 + + + classes + 64 + + + + + classes + 1 + + + classes + 1 + + + + + res\xml + 1 + + + res\xml + 1 + + + + + library\lib\armeabi-v7a + 1 + + + + + library\lib\armeabi + 1 + + + library\lib\armeabi + 1 + + + + + library\lib\armeabi-v7a + 1 + + + + + library\lib\mips + 1 + + + library\lib\mips + 1 + + + + + + library\lib\armeabi-v7a + 1 + + + library\lib\arm64-v8a + 1 + + + + + library\lib\armeabi-v7a + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\values + 1 + + + res\values + 1 + + + + + res\values-v21 + 1 + + + res\values-v21 + 1 + + + + + res\values + 1 + + + res\values + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable-xxhdpi + 1 + + + res\drawable-xxhdpi + 1 + + + + + res\drawable-xxxhdpi + 1 + + + res\drawable-xxxhdpi + 1 + + + + + res\drawable-ldpi + 1 + + + res\drawable-ldpi + 1 + + + + + res\drawable-mdpi + 1 + + + res\drawable-mdpi + 1 + + + + + res\drawable-hdpi + 1 + + + res\drawable-hdpi + 1 + + + + + res\drawable-xhdpi + 1 + + + res\drawable-xhdpi + 1 + + + + + res\drawable-mdpi + 1 + + + res\drawable-mdpi + 1 + + + + + res\drawable-hdpi + 1 + + + res\drawable-hdpi + 1 + + + + + res\drawable-xhdpi + 1 + + + res\drawable-xhdpi + 1 + + + + + res\drawable-xxhdpi + 1 + + + res\drawable-xxhdpi + 1 + + + + + res\drawable-xxxhdpi + 1 + + + res\drawable-xxxhdpi + 1 + + + + + res\drawable-small + 1 + + + res\drawable-small + 1 + + + + + res\drawable-normal + 1 + + + res\drawable-normal + 1 + + + + + res\drawable-large + 1 + + + res\drawable-large + 1 + + + + + res\drawable-xlarge + 1 + + + res\drawable-xlarge + 1 + + + + + res\values + 1 + + + res\values + 1 + + + + + 1 + + + 1 + + + 0 + + + + + 1 + .framework + + + 1 + .framework + + + 1 + .framework + + + 0 + + + + + 1 + .dylib + + + 1 + .dylib + + + 1 + .dylib + + + 0 + .dll;.bpl + + + + + 1 + .dylib + + + 1 + .dylib + + + 1 + .dylib + + + 1 + .dylib + + + 1 + .dylib + + + 1 + .dylib + + + 0 + .bpl + + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + 1 + + + 1 + + + 1 + + + + + 1 + + + 1 + + + 1 + + + + + 1 + + + 1 + + + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + 1 + + + 1 + + + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + 1 + + + 1 + + + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + 1 + + + 1 + + + 1 + + + + + 1 + + + 1 + + + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + 1 + + + 1 + + + + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + 1 + + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + 1 + + + + + + + + + 1 + + + 1 + + + 1 + + + + + + + + Contents\Resources + 1 + + + Contents\Resources + 1 + + + Contents\Resources + 1 + + + + + library\lib\armeabi-v7a + 1 + + + library\lib\arm64-v8a + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + 0 + + + + + library\lib\armeabi-v7a + 1 + + + + + 1 + + + 1 + + + + + Assets + 1 + + + Assets + 1 + + + + + Assets + 1 + + + Assets + 1 + + + + + + + + + + + + + + + + True + False + + + 12 + + + + + diff --git a/Packages/11.0Alexandria/OpenSSL.res b/Packages/11.0Alexandria/OpenSSL.res new file mode 100644 index 0000000000000000000000000000000000000000..d65fdc7f3ee0e39e371f2f52463c27bb46d17582 GIT binary patch literal 628 zcmZ9KK}*9x5QSeP2kXhBM-QGQLJkUo6sl6Ft+b(6i8YpjO-iCa&wu0HOV7q{HeG8n zFq_HFdoOQxBT1)ZT{lVDif!Qg$6$CNBK1NK+6FP@Tr)kf-fBuU)I?+6hpczh7N6nw zk7WEt!#{6aS2980*=;FdBS7z6rB=$dL~W%vWhm!*RRJ(^m`E|MuE-b<<|xu3T#ui_ zDOJHPU|L-09E?xFG5jN_LNEHzg0FU2UCu}+f1D-ERBN0Koc;oxHToIrGo2E}6lL>K zus_j;I%m3>Mldd0eh2g_7&i9?Cwt#rUNdLg_t-hfoR2Qv+yzW#j{NEDPg6Q`H<8dy uaaVELY3uvF@GCq( Date: Mon, 4 Dec 2023 13:05:04 +0100 Subject: [PATCH 14/15] Added 12.0Athens package --- Packages/12.0Athens/OpenSSL.dpk | 47 ++ Packages/12.0Athens/OpenSSL.dproj | 1014 +++++++++++++++++++++++++++++ Packages/12.0Athens/OpenSSL.res | Bin 0 -> 628 bytes 3 files changed, 1061 insertions(+) create mode 100644 Packages/12.0Athens/OpenSSL.dpk create mode 100644 Packages/12.0Athens/OpenSSL.dproj create mode 100644 Packages/12.0Athens/OpenSSL.res diff --git a/Packages/12.0Athens/OpenSSL.dpk b/Packages/12.0Athens/OpenSSL.dpk new file mode 100644 index 0000000..b901eb2 --- /dev/null +++ b/Packages/12.0Athens/OpenSSL.dpk @@ -0,0 +1,47 @@ +package OpenSSL; + +{$R *.res} +{$IFDEF IMPLICITBUILDING This IFDEF should not be used by users} +{$ALIGN 8} +{$ASSERTIONS ON} +{$BOOLEVAL OFF} +{$DEBUGINFO OFF} +{$EXTENDEDSYNTAX ON} +{$IMPORTEDDATA ON} +{$IOCHECKS ON} +{$LOCALSYMBOLS ON} +{$LONGSTRINGS ON} +{$OPENSTRINGS ON} +{$OPTIMIZATION OFF} +{$OVERFLOWCHECKS OFF} +{$RANGECHECKS OFF} +{$REFERENCEINFO ON} +{$SAFEDIVIDE OFF} +{$STACKFRAMES ON} +{$TYPEDADDRESS OFF} +{$VARSTRINGCHECKS ON} +{$WRITEABLECONST OFF} +{$MINENUMSIZE 1} +{$IMAGEBASE $400000} +{$DEFINE DEBUG} +{$ENDIF IMPLICITBUILDING} +{$DESCRIPTION 'Delphi OpenSSL Wrapper'} +{$LIBSUFFIX '290'} +{$IMPLICITBUILD OFF} + +requires + rtl, + IndySystem, + IndyProtocols, + IndyCore; + +contains + OpenSSL.Core in '..\..\Source\OpenSSL.Core.pas', + OpenSSL.EncUtils in '..\..\Source\OpenSSL.EncUtils.pas', + OpenSSL.libeay32 in '..\..\Source\OpenSSL.libeay32.pas', + OpenSSL.RandUtils in '..\..\Source\OpenSSL.RandUtils.pas', + OpenSSL.RSAUtils in '..\..\Source\OpenSSL.RSAUtils.pas', + OpenSSL.SMIMEUtils in '..\..\Source\OpenSSL.SMIMEUtils.pas', + OpenSSL.CMSHeaders in '..\..\Source\OpenSSL.CMSHeaders.pas'; + +end. diff --git a/Packages/12.0Athens/OpenSSL.dproj b/Packages/12.0Athens/OpenSSL.dproj new file mode 100644 index 0000000..555d7a1 --- /dev/null +++ b/Packages/12.0Athens/OpenSSL.dproj @@ -0,0 +1,1014 @@ + + + {4D944443-DB16-471B-BCD5-AE06947E67E3} + OpenSSL.dpk + 20.1 + None + True + Debug + Win32 + 1 + Package + + + true + + + true + Base + true + + + true + Base + true + + + true + Base + true + + + true + Cfg_1 + true + true + + + true + Base + true + + + Delphi OpenSSL Wrapper + CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments= + 1040 + OpenSSL + 290 + System;Xml;Data;Datasnap;Web;Soap;$(DCC_Namespace) + true + true + ../../Lib/$(DLLSUFFIX)/$(Platform)/$(Config) + .\$(Platform)\$(Config) + false + false + false + false + false + true + + + 1033 + Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace) + true + CompanyName=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(ModuleName);FileDescription=$(ModuleName);ProductName=$(ModuleName) + rtl;IndySystem;IndyProtocols;IndyCore;$(DCC_UsePackage) + + + Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace) + Debug + true + CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments= + 1033 + + + DEBUG;$(DCC_Define) + true + false + true + true + true + + + CompanyName=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(MSBuildProjectName);FileDescription=$(MSBuildProjectName);ProductName=$(MSBuildProjectName) + 1033 + true + false + + + false + RELEASE;$(DCC_Define) + 0 + 0 + + + + MainSource + + + + + + + + + + + + + + Base + + + Cfg_1 + Base + + + Cfg_2 + Base + + + + Delphi.Personality.12 + Package + + + + OpenSSL.dpk + + + DBExpress Enterprise Data Explorer Integration + Microsoft Office 2000 Sample Automation Server Wrapper Components + Microsoft Office XP Sample Automation Server Wrapper Components + + + + + + + true + + + + + true + + + + + + true + + + + + + + 1 + + + 0 + + + + + classes + 64 + + + classes + 64 + + + + + res\xml + 1 + + + res\xml + 1 + + + + + library\lib\armeabi + 1 + + + library\lib\armeabi + 1 + + + + + library\lib\armeabi-v7a + 1 + + + + + library\lib\mips + 1 + + + library\lib\mips + 1 + + + + + library\lib\armeabi-v7a + 1 + + + library\lib\arm64-v8a + 1 + + + + + library\lib\armeabi-v7a + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable-anydpi-v21 + 1 + + + res\drawable-anydpi-v21 + 1 + + + + + res\values + 1 + + + res\values + 1 + + + + + res\values-v21 + 1 + + + res\values-v21 + 1 + + + + + res\values-v31 + 1 + + + res\values-v31 + 1 + + + + + res\drawable-anydpi-v26 + 1 + + + res\drawable-anydpi-v26 + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable-anydpi-v33 + 1 + + + res\drawable-anydpi-v33 + 1 + + + + + res\values + 1 + + + res\values + 1 + + + + + res\values-night-v21 + 1 + + + res\values-night-v21 + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable-xxhdpi + 1 + + + res\drawable-xxhdpi + 1 + + + + + res\drawable-xxxhdpi + 1 + + + res\drawable-xxxhdpi + 1 + + + + + res\drawable-ldpi + 1 + + + res\drawable-ldpi + 1 + + + + + res\drawable-mdpi + 1 + + + res\drawable-mdpi + 1 + + + + + res\drawable-hdpi + 1 + + + res\drawable-hdpi + 1 + + + + + res\drawable-xhdpi + 1 + + + res\drawable-xhdpi + 1 + + + + + res\drawable-mdpi + 1 + + + res\drawable-mdpi + 1 + + + + + res\drawable-hdpi + 1 + + + res\drawable-hdpi + 1 + + + + + res\drawable-xhdpi + 1 + + + res\drawable-xhdpi + 1 + + + + + res\drawable-xxhdpi + 1 + + + res\drawable-xxhdpi + 1 + + + + + res\drawable-xxxhdpi + 1 + + + res\drawable-xxxhdpi + 1 + + + + + res\drawable-small + 1 + + + res\drawable-small + 1 + + + + + res\drawable-normal + 1 + + + res\drawable-normal + 1 + + + + + res\drawable-large + 1 + + + res\drawable-large + 1 + + + + + res\drawable-xlarge + 1 + + + res\drawable-xlarge + 1 + + + + + res\values + 1 + + + res\values + 1 + + + + + res\drawable-anydpi-v24 + 1 + + + res\drawable-anydpi-v24 + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable-night-anydpi-v21 + 1 + + + res\drawable-night-anydpi-v21 + 1 + + + + + res\drawable-anydpi-v31 + 1 + + + res\drawable-anydpi-v31 + 1 + + + + + res\drawable-night-anydpi-v31 + 1 + + + res\drawable-night-anydpi-v31 + 1 + + + + + 1 + + + 1 + + + 0 + + + + + 1 + .framework + + + 1 + .framework + + + 1 + .framework + + + 0 + + + + + 1 + .dylib + + + 1 + .dylib + + + 1 + .dylib + + + 0 + .dll;.bpl + + + + + 1 + .dylib + + + 1 + .dylib + + + 1 + .dylib + + + 1 + .dylib + + + 1 + .dylib + + + 1 + .dylib + + + 0 + .bpl + + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + 1 + + + 1 + + + + + + + + Contents\Resources + 1 + + + Contents\Resources + 1 + + + Contents\Resources + 1 + + + + + library\lib\armeabi-v7a + 1 + + + library\lib\arm64-v8a + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + 0 + + + + + library\lib\armeabi-v7a + 1 + + + + + 1 + + + 1 + + + + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + 1 + + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + 1 + + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + 1 + + + + + + + + 1 + + + 1 + + + 1 + + + + + Assets + 1 + + + Assets + 1 + + + + + Assets + 1 + + + Assets + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + + + + + + + + + + + + + + + + + True + False + + + 12 + + + + + diff --git a/Packages/12.0Athens/OpenSSL.res b/Packages/12.0Athens/OpenSSL.res new file mode 100644 index 0000000000000000000000000000000000000000..d65fdc7f3ee0e39e371f2f52463c27bb46d17582 GIT binary patch literal 628 zcmZ9KK}*9x5QSeP2kXhBM-QGQLJkUo6sl6Ft+b(6i8YpjO-iCa&wu0HOV7q{HeG8n zFq_HFdoOQxBT1)ZT{lVDif!Qg$6$CNBK1NK+6FP@Tr)kf-fBuU)I?+6hpczh7N6nw zk7WEt!#{6aS2980*=;FdBS7z6rB=$dL~W%vWhm!*RRJ(^m`E|MuE-b<<|xu3T#ui_ zDOJHPU|L-09E?xFG5jN_LNEHzg0FU2UCu}+f1D-ERBN0Koc;oxHToIrGo2E}6lL>K zus_j;I%m3>Mldd0eh2g_7&i9?Cwt#rUNdLg_t-hfoR2Qv+yzW#j{NEDPg6Q`H<8dy uaaVELY3uvF@GCq( Date: Tue, 23 Sep 2025 09:50:54 +0200 Subject: [PATCH 15/15] Add support for Delphi 12 and above --- .gitignore | 2 +- .../OpenSSL.dpk | 2 +- .../OpenSSL.dproj | 50 ++++++++++++------ .../OpenSSL.res | Bin 628 -> 628 bytes version.txt | 2 + 5 files changed, 38 insertions(+), 18 deletions(-) rename Packages/{12.0Athens => 12.0AthensAndAbove}/OpenSSL.dpk (98%) rename Packages/{12.0Athens => 12.0AthensAndAbove}/OpenSSL.dproj (96%) rename Packages/{12.0Athens => 12.0AthensAndAbove}/OpenSSL.res (89%) create mode 100644 version.txt diff --git a/.gitignore b/.gitignore index 4387b74..c1421ea 100644 --- a/.gitignore +++ b/.gitignore @@ -9,10 +9,10 @@ __history *.stat TestData/.rnd *.pem -*.txt *.certcry *.keycry .rnd TestData/*.cnf TestData/*.p7m TestData/TestPKCS7-out.pdf +Packages/12.0AthensAndAbove/37.0 diff --git a/Packages/12.0Athens/OpenSSL.dpk b/Packages/12.0AthensAndAbove/OpenSSL.dpk similarity index 98% rename from Packages/12.0Athens/OpenSSL.dpk rename to Packages/12.0AthensAndAbove/OpenSSL.dpk index b901eb2..79c1fe4 100644 --- a/Packages/12.0Athens/OpenSSL.dpk +++ b/Packages/12.0AthensAndAbove/OpenSSL.dpk @@ -26,7 +26,7 @@ package OpenSSL; {$DEFINE DEBUG} {$ENDIF IMPLICITBUILDING} {$DESCRIPTION 'Delphi OpenSSL Wrapper'} -{$LIBSUFFIX '290'} +{$LIBSUFFIX AUTO} {$IMPLICITBUILD OFF} requires diff --git a/Packages/12.0Athens/OpenSSL.dproj b/Packages/12.0AthensAndAbove/OpenSSL.dproj similarity index 96% rename from Packages/12.0Athens/OpenSSL.dproj rename to Packages/12.0AthensAndAbove/OpenSSL.dproj index 555d7a1..c885507 100644 --- a/Packages/12.0Athens/OpenSSL.dproj +++ b/Packages/12.0AthensAndAbove/OpenSSL.dproj @@ -2,13 +2,14 @@ {4D944443-DB16-471B-BCD5-AE06947E67E3} OpenSSL.dpk - 20.1 + 20.3 None True Debug Win32 1 Package + OpenSSL true @@ -23,6 +24,11 @@ Base true + + true + Base + true + true Base @@ -44,7 +50,7 @@ CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments= 1040 OpenSSL - 290 + $(Auto) System;Xml;Data;Datasnap;Web;Soap;$(DCC_Namespace) true true @@ -71,6 +77,14 @@ CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments= 1033 + + Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace) + Debug + true + CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments= + 1033 + true + DEBUG;$(DCC_Define) true @@ -127,12 +141,11 @@ OpenSSL.dpk - DBExpress Enterprise Data Explorer Integration - Microsoft Office 2000 Sample Automation Server Wrapper Components - Microsoft Office XP Sample Automation Server Wrapper Components + Microsoft Office 2000 Sample Automation Server Wrapper Components + Microsoft Office XP Sample Automation Server Wrapper Components - + @@ -160,16 +173,6 @@ 0 - - - classes - 64 - - - classes - 64 - - res\xml @@ -272,6 +275,16 @@ 1 + + + res\values-v35 + 1 + + + res\values-v35 + 1 + + res\drawable-anydpi-v26 @@ -739,6 +752,9 @@ 1 + + 1 + @@ -1000,10 +1016,12 @@ + True False + False 12 diff --git a/Packages/12.0Athens/OpenSSL.res b/Packages/12.0AthensAndAbove/OpenSSL.res similarity index 89% rename from Packages/12.0Athens/OpenSSL.res rename to Packages/12.0AthensAndAbove/OpenSSL.res index d65fdc7f3ee0e39e371f2f52463c27bb46d17582..22f419c9eee2278f38181b6d2980f4b566c374ec 100644 GIT binary patch delta 13 Ucmeyu@`YuC2@@mBWK$-403vGx