PC Review


Reply
Thread Tools Rating: Thread Rating: 1 votes, 1.00 average.

Another GUID Question - Code Project code

 
 
Glyn Meek
Guest
Posts: n/a
 
      15th Mar 2005
We are using the Code Project routines for generating GUIDs on the Pocket
PC.

http://www.codeproject.com/netcf/PPCGuidGen.asp

In an earlier posting, I mentioned that we occasionally get an error message

"Failed to acquire cryptography handle."

....and it turns out that this is generated out of the 'CodeProject' NewGuid
routine, by a piece of code that reads...

If Not WinApi.CryptAcquireContext(hCryptProv, Nothing, Nothing, _
WinApi.PROV_RSA_FULL, WinApi.CRYPT_VERIFYCONTEXT) Then
Throw New SystemException( "Failed to acquire cryptography handle.")
End If

Can anyone tell me under what circumstances the CryptAcquireContext routine
would fail and generate this error? I have received one response that
mentions that the DeKlarit GUID code had a similar error, with a 'fix'
mentioned, but the code is significantly different enough that it doesn't
apply to the 'CodeProject' stuff. Does anyone know if there is a later
version of the CodeProject code that has fixed this, or if any GUID code is
better than any other?

thanks

Glyn Meek


 
Reply With Quote
 
 
 
 
Peter Foot [MVP]
Guest
Posts: n/a
 
      15th Mar 2005
It can occur if your device doesn't have high encryption built in. Take a
look at the updated GuidEx code in the OpenNETCF vault
(http://vault.netcf.tv/VaultService/VaultWeb/login.aspx User: guest,
Password: guest) as this actually has three possible branches:-
On CE.NET 4.2 and higher it uses the native CoCreateGuid API method
On prior devices with crypto support it uses the crypto APIs
(OpenNETCF.Security.Cryptography)
On remaining devices it uses basic Windows CE random number generation.

Peter

--
Peter Foot
Windows Embedded MVP
http://www.inthehand.com | http://blog.opennetcf.org/pfoot/

"Glyn Meek" <(E-Mail Removed)> wrote in message
news:vFFZd.9469$(E-Mail Removed)...
> We are using the Code Project routines for generating GUIDs on the Pocket
> PC.
>
> http://www.codeproject.com/netcf/PPCGuidGen.asp
>
> In an earlier posting, I mentioned that we occasionally get an error
> message
>
> "Failed to acquire cryptography handle."
>
> ...and it turns out that this is generated out of the 'CodeProject'
> NewGuid routine, by a piece of code that reads...
>
> If Not WinApi.CryptAcquireContext(hCryptProv, Nothing, Nothing, _
> WinApi.PROV_RSA_FULL, WinApi.CRYPT_VERIFYCONTEXT) Then
> Throw New SystemException( "Failed to acquire cryptography handle.")
> End If
>
> Can anyone tell me under what circumstances the CryptAcquireContext
> routine would fail and generate this error? I have received one response
> that mentions that the DeKlarit GUID code had a similar error, with a
> 'fix' mentioned, but the code is significantly different enough that it
> doesn't apply to the 'CodeProject' stuff. Does anyone know if there is a
> later version of the CodeProject code that has fixed this, or if any GUID
> code is better than any other?
>
> thanks
>
> Glyn Meek
>



 
Reply With Quote
 
Chris Tacke, eMVP
Guest
Posts: n/a
 
      15th Mar 2005
You've got the high-encryption pack installed?

--
Chris Tacke
Co-founder
OpenNETCF.org
Has OpenNETCF helped you? Consider donating to support us!
http://www.opennetcf.org/donate


"Glyn Meek" <(E-Mail Removed)> wrote in message
news:vFFZd.9469$(E-Mail Removed)...
> We are using the Code Project routines for generating GUIDs on the Pocket
> PC.
>
> http://www.codeproject.com/netcf/PPCGuidGen.asp
>
> In an earlier posting, I mentioned that we occasionally get an error
> message
>
> "Failed to acquire cryptography handle."
>
> ...and it turns out that this is generated out of the 'CodeProject'
> NewGuid routine, by a piece of code that reads...
>
> If Not WinApi.CryptAcquireContext(hCryptProv, Nothing, Nothing, _
> WinApi.PROV_RSA_FULL, WinApi.CRYPT_VERIFYCONTEXT) Then
> Throw New SystemException( "Failed to acquire cryptography handle.")
> End If
>
> Can anyone tell me under what circumstances the CryptAcquireContext
> routine would fail and generate this error? I have received one response
> that mentions that the DeKlarit GUID code had a similar error, with a
> 'fix' mentioned, but the code is significantly different enough that it
> doesn't apply to the 'CodeProject' stuff. Does anyone know if there is a
> later version of the CodeProject code that has fixed this, or if any GUID
> code is better than any other?
>
> thanks
>
> Glyn Meek
>



 
Reply With Quote
 
