Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Windows crypto API
Message
 
À
05/09/2009 09:17:13
Metin Emre
Ozcom Bilgisayar Ltd.
Istanbul, Turquie
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Divers
Thread ID:
01422771
Message ID:
01422804
Vues:
63
>"The required crypto service provider is not installed or not functioning properly on this system. Some or all of these samples may not work".

Are you using a Windows 2000 system? This used to happen when on older systems the high encryption pack wasn't installed

>Is there any easy way to use Windows's crypto API just for crypt and decrypt a string?
*========================================================================================
* Encrypts a string with a password and returns the 
* encrypted result.
*========================================================================================
LParameter tcData, tcPassword

	Local loCrypt, lcEncrypted, llOK

	loCrypt = NewObject("_CryptApi",Home()+"FFC\_Crypt.vcx")
	lcEncrypted = ""
	llOK = .T.

	llOK = loCrypt.EncryptSessionBlockString( ;
		 m.tcData, m.tcPassword, @lcEncrypted )
	If not m.llOK
		lcEncrypted = NULL
	EndIf
	
Return m.lcEncrypted
and to decrypt
*========================================================================================
* Decrypts a string with a password and returns the result 
* back as plain text
*========================================================================================
LParameter tcEncrypted, tcPassword

	Local loCrypt, lcData, llOK

	loCrypt = NewObject("_CryptApi",Home()+"FFC\_Crypt.vcx")
	lcData = ""
	llOK = .T.

	llOK = loCrypt.DecryptSessionBlockString( ;
		m.tcEncrypted, m.tcPassword, @lcData )
	If not m.llOK
		lcData = NULL
	EndIf
	
Return m.lcData
--
Christof
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform