Using Win32 functions in Visual FoxPro Image Gallery
Cryptography Reference
..msdn
CertCloseStore
CertFindCertificateInStore
CertFreeCertificateContext
CertOpenSystemStore
CryptAcquireContext
CryptBinaryToString
CryptCreateHash
CryptDecrypt
CryptDeriveKey
CryptDestroyHash
CryptDestroyKey
CryptEncrypt
CryptEnumProviders
CryptEnumProviderTypes
CryptExportKey
CryptGenKey
CryptGenRandom
CryptGetDefaultProvider
CryptGetHashParam
CryptGetKeyParam
CryptGetProvParam
CryptHashData
CryptImportKey
CryptProtectData
CryptReleaseContext
CryptStringToBinary
CryptUnprotectData
WinVerifyTrust
Code examples:
Generating random cryptographic keys
CryptImportKey
..msdn    Add comment     W32 Constants      Translate this page
Transfers a cryptographic key from a key BLOB into a cryptographic service provider (CSP).
Code examples:
Generating random cryptographic keys
Declaration:
BOOL WINAPI CryptImportKey(
  _In_   HCRYPTPROV hProv,
  _In_   BYTE *pbData,
  _In_   DWORD dwDataLen,
  _In_   HCRYPTKEY hPubKey,
  _In_   DWORD dwFlags,
  _Out_  HCRYPTKEY *phKey
);
FoxPro declaration:
DECLARE INTEGER CryptImportKey IN advapi32;
    INTEGER hProv,;
    STRING @pbData,;
    INTEGER dwDataLen,;
    INTEGER hPubKey,;
    INTEGER dwFlags,;
    INTEGER @phKey
Parameters:
hProv [in]
The handle of a CSP obtained with the CryptAcquireContext function.

pbData [in]
A BYTE array that contains a PUBLICKEYSTRUC BLOB header followed by the encrypted key.

dwDataLen [in]
Contains the length, in bytes, of the key BLOB.

hPubKey [in]
A handle to the cryptographic key that decrypts the key stored in pbData.

dwFlags [in]
Currently used only when a public/private key pair in the form of a PRIVATEKEYBLOB is imported into the CSP.

phKey [out]
A pointer to a HCRYPTKEY value that receives the handle of the imported key.
Return value:
If the function succeeds, the function returns nonzero.
Usage:
LOCAL cBuffer, hKey

cBuffer = FILETOSTR(m.cFilename)
hKey = 0

= CryptImportKey(;
    THIS.hProv,;
    m.cBuffer, LEN(m.cBuffer),;
    0, CRYPT_EXPORTABLE, @hKey)
My comment:
When you have finished using the key, release the handle by calling the CryptDestroyKey function.

See also: CryptGenKey, CryptExportKey
Word Index links for the CryptImportKey :
Translate this page:
  Spanish    Portuguese    German    French    Italian  
FreeTranslation.com offers instant, free translations of text or web pages.
Created: 2013-10-17 17:05:09
Modified: 2013-10-17 17:10:08
Visited in last 7 days: 62
User Contributed Notes:
There are no notes on this subject.


Copyright 2001-2017 News2News, Inc. Before reproducing or distributing any data from this site please ask for an approval from its owner. Unless otherwise specified, this page is for your personal and non-commercial use. The information on this page is presented AS IS, meaning that you may use it at your own risk. Microsoft Visual FoxPro and Windows are trade marks of Microsoft Corp. All other trademarks are the property of their respective owners. 

Privacy policy
Credits: PHP (4.4.9), an HTML-embedded scripting language, MySQL (5.6.38), the Open Source standard SQL database, AceHTML Freeware Version 4, freeware HTML Editor of choice.   Hosted by Korax Online Inc.
Last Topics Visited (54.198.246.116)
14 sec.Function: 'CeGetVersionEx'
Function group: 'Remote Application Programming (RAPI)'
29 sec.Gallery
44 sec.Function: 'GetCurrentThread'
Function group: 'Process and Thread'
1 min.Function: 'SCardGetProviderId'
Function group: 'Authentication'
1.25 min.Function: 'NetMessageNameAdd'
Function group: 'Network Management'
1.45 min.Function: 'SetFileAttributes'
Function group: 'File Management'
1.68 min.Function: 'GdipGetDpiX'
Function group: 'GDI+ Graphics'
1.9 min.Function: 'AVIStreamGetFrameClose'
Function group: 'Windows Multimedia'
2.13 min.Example: 'How to extract frames from AVI files'
2.33 min.Function: 'GetDeviceCaps'
Function group: 'Device Context'
Google
Advertise here!