View Issue Details

IDProjectCategoryView StatusLast Update
0006453JEDI API & WSC LibraryMicrosoft Crypto APIpublic2018-12-10 07:40
ReporterVincentAssigned To 
PrioritynormalSeverityfeatureReproducibilityalways
Status newResolutionopen 
Summary0006453: Wcrypt2.pas update
DescriptionI need some CryptoAPI features for my code here :
https://github.com/delphiunderground/eid-mw-sdk-delphi

I would like to contribute to Wcrypt2.pas update and I uploaded a patch in attachment.
Additional InformationI assume that the latest version of Wcrypt2.pas is here :
http://sourceforge.net/p/projectjedi/website/HEAD/tree/trunk/delphi-jedi.org/www/files/api/CryptoAPI2.zip
TagsNo tags attached.

Activities

2015-10-01 18:14

 

wcrypt2-update.patch (5,749 bytes)
--- Wcrypt2.pas	2000-07-20 12:42:52.000000000 +0200
+++ delphiunderground/eid-mw-sdk-delphi/wcrypt2.pas	2015-09-22 17:34:44.284678590 +0200
@@ -18,6 +18,7 @@
 { Contributor(s):                                                  }
 {     Peter Tang (peter.tang@citicorp.com)                         }
 {     Phil Shrimpton (phil@shrimpton.co.uk)                        }
+{     Vincent Hardy (vincent.hardy.be@gmail.com)                   }
 {                                                                  }
 { Obtained through:                                                }
 {                                                                  }
@@ -151,6 +152,14 @@
   ALD_SID_SAFERSK128     = 8;
   ALG_SID_SAFERSK128     = 8;
   ALG_SID_3DES_112       = 9;
+  // AES sub_ids
+  //algorithm identifier got from
+  //https://msdn.microsoft.com/en-us/library/windows/desktop/aa375549%28v=vs.85%29.aspx
+  ALG_SID_AES_128        = 14;
+  ALG_SID_AES_192        = 15;
+  ALG_SID_AES_256        = 16;
+  ALG_SID_AES            = 17;
+  //---------------------------------------------------------------------------
   ALG_SID_CYLINK_MEK     = 12;
   ALG_SID_RC5            = 13;
 
@@ -221,6 +230,10 @@
   CALG_DES              = (ALG_CLASS_DATA_ENCRYPT or ALG_TYPE_BLOCK or ALG_SID_DES);
   CALG_3DES_112         = (ALG_CLASS_DATA_ENCRYPT or ALG_TYPE_BLOCK or ALG_SID_3DES_112);
   CALG_3DES             = (ALG_CLASS_DATA_ENCRYPT or ALG_TYPE_BLOCK or ALG_SID_3DES);
+  CALG_AES_128          = (ALG_CLASS_DATA_ENCRYPT or ALG_TYPE_BLOCK or ALG_SID_AES_128);
+  CALG_AES_192          = (ALG_CLASS_DATA_ENCRYPT or ALG_TYPE_BLOCK or ALG_SID_AES_192);
+  CALG_AES_256          = (ALG_CLASS_DATA_ENCRYPT or ALG_TYPE_BLOCK or ALG_SID_AES_256);
+  CALG_AES              = (ALG_CLASS_DATA_ENCRYPT or ALG_TYPE_BLOCK or ALG_SID_AES);
   CALG_RC2              = (ALG_CLASS_DATA_ENCRYPT or ALG_TYPE_BLOCK or ALG_SID_RC2);
   CALG_RC4              = (ALG_CLASS_DATA_ENCRYPT or ALG_TYPE_STREAM or ALG_SID_RC4);
   CALG_SEAL             = (ALG_CLASS_DATA_ENCRYPT or ALG_TYPE_STREAM or ALG_SID_SEAL);
@@ -432,6 +445,7 @@
 PROV_EC_ECDSA_FULL       = 16;
 PROV_EC_ECNRA_FULL       = 17;
 PROV_SPYRUS_LYNKS        = 20;