Glyn Meek
Guest
Posts: n/a
 
      15th Mar 2005
Chris...this is one of our customers, as we can't reproduce it on any other
equipment, and I have no idea what equipment he's running on. This is the
first I have ever heard of a 'high-encryption pack'.

How does one know if it's installed?

and where does one get a hold of it?

Glyn


"Chris Tacke, eMVP" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> You've got the high-encryption pack installed?
>
> --
> Chris Tacke
> Co-founder
> OpenNETCF.org
> Has OpenNETCF helped you? Consider donating to support us!
> http://www.opennetcf.org/donate
>
>
> "Glyn Meek" <(E-Mail Removed)> wrote in message
> news:vFFZd.9469$(E-Mail Removed)...
>> We are using the Code Project routines for generating GUIDs on the Pocket
>> PC.
>>
>> http://www.codeproject.com/netcf/PPCGuidGen.asp
>>
>> In an earlier posting, I mentioned that we occasionally get an error
>> message
>>
>> "Failed to acquire cryptography handle."
>>
>> ...and it turns out that this is generated out of the 'CodeProject'
>> NewGuid routine, by a piece of code that reads...
>>
>> If Not WinApi.CryptAcquireContext(hCryptProv, Nothing, Nothing, _
>> WinApi.PROV_RSA_FULL, WinApi.CRYPT_VERIFYCONTEXT) Then
>> Throw New SystemException( "Failed to acquire cryptography handle.")
>> End If
>>
>> Can anyone tell me under what circumstances the CryptAcquireContext
>> routine would fail and generate this error? I have received one response
>> that mentions that the DeKlarit GUID code had a similar error, with a
>> 'fix' mentioned, but the code is significantly different enough that it
>> doesn't apply to the 'CodeProject' stuff. Does anyone know if there is a
>> later version of the CodeProject code that has fixed this, or if any GUID
>> code is better than any other?
>>
>> thanks
>>
>> Glyn Meek
>>

>
>



 
Reply With Quote
 
Chris Tacke, eMVP
Guest
Posts: n/a
 
      15th Mar 2005
http://www.microsoft.com/windowsmobi...ncryption.mspx

--
Chris Tacke
Co-founder
OpenNETCF.org
Has OpenNETCF helped you? Consider donating to support us!
http://www.opennetcf.org/donate


"Glyn Meek" <(E-Mail Removed)> wrote in message
news:1TGZd.11610$(E-Mail Removed)...
> Chris...this is one of our customers, as we can't reproduce it on any
> other equipment, and I have no idea what equipment he's running on. This
> is the first I have ever heard of a 'high-encryption pack'.
>
> How does one know if it's installed?
>
> and where does one get a hold of it?
>
> Glyn
>
>
> "Chris Tacke, eMVP" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> You've got the high-encryption pack installed?
>>
>> --
>> Chris Tacke
>> Co-founder
>> OpenNETCF.org
>> Has OpenNETCF helped you? Consider donating to support us!
>> http://www.opennetcf.org/donate
>>
>>
>> "Glyn Meek" <(E-Mail Removed)> wrote in message
>> news:vFFZd.9469$(E-Mail Removed)...
>>> We are using the Code Project routines for generating GUIDs on the
>>> Pocket PC.
>>>
>>> http://www.codeproject.com/netcf/PPCGuidGen.asp
>>>
>>> In an earlier posting, I mentioned that we occasionally get an error
>>> message
>>>
>>> "Failed to acquire cryptography handle."
>>>
>>> ...and it turns out that this is generated out of the 'CodeProject'
>>> NewGuid routine, by a piece of code that reads...
>>>
>>> If Not WinApi.CryptAcquireContext(hCryptProv, Nothing, Nothing, _
>>> WinApi.PROV_RSA_FULL, WinApi.CRYPT_VERIFYCONTEXT) Then
>>> Throw New SystemException( "Failed to acquire cryptography handle.")
>>> End If
>>>
>>> Can anyone tell me under what circumstances the CryptAcquireContext
>>> routine would fail and generate this error? I have received one response
>>> that mentions that the DeKlarit GUID code had a similar error, with a
>>> 'fix' mentioned, but the code is significantly different enough that it
>>> doesn't apply to the 'CodeProject' stuff. Does anyone know if there is a
>>> later version of the CodeProject code that has fixed this, or if any
>>> GUID code is better than any other?
>>>
>>> thanks
>>>
>>> Glyn Meek
>>>

