************************************************************************
*  Test wwDotnetBridge
****************************************
*** This small program test to see whether wwDotnetBridge works
*** it displays status information about wwDotnetBridge and
*** runs the JSON serializer and Markdown Parser that use
*** .NET components as dependencies to check operation.
***
*** There's also a standalone EXE sample in:
*** .\Samples\wwDotnetBridge\wwDotnetBridgeTest\wwDotnetBridgeTest.exe
************************************************************************
LPARAMETERS llUseDotnetCore 

CLEAR
DO wwDotnetBridge

do wwDotNetBridge
LOCAL loBridge as wwDotNetBridge

IF !llUseDotnetCore
	loBridge = GetwwDotnetBridge()
ELSE
	loBridge = GetwwDotnetCoreBridge()	
ENDIF	

? loBridge.Getdotnetversion()

*** Use some classes that utilize .NET and wwDotnetBridge

?
? "*** JSON Parsing:"
DO wwJsonSerializer
loSer = CREATEOBJECT("wwJsonSerializer")
loPerson = loSer.DeserializeJson([{ "name": "John Doe", "value": 10.32 }])
? "Name: " + loPerson.Name + "    Value: " +  TRANSFORM(loPerson.value)

?
? "*** Markdown Parsing:"
DO MarkdownParser
? Markdown("this is **bold** text, this is a [Link](https://west-wind.com)")

?

? "*** Encryption ***"

DO wwEncryption
LOCAL loEnc as wwEncryption
loEnc = CREATEOBJECT("wwEncryption")

lcOrig = "Hello World"
lcKey = "12345678901234567890123456789012"
? "Text: " + lcOrig  + "    Key: " + lcKey +  "  (" + TRANSFORM(LEN(lcKey)) + ")"


? "*** Default Encryption (TripleDES, ECB, MD5)"
lcVal  = loEnc.encryptstring(lcOrig, lcKey)
? "Encrypted: " + lcVal

lcOrig2 = loEnc.decryptstring(lcVal, lcKey)
? "Decrypted: " + lcOrig2


? "*** Encryption: AES ***"

*** CBC AES: 16 bytes
lcIVKey = "1234567890123456"

*** 16 or 24 byte keys for CBC
lcKey2 = PADR(lcKey,24)

lcVal  = loEnc.encryptstring(lcOrig, lcKey2, .F., "AES", "CBC","","",lcIvKey)
? "Encrypted: " + lcVal

lcOrig2  = loEnc.decryptstring(lcVal, lcKey2, .F., "AES", "CBC","","",lcIvKey)
? "Decrypted: " + lcOrig2