+PROV_RSA_AES             = 24;
 
 
   // STT defined Providers
@@ -6897,6 +6911,55 @@
                        pcbEncoded :PDWORD;
                    var ppszError :array of LPAWSTR):BOOL ; stdcall;
 
+//+-------------------------------------------------------------------------
+//--------------------------------------------------------------------------
+function CertGetNameStringA(pCertContext :PCCERT_CONTEXT;
+                            dwType :DWORD;
+                            dwFlags :DWORD;
+                            pvTypePara :PVOID;
+                            pszNameString :LPSTR;
+                            cchNameString :DWORD):DWORD ; stdcall;
+//+-------------------------------------------------------------------------
+//--------------------------------------------------------------------------
+function CertGetNameStringW(pCertContext :PCCERT_CONTEXT;
+                            dwType :DWORD;
+                            dwFlags :DWORD;
+                            pvTypePara :PVOID;
+                            pszNameString :LPWSTR;
+                            cchNameString :DWORD):DWORD ; stdcall;
+
+function CertGetNameString(pCertContext :PCCERT_CONTEXT;
+                           dwType :DWORD;
+                           dwFlags :DWORD;
+                           pvTypePara :PVOID;
+                           pszNameString :LPAWSTR;
+                           cchNameString :DWORD):DWORD ; stdcall;
+//+-------------------------------------------------------------------------
+//  Certificate name types
+//--------------------------------------------------------------------------
+const
+  CERT_NAME_EMAIL_TYPE            = 1;
+  CERT_NAME_RDN_TYPE              = 2;
+  CERT_NAME_ATTR_TYPE             = 3;
+  CERT_NAME_SIMPLE_DISPLAY_TYPE   = 4;
+  CERT_NAME_FRIENDLY_DISPLAY_TYPE = 5;
+  CERT_NAME_DNS_TYPE              = 6;
+  CERT_NAME_URL_TYPE              = 7;
+  CERT_NAME_UPN_TYPE              = 8;
+
+//+-------------------------------------------------------------------------
+//  Certificate name flags
+//--------------------------------------------------------------------------
+  CERT_NAME_ISSUER_FLAG           = $1;
+  CERT_NAME_DISABLE_IE4_UTF8_FLAG = $00010000;
+
+
+// Following is only applicable to CERT_NAME_DNS_TYPE. When set returns
+// all names not just the first one. Returns a multi-string. Each string
+// will be null terminated. The last string will be double null terminated.
+  CERT_NAME_SEARCH_ALL_NAMES_FLAG = $2;
+
+
 //+=========================================================================
 //  Simplified Cryptographic Message Data Structures and APIs
 //==========================================================================
@@ -7833,6 +7896,13 @@
 {$ELSE}
 function CertStrToName; external CRYPT32 name 'CertStrToNameA';
 {$ENDIF} // !UNICODE
+function CertGetNameStringW; external CRYPT32 name 'CertGetNameStringW';
+function CertGetNameStringA; external CRYPT32 name 'CertGetNameStringA';
+{$IFDEF UNICODE}
+function CertGetNameString; external CRYPT32 name 'CertGetNameStringW';
+{$ELSE}
+function CertGetNameString; external CRYPT32 name 'CertGetNameStringA';
+{$ENDIF} // !UNICODE
 function CryptSignMessage; external CRYPT32 name 'CryptSignMessage';
 //function CryptSignMessageWithKey; external CRYPT32 name 'CryptSignMessageWithKey';
 function CryptVerifyMessageSignature; external CRYPT32 name 'CryptVerifyMessageSignature';
wcrypt2-update.patch (5,749 bytes)

themeheart

2018-12-10 07:40

reporter   ~0021596

Last edited: 2018-12-10 07:40

https://www.themeheart.com

Issue History

Date Modified Username Field Change
2015-10-01 18:14 Vincent New Issue
2015-10-01 18:14 Vincent File Added: wcrypt2-update.patch
2018-12-10 07:40 themeheart Note Added: 0021596
2018-12-10 07:40 themeheart Note Edited: 0021596