Mini Kabibi Habibi

Current Path : C:/Users/ITO/Desktop/VF9/program files/microsoft visual foxpro 9/samples/solution/ffc/
Upload File :
Current File : C:/Users/ITO/Desktop/VF9/program files/microsoft visual foxpro 9/samples/solution/ffc/crypto.sct

�BVERSION =   3.00dataenvironmentdataenvironmentDataenvironmentaTop = 242
Left = 251
Width = 520
Height = 200
DataSource = .NULL.
Name = "Dataenvironment"
12frmsolution..\solution.vcxformFrmsolution1�Height = 386
Width = 505
DoCreate = .T.
Caption = "Add Encryption to Applications"
lsetffcpath = .T.
Name = "Frmsolution1"
C_solutions1.Top = 360
C_solutions1.Left = 48
C_solutions1.Height = 18
C_solutions1.Width = 37
C_solutions1.Name = "C_solutions1"
Behindscenes1.Top = 358
Behindscenes1.Left = 12
Behindscenes1.TabIndex = 6
Behindscenes1.ZOrderSet = 2
Behindscenes1.Name = "Behindscenes1"
Shape2.Top = 12
Shape2.Left = 12
Shape2.Height = 96
Shape2.Width = 480
Shape2.ZOrderSet = 3
Shape2.Name = "Shape2"
Label1.FontName = "Tahoma"
Label1.Caption = "Under Construction"
Label1.Height = 44
Label1.Left = 24
Label1.Top = 24
Label1.Width = 456
Label1.TabIndex = 2
Label1.ZOrderSet = 4
Label1.Name = "Label1"
Label4.FontName = "Tahoma"
Label4.TabIndex = 1
Label4.ZOrderSet = 5
Label4.Name = "Label4"
Cmdclose1.Top = 358
Cmdclose1.Left = 420
Cmdclose1.TabIndex = 7
Cmdclose1.ZOrderSet = 6
Cmdclose1.Name = "Cmdclose1"
�PROCEDURE checkcsp
#DEFINE	NOCSP_LOC	"The required Crypto Service Provider is not installed or not functioning properly on this system. Some or all of these samples may not work."

IF !THIS._cryptapi.GetIsInstalled()
	MESSAGEBOX(NOCSP_LOC)
	RETURN .F.
ENDIF

ENDPROC
PROCEDURE setdesc
#DEFINE PAGE1_DESC_LOC	"You can encrypt/decrypt strings using the Windows Crypto API routines. "+;
						"Stream encryption provides for fast compact encryption. Block encryption offers a slower, "+;
						"but stronger safer algorithm scheme."
#DEFINE PAGE1a_DESC_LOC	"Click on the Encrypt button to encrypt text in the Password field using the "+;
						"Key specified in the Key field."
#DEFINE PAGE2_DESC_LOC	"Files can also be encrypted using the Windows Crypto API routines. "+;
						"Click on the Encrypt button to encrypt the first file using the "+;
						'Key specified in the Key field. The "..." buttons let you view the contents of a file. '
#DEFINE PAGE2a_DESC_LOC	"After encryption, you can view the encrypted file. Click on the Decrypt button and "+;
						"you will see the contents of the original file equal that of the decrypted one."
#DEFINE PAGE3_DESC_LOC	"Visual FoxPro developers can also encrypt data using the Windows Crypto API routines. "+;
						"Click on the Encrypt button to encrypt the contents of the Last_Name field using the "+;
						"Key specified in the Key field."
#DEFINE PAGE3a_DESC_LOC	"Click on the Decrypt button to see the original contents of the Last_Name field restored."
#DEFINE PAGE4_DESC_LOC	"You can Sign files using the Windows Crypto API routines. "+;
						"Click on the Sign button to get a signature and public key for the file contents. "+;
						'The "..." button lets you change the contents of a signed file. '
#DEFINE PAGE4a_DESC_LOC	"After Signing, you can click on the Verify button to verify if the contents were changed."

LOCAL lnActivePage
lnActivePage = THIS.Pageframe1.ActivePage

DO CASE
CASE lnActivePage = 2
	THISFORM.Label1.Caption = PAGE2_DESC_LOC
	THISFORM.Label2.Caption = PAGE2a_DESC_LOC
CASE lnActivePage = 3
	THISFORM.Label1.Caption = PAGE3_DESC_LOC
	THISFORM.Label2.Caption = PAGE3a_DESC_LOC
CASE lnActivePage = 4
	THISFORM.Label1.Caption = PAGE4_DESC_LOC
	THISFORM.Label2.Caption = PAGE4a_DESC_LOC
OTHERWISE
	THISFORM.Label1.Caption = PAGE1_DESC_LOC
	THISFORM.Label2.Caption = PAGE1a_DESC_LOC
ENDCASE

ENDPROC
PROCEDURE Init
#DEFINE VFPROCKS_LOC	"Visual FoxPro Rocks!"
#DEFINE DISPLAYWIDTH	35

THIS.checkcsp()
THIS.cSaveSafety=SET("SAFETY")
SET SAFETY OFF

* Create files for use with file encryption
THIS.cTextFile =			HOME()+"samples\solution\cryptotest.txt"
THIS.cEncryptTextFile = 	HOME()+"samples\solution\cryptotest_encrypted.txt"
THIS.cDecryptTextFile = 	HOME()+"samples\solution\cryptotest_decrypted.txt"

STRTOFILE(VFPROCKS_LOC,THIS.cTextFile)
STRTOFILE("",THIS.cEncryptTextFile)
STRTOFILE("",THIS.cDecryptTextFile)

THISFORM.Pageframe1.Page2.txtFile.Value = DISPLAYPATH(THIS.cTextFile,DISPLAYWIDTH)
THISFORM.Pageframe1.Page4.txtFile.Value = DISPLAYPATH(THIS.cTextFile,DISPLAYWIDTH)
THISFORM.Pageframe1.Page2.txtEncryptFile.Value = DISPLAYPATH(THIS.cEncryptTextFile,DISPLAYWIDTH)
THISFORM.Pageframe1.Page2.txtDecryptFile.Value = DISPLAYPATH(THIS.cDecryptTextFile,DISPLAYWIDTH)

USE (HOME()+"samples\data\employee") AGAIN SHARED
IF !EMPTY(ALIAS())
	SET FIELDS TO emp_id,last_name,first_name,title
	COPY TO (HOME()+"samples\solution\emptemp") 
	USE (HOME()+"samples\solution\emptemp") AGAIN SHARED
	THISFORM.Pageframe1.Page3.Grid1.RecordSource=ALIAS()
	THISFORM.Pageframe1.Page3.Grid1.Refresh
ELSE
	THISFORM.Pageframe1.Page3.Enabled= .F.	
ENDIF
THIS.setdesc()

DODEFAULT()

ENDPROC
PROCEDURE Destroy

DELETE FILE (THIS.cTextFile)
DELETE FILE (THIS.cEncryptTextFile)
DELETE FILE (THIS.cDecryptTextFile)
IF USED("emptemp")
	USE IN emptemp
ENDIF
DELETE FILE (HOME()+"samples\solution\emptemp.dbf")
DELETE FILE (HOME()+"samples\solution\emptemp.fpt")

IF THIS.cSaveSafety="ON"
	SET SAFETY ON
ENDIF
DODEFAULT()

ENDPROC

��� y
y
u}%@
?��U�%�C���
�������CٌThe required Crypto Service Provider is not installed or not functioning properly on this system. Some or all of these samples may not work.�x��B�-���UTHIS	_CRYPTAPIGETISINSTALLED���T�������
H�'����������T�����CFiles can also be encrypted using the Windows Crypto API routines. �@Click on the Encrypt button to encrypt the first file using the �WKey specified in the Key field. The "..." buttons let you view the contents of a file. ���T�����SAfter encryption, you can view the encrypted file. Click on the Decrypt button and �Oyou will see the contents of the original file equal that of the decrypted one.�������H��T�����VVisual FoxPro developers can also encrypt data using the Windows Crypto API routines. �UClick on the Encrypt button to encrypt the contents of the Last_Name field using the �Key specified in the Key field.��lT�����YClick on the Decrypt button to see the original contents of the Last_Name field restored.����������T�����:You can Sign files using the Windows Crypto API routines. �RClick on the Sign button to get a signature and public key for the file contents. �@The "..." button lets you change the contents of a signed file. ��lT�����YAfter Signing, you can click on the Verify button to verify if the contents were changed.��2���T�����GYou can encrypt/decrypt strings using the Windows Crypto API routines. �ZStream encryption provides for fast compact encryption. Block encryption offers a slower, �$but stronger safer algorithm scheme.���T�����LClick on the Encrypt button to encrypt text in the Password field using the �Key specified in the Key field.���ULNACTIVEPAGETHIS
PAGEFRAME1
ACTIVEPAGETHISFORMLABEL1CAPTIONLABEL2�
��C����T���C�SAFETYv��G.�3T���C�Q�samples\solution\cryptotest.txt��=T���C�Q�)samples\solution\cryptotest_encrypted.txt��=T���C�Q�)samples\solution\cryptotest_decrypted.txt��&��C�Visual FoxPro Rocks!�������C��������C������"T����	�
�C���#��"T����	�
�C���#��"T�����
�C���#��"T����
�
�C���#��%Q�C�Q�samples\data\employee���%�CC�
��m�G(�����'(�C�Q�samples\solution\emptemp��(Q�C�Q�samples\solution\emptemp���T������C������������T�����-���
��C����	��C��UTHISCHECKCSPCSAVESAFETY	CTEXTFILECENCRYPTTEXTFILECDECRYPTTEXTFILETHISFORM
PAGEFRAME1PAGE2TXTFILEVALUEPAGE4TXTENCRYPTFILETXTDECRYPTFILEEMP_ID	LAST_NAME
FIRST_NAMETITLEPAGE3GRID1RECORDSOURCEREFRESHENABLEDSETDESC����������������%�C�emptemp���H�Q���+�C�Q�samples\solution\emptemp.dbf��+�C�Q�samples\solution\emptemp.fpt��%����ON����G. ��	��C��UTHIS	CTEXTFILECENCRYPTTEXTFILECDECRYPTTEXTFILEEMPTEMPCSAVESAFETYcheckcsp,��setdesc��Init|��Destroy#��1S�	qA30q1�Q�Q�q��!A3��a3��b!!"!!!R�Qq��1�AA��3���a�A��baA�2	'p	
�	�12��V)y
Sctextfile
cencrypttextfile
csavesafety
cdecrypttextfile
*checkcsp 
*setdesc 
	_cryptapi..\..\..\ffc\_crypt.vcxcustom	_cryptapiFrmsolution1CTop = 360
Left = 84
Height = -1
Width = -1
Name = "_cryptapi"
	pageframe	pageframe
Pageframe1Frmsolution1�ErasePage = .T.
PageCount = 4
TabStyle = 1
Top = 115
Left = 12
Width = 480
Height = 228
Name = "Pageframe1"
Page1.FontName = "Tahoma"
Page1.Caption = "\<Strings"
Page1.Name = "Page1"
Page2.FontName = "Tahoma"
Page2.Caption = "Fi\<les"
Page2.Name = "Page2"
Page3.FontName = "Tahoma"
Page3.Caption = "D\<ata"
Page3.Name = "Page3"
Page4.FontName = "Tahoma"
Page4.Caption = "Si\<gning"
Page4.Name = "Page4"
�PROCEDURE Page1.Activate
THISFORM.setdesc()

ENDPROC
PROCEDURE Page2.Activate
THISFORM.setdesc()

ENDPROC
PROCEDURE Page3.Activate
THISFORM.setdesc()

ENDPROC
PROCEDURE Page4.Activate
THISFORM.setdesc()

ENDPROC
�� ���[%�:	(�U
��C����UTHISFORMSETDESC
��C����UTHISFORMSETDESC
��C����UTHISFORMSETDESC
��C����UTHISFORMSETDESCPage1.Activate,��Page2.ActivateS��Page3.Activatez��Page4.Activate���1�3�3�3�2.Sg��	��
)�shapeshapeShape2Frmsolution1.Pageframe1.Page1^Top = 15
Left = 11
Height = 83
Width = 456
SpecialEffect = 0
Style = 3
Name = "Shape2"
shapeshapeShape1Frmsolution1.Pageframe1.Page1_Top = 111
Left = 11
Height = 84
Width = 456
SpecialEffect = 0
Style = 3
Name = "Shape1"

commandbutton
commandbutton
cmdEncryptFrmsolution1.Pageframe1.Page1�Top = 27
Left = 383
Height = 23
Width = 72
FontName = "Tahoma"
FontSize = 8
Caption = "\<Encrypt"
TabIndex = 6
Name = "cmdEncrypt"
�PROCEDURE Click
LOCAL lcEncryptedStream,lcPassword,lcKey
lcEncryptedStream = ''
lcPassWord = THIS.Parent.txtPassword.Value
lcKey = THIS.Parent.txtKey.Value
IF THISFORM._cryptapi.EncryptSessionStreamString(lcPassWord, lcKey, @lcEncryptedStream)
	THIS.Parent.txtPassword.Value=""
	THIS.Parent.txtPassword.Value = lcEncryptedStream
ELSE
	MESSAGEBOX("Error: "+MESSAGE())
	RETURN
ENDIF
THIS.Parent.txtPassword.Readonly = .T.
THIS.Parent.txtKey.Readonly = .T.
THIS.Parent.txtPassword2.Readonly = .T.
THIS.Parent.txtKey2.Readonly = .T.
THIS.Parent.cmdEncrypt.Enabled = .F.
THIS.Parent.cmdDecrypt.Enabled = .T.
THIS.Parent.cmdEncrypt2.Enabled = .F.

ENDPROC
�� ���%I�X�UI�����
T�����T��������T�������� %�C�����	�
����T��������T�������������C�Error: CE�x��B��T�����a��T�����a��T�����a��T���
��a��T�����-��T�����a��T�����-��ULCENCRYPTEDSTREAM
LCPASSWORDLCKEYTHISPARENTTXTPASSWORDVALUETXTKEYTHISFORM	_CRYPTAPIENCRYPTSESSIONSTREAMSTRINGREADONLYTXTPASSWORD2TXTKEY2
CMDENCRYPTENABLED
CMDDECRYPTCMDENCRYPT2Click,��1��aaaa�aAAAAAAAAA2�)�
commandbutton
commandbutton
cmdDecryptFrmsolution1.Pageframe1.Page1�Top = 63
Left = 383
Height = 23
Width = 72
FontName = "Tahoma"
FontSize = 8
Caption = "\<Decrypt"
Enabled = .F.
HelpContextID = 0
TabIndex = 7
Name = "cmdDecrypt"
�PROCEDURE Click
LOCAL lcDecryptedStream,lcPassword,lcKey
lcDecryptedStream = ''
lcPassWord = THIS.Parent.txtPassword.Value
lcKey = THIS.Parent.txtKey.Value
IF THISFORM._cryptapi.DecryptSessionStreamString(lcPassWord, lcKey, @lcDecryptedStream)
	THIS.Parent.txtPassword.Value=""
	THIS.Parent.txtPassword.Value = lcDecryptedStream
