Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ Demo/Programs/**.dll
Demo/AppHtml/CssThemes
Demo/AppHtml/DfEngine
Demo/AppHtml/web.config
Demo/AppHtml/global.asa
Demo/AppHtml/global.asa
**/DfPkg
38 changes: 21 additions & 17 deletions Library/DFSecurity-CNG/AppSrc/CNG/CNG.pkg
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -1187,22 +1193,16 @@ Class cCryptoApiNextGen_CryptographicPrimitiveFunctions_Mixin is a Mixin
Function BCryptImportKeyPair Handle hAlgorithm Handle hImportKey String eBlobType UChar[] ucaBlob UInteger dwFlags Returns tHandleAndPointer
Integer iStatus
UChar[] ucaBlobType
UInteger cbKeyObject
Void_Type void
tHandleAndPointer KeyObject

Get StringToUtf16UCharArray eBlobType to ucaBlobType

Get BCryptNamedUIntegerPropertyValue hAlgorithm BCRYPT_OBJECT_LENGTH to cbKeyObject
Move (Alloc(cbKeyObject)) to KeyObject.pPointer

// Unlike BCryptImportKey, this API takes no pbKeyObject/cbKeyObject: the provider
// allocates the key object itself and BCryptDestroyKey releases it. So pPointer stays
// 0 here, and cCngKey.Destroy_Object skips its Free accordingly.
Move 0 to KeyObject.hHandle
Move (WinAPI_BCryptImportKeyPair(hAlgorithm, hImportKey, AddressOf(ucaBlobType), KeyObject.hHandle, AddressOf(ucaBlob), SizeOfArray(ucaBlob), dwFlags)) to iStatus

If (iStatus <> STATUS_SUCCESS) Begin
Move (Free(KeyObject.hHandle)) to void
Move 0 to KeyObject.hHandle
End
Move 0 to KeyObject.pPointer
Move (WinAPI_BCryptImportKeyPair(hAlgorithm, hImportKey, AddressOf(ucaBlobType), AddressOf(KeyObject.hHandle), AddressOf(ucaBlob), SizeOfArray(ucaBlob), dwFlags)) to iStatus

Set Private_piLastStatus to iStatus

Expand Down Expand Up @@ -1745,6 +1745,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
Expand Down Expand Up @@ -1812,6 +1814,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
Expand Down
22 changes: 10 additions & 12 deletions Library/DFSecurity-CNG/Config.ws
Original file line number Diff line number Diff line change
@@ -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).
17 changes: 17 additions & 0 deletions Library/DFSecurity-CNG/DFSecurity-CNG.sws
Original file line number Diff line number Diff line change
@@ -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)"
}
Binary file added Library/DFSecurity-CNG/Security-CNG.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 22 additions & 0 deletions Library/DFSecurity-Libsodium/DFSecurity-Libsodium.sws
Original file line number Diff line number Diff line change
@@ -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)"
}
10 changes: 10 additions & 0 deletions Library/DFSecurity-Libsodium/Programs/Config.ws
Original file line number Diff line number Diff line change
@@ -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.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 10 additions & 12 deletions Library/DFSecurity/Config.ws
Original file line number Diff line number Diff line change
@@ -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.
14 changes: 14 additions & 0 deletions Library/DFSecurity/DFSecurity.sws
Original file line number Diff line number Diff line change
@@ -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)"
}
Binary file added Library/DFSecurity/Security.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.