Hi,
.386
.model flat,stdcall
;include \masm32\include\windows.inc
include \masm32\include\masm32rt.inc
include \masm32\include\advapi32.inc
includelib \masm32\lib\advapi32.lib
.data?
hCSP DWORD ?
.data
;---------------------------------------------
; Cryptographic provider type
;
MS_DEF_PROV BYTE "Microsoft Base Cryptographic Provider v1.0",0
MS_ENHANCED_PROV BYTE "Microsoft Enhanced Cryptographic Provider v1.0",0
.code
start:
push 0
push dword ptr 24 ;PROV_RSA_FULL is already definied in windows.inc it seems (although it is actually in WinCrypt.h)
push 0
push offset MS_DEF_PROV
push 0
lea eax,hCSP
push eax
call CryptAcquireContext
call GetLastError
print str$(eax)
push 0
push hCSP
call CryptReleaseContext
ret
end start
According to http://msdn.microsoft.com/en-us/library/aa379886%28VS.85%29.aspx error
NTE_BAD_PROV_TYPE( 0x80090014L ) is:
QuoteThe value of the dwProvType parameter is out of range. All provider types must be from 1 through 999, inclusive.
What the hell am I missing???? :red I tried everything I can think of - no go. Note I am testing this in XP Mode - I have already found it doesn't like some things in there.
Best regards,
Robin.
Quote push 0 ; dwFlags
push dword ptr 24 ; PROV_RSA_FULL is already NOT defined in windows.inc it seems (although it is actually in WinCrypt.h)
push 0 ; pszProvider
push offset MS_DEF_PROV
push 0 ; pszContainer
; lea eax,hCSP
; push eax
push offset hCSP
call CryptAcquireContext
call GetLastError
print LastError$()
Invalid provider, in genuine XP.
MS Enhanced Provider (MS_ENHANCED_PROV) IS a valid provider........ ??????? :dazzled:
http://msdn.microsoft.com/en-us/library/aa386986%28VS.85%29.aspx
So AES is now part of the Base provider? Note I'm not (knowingly) running the export version of XP with restricted crypto.
The following works:
push CRYPT_VERIFY_CONTEXT
push PROV_RSA_AES
push 0
push 0
push offset hCSP
call CryptAcquireContext
EDIT: http://msdn.microsoft.com/en-us/library/aa386979%28VS.85%29.aspx
Hmmmm - seems it auto-selects a suitable provider?? The docs say it just uses the default provider though if none is named, and not to use the default as export restrictions change over time and so the default may not be suitable.
Very confused,
Robin.
Hi,
On XP SP3, the provider type to use to get the Microsoft AES Cryptographic Provider is:
Provider BYTE "Microsoft Enhanced RSA and AES Cryptographic Provider (Prototype)",0
On Vista/Win 7 the provider to use is:
Provider BYTE "Microsoft Enhanced RSA and AES Cryptographic Provider",0
Best regards,
Robin.