ELSE
	MESSAGEBOX("Error: "+MESSAGE())
ENDIF
THIS.Parent.txtPassword.Readonly = .F.
THIS.Parent.txtKey.Readonly = .F.
THIS.Parent.txtPassword2.Readonly = .F.
THIS.Parent.txtKey2.Readonly = .F.
THIS.Parent.cmdEncrypt.Enabled = .T.
THIS.Parent.cmdDecrypt.Enabled = .F.
THIS.Parent.cmdEncrypt2.Enabled = .T.

ENDPROC
�� ���%EzT�UE�����
T�����T��������T�������� %�C�����	�
����T��������T�������������C�Error: CE�x���T�����-��T�����-��T�����-��T���
��-��T�����a��T�����-��T�����a��ULCDECRYPTEDSTREAM
LCPASSWORDLCKEYTHISPARENTTXTPASSWORDVALUETXTKEYTHISFORM	_CRYPTAPIDECRYPTSESSIONSTREAMSTRINGREADONLYTXTPASSWORD2TXTKEY2
CMDENCRYPTENABLED
CMDDECRYPTCMDENCRYPT2Click,��1��aaaa�aAAAAAAAA2�)�labellabelLabel1Frmsolution1.Pageframe1.Page1�FontName = "Tahoma"
FontSize = 8
BackStyle = 0
Caption = "\<Text to encrypt:"
Height = 17
Left = 35
Top = 30
Width = 82
TabIndex = 2
Name = "Label1"
labellabelLabel2Frmsolution1.Pageframe1.Page1�FontName = "Tahoma"
FontSize = 8
BackStyle = 0
Caption = "Encryption \<key:"
Height = 17
Left = 35
Top = 66
Width = 85
TabIndex = 4
Name = "Label2"
textboxtextboxtxtPasswordFrmsolution1.Pageframe1.Page1�FontName = "Tahoma"
FontSize = 8
Value = Visual FoxPro Rocks!
Height = 23
Left = 131
TabIndex = 3
Top = 27
Width = 228
Name = "txtPassword"
textboxtextboxtxtKeyFrmsolution1.Pageframe1.Page1�FontName = "Tahoma"
FontSize = 8
Value = Sedona
Height = 23
Left = 131
TabIndex = 5
Top = 63
Width = 228
Name = "txtKey"

commandbutton
commandbuttoncmdEncrypt2Frmsolution1.Pageframe1.Page1�Top = 123
Left = 383
Height = 23
Width = 72
FontName = "Tahoma"
FontSize = 8
Caption = "E\<ncrypt"
TabIndex = 13
Name = "cmdEncrypt2"
$PROCEDURE Click
LOCAL lcEncryptedStream,lcPassword,lcKey
lcEncryptedStream = ''
lcPassWord = THIS.Parent.txtPassword2.Value
lcKey = THIS.Parent.txtKey2.Value
IF THISFORM._cryptapi.EncryptSessionBlockString(lcPassWord, lcKey, @lcEncryptedStream)
	THIS.Parent.txtPassword2.Value=""
	THIS.Parent.txtPassword2.Value = lcEncryptedStream
ELSE
	IF THISFORM._cryptapi.GetDoubleEncryptError()
		MESSAGEBOX("Sorry, you cannot double-encrypt this text.")
	ELSE
		MESSAGEBOX("Error: "+MESSAGE())
	ENDIF
	RETURN
ENDIF
THIS.Parent.txtPassword2.Readonly = .T.
THIS.Parent.txtKey2.Readonly = .T.
THIS.Parent.txtPassword.Readonly = .T.
THIS.Parent.txtKey.Readonly = .T.

THIS.Parent.cmdEncrypt.Enabled = .F.
THIS.Parent.cmdEncrypt2.Enabled = .F.
THIS.Parent.cmdDecrypt2.Enabled = .T.


ENDPROC
X�� ??3%����U������
T�����T��������T�������� %�C�����	�
����T��������T���������
�%�C��	�����7��C�+Sorry, you cannot double-encrypt this text.�x������C�Error: CE�x���B��T�����a��T�����a��T���
��a��T�����a��T�����-��T�����-��T�����a��ULCENCRYPTEDSTREAM
LCPASSWORDLCKEYTHISPARENTTXTPASSWORD2VALUETXTKEY2THISFORM	_CRYPTAPIENCRYPTSESSIONBLOCKSTRINGGETDOUBLEENCRYPTERRORREADONLYTXTPASSWORDTXTKEY
CMDENCRYPTENABLEDCMDENCRYPT2CMDDECRYPT2Click,��1��aaaa�Aq�aAAAAAAABAA3)?
commandbutton
commandbuttoncmdDecrypt2Frmsolution1.Pageframe1.Page1�Top = 159
Left = 383
Height = 23
Width = 72
FontName = "Tahoma"
FontSize = 8
Caption = "De\<crypt"
Enabled = .F.
HelpContextID = 0
TabIndex = 14
Name = "cmdDecrypt2"
�PROCEDURE Click
LOCAL lcDecryptedStream,lcPassword,lcKey
lcDecryptedStream = ""
lcPassWord = THIS.Parent.txtPassword2.Value

