diff --git a/.gitignore b/.gitignore index fababbd..b630e21 100644 --- a/.gitignore +++ b/.gitignore @@ -11,4 +11,5 @@ Demo/Programs/**.dll Demo/AppHtml/CssThemes Demo/AppHtml/DfEngine Demo/AppHtml/web.config -Demo/AppHtml/global.asa \ No newline at end of file +Demo/AppHtml/global.asa +**/DfPkg diff --git a/Library/DFSecurity-CNG/AppSrc/CNG/CNG.pkg b/Library/DFSecurity-CNG/AppSrc/CNG/CNG.pkg index a85e421..98b477c 100644 --- a/Library/DFSecurity-CNG/AppSrc/CNG/CNG.pkg +++ b/Library/DFSecurity-CNG/AppSrc/CNG/CNG.pkg @@ -907,12 +907,17 @@ Class cCryptoApiNextGen_CryptographicPrimitiveFunctions_Mixin is a Mixin Function BCryptDuplicateHash Handle hHash Returns tHandleAndPointer Handle hAlgProv Integer iStatus + UChar[] ucaProviderHandle UInteger cbHashObject Void_Type void tHandleAndPointer NewHashObject // Get puiObjectLength of CryptoApiNextGen to cbHashObject - Get BCryptNamedUIntegerPropertyValue hHash BCRYPT_PROVIDER_HANDLE to hAlgProv + // BCRYPT_PROVIDER_HANDLE is a native Handle (8 bytes on x64), not a UInteger (4 bytes). + // BCryptNamedUIntegerPropertyValue's size check silently returns 0 for it, so fetch it directly here. + Get BCryptNamedPropertyValue hHash BCRYPT_PROVIDER_HANDLE to ucaProviderHandle + Move 0 to hAlgProv + If (SizeOfArray(ucaProviderHandle) = SizeOfType(Handle)) Move (MemCopy(AddressOf(hAlgProv), AddressOf(ucaProviderHandle), SizeOfType(Handle))) to void Get BCryptNamedUIntegerPropertyValue hAlgProv BCRYPT_OBJECT_LENGTH to cbHashObject Move (Alloc(cbHashObject)) to NewHashObject.pPointer @@ -933,11 +938,16 @@ Class cCryptoApiNextGen_CryptographicPrimitiveFunctions_Mixin is a Mixin Function BCryptDuplicateKey Handle hKey Returns tHandleAndPointer Handle hAlgProv Integer iStatus + UChar[] ucaProviderHandle UInteger cbKeyObject Void_Type void tHandleAndPointer NewKeyObject - Get BCryptNamedUIntegerPropertyValue hKey BCRYPT_PROVIDER_HANDLE to hAlgProv + // BCRYPT_PROVIDER_HANDLE is a native Handle (8 bytes on x64), not a UInteger (4 bytes). + // BCryptNamedUIntegerPropertyValue's size check silently returns 0 for it, so fetch it directly here. + Get BCryptNamedPropertyValue hKey BCRYPT_PROVIDER_HANDLE to ucaProviderHandle + Move 0 to hAlgProv + If (SizeOfArray(ucaProviderHandle) = SizeOfType(Handle)) Move (MemCopy(AddressOf(hAlgProv), AddressOf(ucaProviderHandle), SizeOfType(Handle))) to void Get BCryptNamedUIntegerPropertyValue hAlgProv BCRYPT_OBJECT_LENGTH to cbKeyObject Move (Alloc(cbKeyObject)) to NewKeyObject.pPointer @@ -1116,10 +1126,6 @@ Class cCryptoApiNextGen_CryptographicPrimitiveFunctions_Mixin is a Mixin Set Private_piLastStatus to iStatus - // In 64-bit it sometimes returns 8 bytes instead of 4 bytes, with the last 4 bytes empty. Make sure to always return 4 bytes. - If (SizeOfArray(ucaOutput)=8) ; - Move (ResizeArray(ucaOutput, 4)) to ucaOutput - Function_Return ucaOutput End_Function @@ -1745,6 +1751,8 @@ Class cCryptoApiNextGen is a cDllWrapper Void_Type void Get BCryptNamedPropertyValue hCngObject sPropertyName to ucaValue + // On 64-bit, some UInteger properties come back 8-byte-padded with the real value in the first 4 bytes. + If (SizeOfArray(ucaValue) = 8) Move (ResizeArray(ucaValue, 4)) to ucaValue If (SizeOfArray(ucaValue) = SizeOfType(UInteger)) Begin Move 0 to uiValue Move (MemCopy(AddressOf(uiValue), AddressOf(ucaValue), SizeOfType(UInteger))) to void @@ -1812,6 +1820,8 @@ Class cCryptoApiNextGen is a cDllWrapper Void_Type void Get NCryptNamedPropertyValue hCngObject sPropertyName to ucaValue + // On 64-bit, some UInteger properties come back 8-byte-padded with the real value in the first 4 bytes. + If (SizeOfArray(ucaValue) = 8) Move (ResizeArray(ucaValue, 4)) to ucaValue If (SizeOfArray(ucaValue) = SizeOfType(UInteger)) Begin Move 0 to uiValue Move (MemCopy(AddressOf(uiValue), AddressOf(ucaValue), SizeOfType(UInteger))) to void diff --git a/Library/DFSecurity-CNG/Config.ws b/Library/DFSecurity-CNG/Config.ws index 3c2f79a..7cdc050 100644 --- a/Library/DFSecurity-CNG/Config.ws +++ b/Library/DFSecurity-CNG/Config.ws @@ -1,12 +1,10 @@ -[Workspace] -Home=.\ -AppSrcPath=.\AppSrc -AppHTMLPath=.\ -BitmapPath=.\ -IdeSrcPath=.\IdeSrc -DataPath=.\ -DDSrcPath=.\ -HelpPath=.\Help -ProgramPath=.\ -FileList=.\DummyFilelist.cfg -Description=Microsoft CryptoAPI Next Generation (CNG) library +[Workspace] +Home=. +AppHTMLPath= +AppSrcPath=AppSrc +DataPath= +DDSrcPath= +IdeSrcPath=IdeSrc +ProgramPath= +FileList=DummyFilelist.cfg +Description=Implementation of Security API's via Microsoft CNG (CryptoAPI Next Generation). diff --git a/Library/DFSecurity-CNG/DFSecurity-CNG.sws b/Library/DFSecurity-CNG/DFSecurity-CNG.sws new file mode 100644 index 0000000..6e719ff --- /dev/null +++ b/Library/DFSecurity-CNG/DFSecurity-CNG.sws @@ -0,0 +1,17 @@ +{ + "dependencies": [ + "DataFlex-dev/Security (core)#1.0.0" + ], + "description": "Implementation of Security API's via Microsoft CNG (CryptoAPI Next Generation).", + "df": 26.0, + "package": { + "df-max": 26.0, + "df-min": 26.0, + "icon": "Security-CNG.png", + "version": "1.0.0" + }, + "paths": { + "fileList": "DummyFilelist.cfg" + }, + "workspaceName": "Security (CNG)" +} \ No newline at end of file diff --git a/Library/DFSecurity-CNG/Security-CNG.png b/Library/DFSecurity-CNG/Security-CNG.png new file mode 100644 index 0000000..6ceb754 Binary files /dev/null and b/Library/DFSecurity-CNG/Security-CNG.png differ diff --git a/Library/DFSecurity-Libsodium/DFSecurity-Libsodium.sws b/Library/DFSecurity-Libsodium/DFSecurity-Libsodium.sws new file mode 100644 index 0000000..4f5ca75 --- /dev/null +++ b/Library/DFSecurity-Libsodium/DFSecurity-Libsodium.sws @@ -0,0 +1,22 @@ +{ + "dependencies": [ + "DataFlex-dev/Security (core)#1.0.0" + ], + "description": "Implementation of the security API’s using Libsodium.", + "df": 26.0, + "package": { + "df-max": 26.0, + "df-min": 26.0, + "icon": "Security-Libsodium.png", + "install": [ + "Programs/libsodium.dll", + "Programs/libsodium64.dll" + ], + "version": "1.0.0" + }, + "paths": { + "configFile": "Programs/Config.ws", + "fileList": "DummyFilelist.cfg" + }, + "workspaceName": "Security (Libsodium)" +} \ No newline at end of file diff --git a/Library/DFSecurity-Libsodium/Programs/Config.ws b/Library/DFSecurity-Libsodium/Programs/Config.ws new file mode 100644 index 0000000..9fdab4a --- /dev/null +++ b/Library/DFSecurity-Libsodium/Programs/Config.ws @@ -0,0 +1,10 @@ +[Workspace] +Home=.. +AppHTMLPath= +AppSrcPath=AppSrc +DataPath= +DDSrcPath= +IdeSrcPath=IdeSrc +ProgramPath=Programs +FileList=DummyFilelist.cfg +Description=Implementation of the security API’s using Libsodium. diff --git a/Library/DFSecurity-Libsodium/Programs/libsodium.dll b/Library/DFSecurity-Libsodium/Programs/libsodium.dll new file mode 100644 index 0000000..12891c2 Binary files /dev/null and b/Library/DFSecurity-Libsodium/Programs/libsodium.dll differ diff --git a/Library/DFSecurity-Libsodium/Programs/libsodium64.dll b/Library/DFSecurity-Libsodium/Programs/libsodium64.dll new file mode 100644 index 0000000..531eec5 Binary files /dev/null and b/Library/DFSecurity-Libsodium/Programs/libsodium64.dll differ diff --git a/Library/DFSecurity-Libsodium/Security-Libsodium.png b/Library/DFSecurity-Libsodium/Security-Libsodium.png new file mode 100644 index 0000000..6ceb754 Binary files /dev/null and b/Library/DFSecurity-Libsodium/Security-Libsodium.png differ diff --git a/Library/DFSecurity/AppSrc/include/UnixTime.pkg b/Library/DFSecurity/AppSrc/include/UnixTime.pkg index f8ce0c0..e85f677 100644 --- a/Library/DFSecurity/AppSrc/include/UnixTime.pkg +++ b/Library/DFSecurity/AppSrc/include/UnixTime.pkg @@ -37,6 +37,7 @@ External_Function WinAPI_SystemTimeToFileTime "SystemTimeToFileTime" Kernel32.dl Returns Boolean #ENDIF +#IFNDEF Get_CurrentUnixTime Function CurrentUnixTime Global Returns UBigInt UBigInt iTime UBigInt iUnixTime @@ -53,3 +54,4 @@ Function CurrentUnixTime Global Returns UBigInt Function_Return iUnixTime End_Function +#ENDIF diff --git a/Library/DFSecurity/Config.ws b/Library/DFSecurity/Config.ws index 5af8913..89b8d22 100644 --- a/Library/DFSecurity/Config.ws +++ b/Library/DFSecurity/Config.ws @@ -1,12 +1,10 @@ -[Workspace] -Home=.\ -AppSrcPath=.\AppSrc -AppHTMLPath=.\AppHtml -BitmapPath=.\ -IdeSrcPath=.\IdeSrc -DataPath=.\ -DDSrcPath=.\ -HelpPath=.\ -ProgramPath=.\Programs -FileList=.\DummyFilelist.cfg -Description=DataFlex Security Library +[Workspace] +Home=. +AppHTMLPath=AppHtml +AppSrcPath=AppSrc +DataPath= +DDSrcPath= +IdeSrcPath=IdeSrc +ProgramPath= +FileList=DummyFilelist.cfg +Description=Library with API's for encryption, hashing, two-factor authentication. diff --git a/Library/DFSecurity/DFSecurity.sws b/Library/DFSecurity/DFSecurity.sws new file mode 100644 index 0000000..3ff3cbd --- /dev/null +++ b/Library/DFSecurity/DFSecurity.sws @@ -0,0 +1,14 @@ +{ + "description": "Library with API's for encryption, hashing, two-factor authentication.", + "df": 26.0, + "package": { + "df-max": 26.0, + "df-min": 26.0, + "icon": "Security.png", + "version": "1.0.0" + }, + "paths": { + "fileList": "DummyFilelist.cfg" + }, + "workspaceName": "Security (core)" +} \ No newline at end of file diff --git a/Library/DFSecurity/Security.png b/Library/DFSecurity/Security.png new file mode 100644 index 0000000..6ceb754 Binary files /dev/null and b/Library/DFSecurity/Security.png differ