>>
>>

>
>



 
Reply With Quote
 
Glyn Meek
Guest
Posts: n/a
 
      16th Mar 2005
I just spoke with our customer who has this issue, and he has a brand new
Dell Axim with Pocket OS 2003, so this shouldn't be a problem. He actually
tried the download anyhow, but it made no difference...any other
suggestions?

Glyn Meek

"Chris Tacke, eMVP" <(E-Mail Removed)> wrote in message
news:eSohY$(E-Mail Removed)...
> http://www.microsoft.com/windowsmobi...ncryption.mspx
>
> --
> Chris Tacke
> Co-founder
> OpenNETCF.org
> Has OpenNETCF helped you? Consider donating to support us!
> http://www.opennetcf.org/donate
>
>
> "Glyn Meek" <(E-Mail Removed)> wrote in message
> news:1TGZd.11610$(E-Mail Removed)...
>> Chris...this is one of our customers, as we can't reproduce it on any
>> other equipment, and I have no idea what equipment he's running on. This
>> is the first I have ever heard of a 'high-encryption pack'.
>>
>> How does one know if it's installed?
>>
>> and where does one get a hold of it?
>>
>> Glyn
>>
>>
>> "Chris Tacke, eMVP" <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed)...
>>> You've got the high-encryption pack installed?
>>>
>>> --
>>> Chris Tacke
>>> Co-founder
>>> OpenNETCF.org
>>> Has OpenNETCF helped you? Consider donating to support us!
>>> http://www.opennetcf.org/donate
>>>
>>>
>>> "Glyn Meek" <(E-Mail Removed)> wrote in message
>>> news:vFFZd.9469$(E-Mail Removed)...
>>>> We are using the Code Project routines for generating GUIDs on the
>>>> Pocket PC.
>>>>
>>>> http://www.codeproject.com/netcf/PPCGuidGen.asp
>>>>
>>>> In an earlier posting, I mentioned that we occasionally get an error
>>>> message
>>>>
>>>> "Failed to acquire cryptography handle."
>>>>
>>>> ...and it turns out that this is generated out of the 'CodeProject'
>>>> NewGuid routine, by a piece of code that reads...
>>>>
>>>> If Not WinApi.CryptAcquireContext(hCryptProv, Nothing, Nothing, _
>>>> WinApi.PROV_RSA_FULL, WinApi.CRYPT_VERIFYCONTEXT) Then
>>>> Throw New SystemException( "Failed to acquire cryptography handle.")
>>>> End If
>>>>
>>>> Can anyone tell me under what circumstances the CryptAcquireContext
>>>> routine would fail and generate this error? I have received one
>>>> response that mentions that the DeKlarit GUID code had a similar error,
>>>> with a 'fix' mentioned, but the code is significantly different enough
>>>> that it doesn't apply to the 'CodeProject' stuff. Does anyone know if
>>>> there is a later version of the CodeProject code that has fixed this,
>>>> or if any GUID code is better than any other?
>>>>
>>>> thanks
>>>>
>>>> Glyn Meek
>>>>
>>>
>>>

>>
>>

>
>



 
Reply With Quote
 
Glyn Meek
Guest
Posts: n/a
 
      16th Mar 2005
Would you recommend replacing the CodeProject code with the OpenNetCF code,
Peter?

Glyn




"Peter Foot [MVP]" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> It can occur if your device doesn't have high encryption built in. Take a
> look at the updated GuidEx code in the OpenNETCF vault
> (http://vault.netcf.tv/VaultService/VaultWeb/login.aspx User: guest,
> Password: guest) as this actually has three possible branches:-
> On CE.NET 4.2 and higher it uses the native CoCreateGuid API method
> On prior devices with crypto support it uses the crypto APIs
> (OpenNETCF.Security.Cryptography)
> On remaining devices it uses basic Windows CE random number generation.
>
> Peter
>
> --
> Peter Foot
> Windows Embedded MVP
> http://www.inthehand.com | http://blog.opennetcf.org/pfoot/
>
> "Glyn Meek" <(E-Mail Removed)> wrote in message
> news:vFFZd.9469$(E-Mail Removed)...
>> We are using the Code Project routines for generating GUIDs on the Pocket
>> PC.
>>
>> http://www.codeproject.com/netcf/PPCGuidGen.asp
>>
>> In an earlier posting, I mentioned that we occasionally get an error
>> message
>>
>> "Failed to acquire cryptography handle."
>>
>> ...and it turns out that this is generated out of the 'CodeProject'
>> NewGuid routine, by a piece of code that reads...
>>
>> If Not WinApi.CryptAcquireContext(hCryptProv, Nothing, Nothing, _
>> WinApi.PROV_RSA_FULL, WinApi.CRYPT_VERIFYCONTEXT) Then
>> Throw New SystemException( "Failed to acquire cryptography handle.")
>> End If
>>
>> Can anyone tell me under what circumstances the CryptAcquireContext
>> routine would fail and generate this error? I have received one response
>> that mentions that the DeKlarit GUID code had a similar error, with a
>> 'fix' mentioned, but the code is significantly different enough that it
>> doesn't apply to the 'CodeProject' stuff. Does anyone know if there is a
>> later version of the CodeProject code that has fixed this, or if any GUID
>> code is better than any other?
>>
>> thanks
>>
>> Glyn Meek
>>

>
>



 
Reply With Quote
 
Chris Tacke, eMVP
Guest
Posts: n/a
 
      16th Mar 2005
It's an option. The OpenNETCF code has some failsafes that the CodeProject
stuff apparently doesn't. Basically it tries several mechanisms, each less
desirable that the previous, to try to generate your GUID, at last resorting
to a random number generator. The idea is that you should always get a
result, not an exception. Obviously it means that how the result is
attained may change depending on the device.

--
Chris Tacke
Co-founder
OpenNETCF.org
Has OpenNETCF helped you? Consider donating to support us!
http://www.opennetcf.org/donate


"Glyn Meek" <(E-Mail Removed)> wrote in message
news:kFZZd.10144$(E-Mail Removed)...
> Would you recommend replacing the CodeProject code with the OpenNetCF
> code, Peter?
>
> Glyn
>
>
>
>
> "Peter Foot [MVP]" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> It can occur if your device doesn't have high encryption built in. Take a
>> look at the updated GuidEx code in the OpenNETCF vault
>> (http://vault.netcf.tv/VaultService/VaultWeb/login.aspx User: guest,
>> Password: guest) as this actually has three possible branches:-
>> On CE.NET 4.2 and higher it uses the native CoCreateGuid API method
>> On prior devices with crypto support it uses the crypto APIs
>> (OpenNETCF.Security.Cryptography)
>> On remaining devices it uses basic Windows CE random number generation.
>>
>> Peter
>>
>> --
>> Peter Foot
>> Windows Embedded MVP
>> http://www.inthehand.com | http://blog.opennetcf.org/pfoot/
>>
>> "Glyn Meek" <(E-Mail Removed)> wrote in message
>> news:vFFZd.9469$(E-Mail Removed)...
>>> We are using the Code Project routines for generating GUIDs on the
>>> Pocket PC.
>>>
>>> http://www.codeproject.com/netcf/PPCGuidGen.asp
>>>
>>> In an earlier posting, I mentioned that we occasionally get an error
>>> message
>>>
>>> "Failed to acquire cryptography handle."
>>>
>>> ...and it turns out that this is generated out of the 'CodeProject'
>>> NewGuid routine, by a piece of code that reads...
>>>
>>> If Not WinApi.CryptAcquireContext(hCryptProv, Nothing, Nothing, _
>>> WinApi.PROV_RSA_FULL, WinApi.CRYPT_VERIFYCONTEXT) Then
>>> Throw New SystemException( "Failed to acquire cryptography handle.")
>>> End If
>>>
>>> Can anyone tell me under what circumstances the CryptAcquireContext
>>> routine would fail and generate this error? I have received one response
>>> that mentions that the DeKlarit GUID code had a similar error, with a
>>> 'fix' mentioned, but the code is significantly different enough that it
>>> doesn't apply to the 'CodeProject' stuff. Does anyone know if there is a
>>> later version of the CodeProject code that has fixed this, or if any
>>> GUID code is better than any other?
>>>
>>> thanks
>>>
>>> Glyn Meek
>>>

>>
>>

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Using GUID and SQL in code Marc Microsoft ASP .NET 4 12th Aug 2008 06:41 PM
C# 2005 how to remove warning "The file 'C:\Main.cs' does not support code parsing or generation because it is not contained within a project that supports code. Serdge Kooleman Microsoft C# .NET 0 9th Feb 2006 05:43 PM
Referencing GUID in VBA code to SQL db =?Utf-8?B?c3RlZWw=?= Microsoft Access ADP SQL Server 3 1st Feb 2006 06:32 AM
How add an autoincrement GUID field by code? Bertrand Microsoft Access Database Table Design 4 10th Jan 2006 03:37 AM
How to produce GUID from code? RA Microsoft C# .NET 1 8th Jan 2004 07:38 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:18 AM.