lcKey = THIS.Parent.txtKey2.Value
IF THISFORM._cryptapi.DecryptSessionBlockString(lcPassWord, lcKey, @lcDecryptedStream)
	THIS.Parent.txtPassword2.Value=""
	THIS.Parent.txtPassword2.Value = lcDecryptedStream
ELSE
	MESSAGEBOX("Error: "+MESSAGE())
ENDIF
THIS.Parent.txtPassword2.Readonly = .F.
THIS.Parent.txtKey2.Readonly = .F.
THIS.Parent.txtPassword.Readonly = .F.
THIS.Parent.txtKey.Readonly = .F.
THIS.Parent.cmdDecrypt2.Enabled = .F.
THIS.Parent.cmdEncrypt2.Enabled = .T.
THIS.Parent.cmdEncrypt.Enabled = .T.


ENDPROC
�� ���%EzT�UE�����
T�����T��������T�������� %�C�����	�
����T��������T�������������C�Error: CE�x���T�����-��T�����-��T�����-��T���
��-��T�����-��T�����a��T�����a��ULCDECRYPTEDSTREAM
LCPASSWORDLCKEYTHISPARENTTXTPASSWORD2VALUETXTKEY2THISFORM	_CRYPTAPIDECRYPTSESSIONBLOCKSTRINGREADONLYTXTPASSWORDTXTKEYCMDDECRYPT2ENABLEDCMDENCRYPT2
CMDENCRYPTClick,��1��abaa�aAAAAAAAA3�)�labellabelLabel3Frmsolution1.Pageframe1.Page1�FontName = "Tahoma"
FontSize = 8
BackStyle = 0
Caption = "Te\<xt to encrypt:"
Height = 17
Left = 35
Top = 126
Width = 82
TabIndex = 9
Name = "Label3"
labellabelLabel4Frmsolution1.Pageframe1.Page1�FontName = "Tahoma"
FontSize = 8
BackStyle = 0
Caption = "Encryption ke\<y:"
Height = 17
Left = 35
Top = 163
Width = 85
TabIndex = 11
Name = "Label4"
textboxtextboxtxtPassword2Frmsolution1.Pageframe1.Page1�FontName = "Tahoma"
FontSize = 8
Value = Visual FoxPro Rocks!
Height = 23
Left = 131
TabIndex = 10
Top = 123
Width = 228
Name = "txtPassword2"
textboxtextboxtxtKey2Frmsolution1.Pageframe1.Page1�FontName = "Tahoma"
FontSize = 8
Value = Sedona
Height = 23
Left = 131
TabIndex = 12
Top = 159
Width = 228
Name = "txtKey2"
labellabelLabel5Frmsolution1.Pageframe1.Page1�FontName = "Tahoma"
FontSize = 8
Alignment = 2
BackStyle = 1
Caption = "Stream Encryption"
Height = 15
Left = 19
Top = 8
Width = 94
TabIndex = 1
Style = 3
Name = "Label5"
labellabelLabel6Frmsolution1.Pageframe1.Page1�FontName = "Tahoma"
FontSize = 8
Alignment = 2
BackStyle = 1
Caption = "Block Encryption"
Height = 15
Left = 21
Top = 104
Width = 82
TabIndex = 8
Style = 3
Name = "Label6"

commandbutton
commandbutton
cmdEncryptFrmsolution1.Pageframe1.Page2�Top = 15
Left = 383
Height = 23
Width = 72
FontName = "Tahoma"
FontSize = 8
Caption = "\<Encrypt"
TabIndex = 7
Name = "cmdEncrypt"
�PROCEDURE Click
LOCAL lcKey
lcKey = THIS.Parent.txtKey.Value
IF THISFORM._cryptapi.EncryptSessionStreamFile(THISFORM.cTextFile, lcKey, THISFORM.cEncryptTextFile )

ELSE
	MESSAGEBOX("Error: "+MESSAGE())
	RETURN
ENDIF
THIS.Parent.txtKey.Readonly = .T.
THIS.Parent.txtDecryptFile.Enabled = .T.
THIS.Parent.cmdEncrypt.Enabled = .F.
THIS.Parent.cmdDecrypt.Enabled = .T.
THIS.Parent.cmdDecView.Enabled = .T.
ENDPROC
B�� ))I%����U����T��������$%�C�����	�����A��c���C�Error: CE�x��B��T����
�a��T�����a��T���
��-��T�����a��T�����a��ULCKEYTHISPARENTTXTKEYVALUETHISFORM	_CRYPTAPIENCRYPTSESSIONSTREAMFILE	CTEXTFILECENCRYPTTEXTFILEREADONLYTXTDECRYPTFILEENABLED
CMDENCRYPT
CMDDECRYPT
CMDDECVIEWClick,��1qaA�aAAAAAAA1�))
commandbutton
commandbutton
cmdDecryptFrmsolution1.Pageframe1.Page2�Top = 51
Left = 383
Height = 23
Width = 72
FontName = "Tahoma"
FontSize = 8
Caption = "\<Decrypt"
Enabled = .F.
HelpContextID = 0
TabIndex = 11
Name = "cmdDecrypt"
cPROCEDURE Click
LOCAL lcKey
lcKey = THIS.Parent.txtKey.Value
IF THISFORM._cryptapi.DecryptSessionStreamFile(THISFORM.cEncryptTextFile , lcKey, THISFORM.cDecryptTextFile )

ELSE
	MESSAGEBOX("Error: "+MESSAGE())
	RETURN
ENDIF
THIS.Parent.txtKey.Readonly = .F.
THIS.Parent.cmdEncrypt.Enabled = .T.
THIS.Parent.cmdDecrypt.Enabled = .F.

ENDPROC
�� ���%x���U����T��������$%�C�����	�����A��c���C�Error: CE�x��B��T����
�-��T�����a��T���
��-��ULCKEYTHISPARENTTXTKEYVALUETHISFORM	_CRYPTAPIDECRYPTSESSIONSTREAMFILECENCRYPTTEXTFILECDECRYPTTEXTFILEREADONLY
CMDENCRYPTENABLED
CMDDECRYPTClick,��1qaA�aAAAAA2X)�labellabelLabel1Frmsolution1.Pageframe1.Page2�FontName = "Tahoma"
FontSize = 8
BackStyle = 0
Caption = "\<File to encrypt:"
Height = 17
Left = 11
Top = 18
Width = 82
TabIndex = 1
Name = "Label1"
labellabelLabel2Frmsolution1.Pageframe1.Page2�FontName = "Tahoma"
FontSize = 8
BackStyle = 0
Caption = "E\<ncrypted file:"
Height = 17
Left = 11
Top = 54
Width = 85
TabIndex = 4
Name = "Label2"
textboxtextboxtxtFileFrmsolution1.Pageframe1.Page2�FontName = "Tahoma"
FontSize = 8
Height = 23
Left = 107
ReadOnly = .T.
TabIndex = 2
Top = 14
Width = 204
Name = "txtFile"
textboxtextboxtxtKeyFrmsolution1.Pageframe1.Page2�FontName = "Tahoma"
FontSize = 8
Value = Sedona
Height = 23
Left = 107
TabIndex = 13
Top = 122
Width = 204
Name = "txtKey"

commandbutton
commandbuttonCommand1Frmsolution1.Pageframe1.Page2�Top = 14
Left = 323
Height = 23
Width = 24
FontName = "Tahoma"
FontSize = 8
Caption = "..."
TabIndex = 3
Name = "Command1"
<PROCEDURE Click
MODIFY FILE (THISFORM.cTextFile)
ENDPROC
�� ��Q%Vke�U/�����UTHISFORM	CTEXTFILEClick,��1�11)�textboxtextboxtxtEncryptFileFrmsolution1.Pageframe1.Page2�FontName = "Tahoma"
FontSize = 8
Height = 23
Left = 107
ReadOnly = .T.
TabIndex = 5
Top = 50
Width = 204
Name = "txtEncryptFile"
labellabelLabel3Frmsolution1.Pageframe1.Page2�FontName = "Tahoma"
FontSize = 8
BackStyle = 0
Caption = "Decr\<ypted file:"
Height = 17
Left = 11
Top = 90
Width = 85
TabIndex = 8
Name = "Label3"

commandbutton
commandbuttonCommand2Frmsolution1.Pageframe1.Page2�Top = 50
Left = 323
Height = 23
Width = 24
FontName = "Tahoma"
FontSize = 8
Caption = "..."
TabIndex = 6
Name = "Command2"
CPROCEDURE Click
MODIFY FILE (THISFORM.cEncryptTextFile)
ENDPROC
�� ��E�%]rl�U/�����UTHISFORMCENCRYPTTEXTFILEClick,��1�18)�labellabelLabel4Frmsolution1.Pageframe1.Page2�FontName = "Tahoma"
FontSize = 8
BackStyle = 0
Caption = "Encryption \<key:"
Height = 17
Left = 11
Top = 126
Width = 85
TabIndex = 12
Name = "Label4"
textboxtextboxtxtDecryptFileFrmsolution1.Pageframe1.Page2�FontName = "Tahoma"
FontSize = 8
Enabled = .F.
Height = 23
Left = 107
ReadOnly = .T.
TabIndex = 9
Top = 86
Width = 204
Name = "txtDecryptFile"

commandbutton
commandbutton
cmdDecViewFrmsolution1.Pageframe1.Page2�Top = 86
Left = 323
Height = 23
Width = 24
FontName = "Tahoma"
FontSize = 8
Caption = "..."
Enabled = .F.
TabIndex = 10
Name = "cmdDecView"
CPROCEDURE Click
MODIFY FILE (THISFORM.cDecryptTextFile)
ENDPROC
�� ��E�%]rl�U/�����UTHISFORMCDECRYPTTEXTFILEClick,��1�18)�
commandbutton
commandbutton
cmdEncryptFrmsolution1.Pageframe1.Page3�Top = 158
Left = 311
Height = 23
Width = 72
FontName = "Tahoma"
FontSize = 8
Caption = "\<Encrypt"
TabIndex = 4
Name = "cmdEncrypt"
�PROCEDURE Click
LOCAL lcField,lcKey,lcEncryptedStream
lcKey = THIS.Parent.txtKey.Value
SCAN
	lcEncryptedStream=""
	lcField = ALLTRIM(last_name)
	IF THISFORM._cryptapi.EncryptSessionStreamString(lcField , lcKey, @lcEncryptedStream)
		REPLACE last_name WITH lcEncryptedStream
	ELSE
		MESSAGEBOX("Error: "+MESSAGE())
		RETURN
	ENDIF
ENDSCAN
THIS.Parent.txtKey.Readonly = .T.
THIS.Parent.cmdEncrypt.Enabled = .F.
THIS.Parent.cmdDecrypt.Enabled = .T.

ENDPROC
I�� 007�%����U������T��������~���
T�����T��C���� %�C�����	�
��v�
>����������C�Error: CE�x��B���T�����a��T����
�-��T����
�a��ULCFIELDLCKEYLCENCRYPTEDSTREAMTHISPARENTTXTKEYVALUE	LAST_NAMETHISFORM	_CRYPTAPIENCRYPTSESSIONSTREAMSTRINGREADONLY
CMDENCRYPTENABLED
CMDDECRYPTClick,��1�a�����aAAAAAA2�)0
commandbutton
commandbutton
cmdDecryptFrmsolution1.Pageframe1.Page3�Top = 158
Left = 395
Height = 23
Width = 72
FontName = "Tahoma"
FontSize = 8
Caption = "\<Decrypt"
Enabled = .F.
HelpContextID = 0
TabIndex = 5
Name = "cmdDecrypt"
�PROCEDURE Click
LOCAL lcDecryptedStream,lcField,lcKey
lcKey = THIS.Parent.txtKey.Value
SCAN
	lcDecryptedStream=""
	lcField = ALLTRIM(last_name)
	IF THISFORM._cryptapi.DecryptSessionStreamString(lcField, lcKey, @lcDecryptedStream)
		REPLACE last_name WITH lcDecryptedStream
	ELSE
		MESSAGEBOX("Error: "+MESSAGE())
	ENDIF
ENDSCAN
THIS.Parent.txtKey.Readonly = .F.
THIS.Parent.cmdEncrypt.Enabled = .T.
THIS.Parent.cmdDecrypt.Enabled = .F.

ENDPROC
C�� **�7%����U������T��������~���
T�����T��C���� %�C�����	�
��v�
>����������C�Error: CE�x����T�����-��T����
�a��T����
�-��ULCDECRYPTEDSTREAMLCFIELDLCKEYTHISPARENTTXTKEYVALUE	LAST_NAMETHISFORM	_CRYPTAPIDECRYPTSESSIONSTREAMSTRINGREADONLY
CMDENCRYPTENABLED
CMDDECRYPTClick,��1�a�����aAAAAA2�)*labellabelLabel2Frmsolution1.Pageframe1.Page3�FontName = "Tahoma"
FontSize = 8
BackStyle = 0
Caption = "Encryption \<key:"
Height = 17
Left = 11
Top = 161
Width = 85
TabIndex = 2
Name = "Label2"
textboxtextboxtxtKeyFrmsolution1.Pageframe1.Page3�FontName = "Tahoma"
FontSize = 8
Value = Sedona
Height = 23
Left = 95
TabIndex = 3
Top = 158
Width = 132
Name = "txtKey"
gridgridGrid1Frmsolution1.Pageframe1.Page3�FontName = "MS Sans Serif"
FontSize = 8
Height = 132
Left = 11
ReadOnly = .T.
RowHeight = 16
TabIndex = 1
Top = 14
Width = 456
Name = "Grid1"

commandbutton
commandbuttoncmdSignFrmsolution1.Pageframe1.Page4�Top = 16
Left = 383
Height = 23
Width = 72
FontName = "Tahoma"
FontSize = 8
Caption = "S\<ign"
TabIndex = 8
Name = "cmdSign"
�PROCEDURE Click
LOCAL lcSignature, lcSignaturePublicKey
lcSignature = ''
lcSignaturePublicKey = ''
IF THISFORM._cryptapi.SignFile(THISFORM.cTextFile, @lcSignature, @lcSignaturePublicKey)
	THIS.Parent.edtSignature.Value=lcSignature
	THIS.Parent.edtPublicKey.Value=lcSignaturePublicKey	
ELSE
	MESSAGEBOX("Error: "+MESSAGE())
	RETURN
ENDIF

THIS.Enabled= .F.
THIS.Parent.cmdVerify.Enabled= .T.

ENDPROC

�� ��1�%����U�����
T�����
T�����"%�C���������s�T����	����T���
�	���������C�Error: CE�x��B��T���-��T�����a��U
LCSIGNATURELCSIGNATUREPUBLICKEYTHISFORM	_CRYPTAPISIGNFILE	CTEXTFILETHISPARENTEDTSIGNATUREVALUEEDTPUBLICKEYENABLED	CMDVERIFYClick,��1���!aa�aAA�A2�)�labellabelLabel1Frmsolution1.Pageframe1.Page4�FontName = "Tahoma"
FontSize = 8
BackStyle = 0
Caption = "\<File to sign:"
Height = 17
Left = 11
Top = 19
Width = 82
TabIndex = 1
Name = "Label1"
textboxtextboxtxtFileFrmsolution1.Pageframe1.Page4�FontName = "Tahoma"
FontSize = 8
Height = 23
Left = 83
ReadOnly = .T.
TabIndex = 2
Top = 15
Width = 228
Name = "txtFile"

commandbutton
commandbuttonCommand1Frmsolution1.Pageframe1.Page4�Top = 15
Left = 323
Height = 23
Width = 24
FontName = "Tahoma"
FontSize = 8
Caption = "..."
TabIndex = 3
Name = "Command1"
<PROCEDURE Click
MODIFY FILE (THISFORM.cTextFile)
ENDPROC
�� ��Q%Vke�U/�����UTHISFORM	CTEXTFILEClick,��1�11)�
commandbutton
commandbutton	cmdVerifyFrmsolution1.Pageframe1.Page4�Top = 51
Left = 383
Height = 23
Width = 72
FontName = "Tahoma"
FontSize = 8
Caption = "\<Verify"
Enabled = .F.
TabIndex = 9
Name = "cmdVerify"
�PROCEDURE Click
#DEFINE VALIDFILE_LOC	'File Signature Verified.'
#DEFINE INVALIDFILE_LOC	'Invalid Signature for File.'

LOCAL lcSignature,lcSignaturePublicKey,llSignatureOK

lcSignature = THIS.Parent.edtSignature.Value
lcSignaturePublicKey = THIS.Parent.edtPublicKey.Value
THISFORM._cryptapi.VerifyFileSignature(THISFORM.cTextFile, lcSignature, lcSignaturePublicKey, @llSignatureOK)
IF llSignatureOK
	MESSAGEBOX(VALIDFILE_LOC)
ELSE
	MESSAGEBOX(INVALIDFILE_LOC)
ENDIF

* Reset things to start over
THIS.Enabled= .F.
THIS.Parent.cmdSign.Enabled= .T.
THIS.Parent.edtSignature.Value=""
THIS.Parent.edtPublicKey.Value=""	

ENDPROC
{�� bb%���U�����T��������T��������"��C�������	�
��
%������$��C�File Signature Verified.�x�����'��C�Invalid Signature for File.�x���T���-��T���
��a��T��������T��������ULCSIGNATURELCSIGNATUREPUBLICKEY
LLSIGNATUREOKTHISPARENTEDTSIGNATUREVALUEEDTPUBLICKEYTHISFORM	_CRYPTAPIVERIFYFILESIGNATURE	CTEXTFILEENABLEDCMDSIGNClick,��1�ba!�A�qA�Aaa2})blabellabelLabel3Frmsolution1.Pageframe1.Page4�FontName = "Tahoma"
FontSize = 8
BackStyle = 0
Caption = "Sig\<nature:"
Height = 17
Left = 11
Top = 54
Width = 82
TabIndex = 4
Name = "Label3"
labellabelLabel2Frmsolution1.Pageframe1.Page4�FontName = "Tahoma"
FontSize = 8
BackStyle = 0
Caption = "Public \<key:"
Height = 17
Left = 11
Top = 114
Width = 82
TabIndex = 6
Name = "Label2"
editboxeditboxedtSignatureFrmsolution1.Pageframe1.Page4�FontName = "Tahoma"
FontSize = 8
Height = 48
Left = 83
ReadOnly = .T.
TabIndex = 5
Top = 51
Width = 228
Name = "edtSignature"
editboxeditboxedtPublickeyFrmsolution1.Pageframe1.Page4�FontName = "Tahoma"
FontSize = 8
Height = 48
Left = 83
ReadOnly = .T.
TabIndex = 7
Top = 111
Width = 228
Name = "edtPublickey"
labellabelLabel2Frmsolution1�FontName = "MS Sans Serif"
FontSize = 8
WordWrap = .T.
Caption = "Label2"
Height = 29
Left = 24
Top = 72
Width = 456
Name = "Label2"
lArial, 0, 9, 5, 15, 12, 32, 3, 0
MS Sans Serif, 0, 8, 5, 13, 11, 11, 2, 0
Tahoma, 0, 8, 5, 13, 11, 21, 2, 0