Trying to use Cryptography Quickstart

  • Thread starter Thread starter BK
  • Start date Start date
B

BK

I downloaded and installed the Enterprise Library for .NET Framework
2.0 - January 2006. I ran the Cryptography Quickstart and it works
perfect. It does exactly what I need it to do, encrypts a string and
decrypts a string.

I copy the few lines of code (it looks SO easy at this point):

Const symmProvider As String = "symprovider"
Dim stringToEncrypt As String = Me.TextBoxOriginalValue.Text
Dim encryptedContentsBase64 As String
encryptedContentsBase64 =
Microsoft.Practices.EnterpriseLibrary.Security.Cryptography.Cryptographer.EncryptSymmetric(symmProvider,
stringToEncrypt)
Me.TextBoxEncrypted.Text = encryptedContentsBase64

and it gives me an error on the call to EncryptSymmetric. The error I
get is:

"Could not load file or assembly
'Microsoft.Practices.EnterpriseLibrary.Common, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=null' or one of its dependencies. The
system cannot find the file specified."

So I realize that I need a reference to another dll, I add that
reference, run it again and now I get an error message:

"The type initializer for
'Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder.EnterpriseLibraryFactory'
threw an exception."

I hoped that using the recommendation from Microsoft would be easier,
but I'm not getting it. I'm guessing at this point that I've missed
some step along the way, but I have no clue where to go at this point.
Any suggestions?
 
BK,

Did you set a reference.

There are many methods to do that, one is using the tab Project, in that Add
references and than browse
to where you have placed that downloadedfile.

I hope this helps,

Cor
 
Yes, I set a reference.
BK,

Did you set a reference.

There are many methods to do that, one is using the tab Project, in that Add
references and than browse
to where you have placed that downloadedfile.

I hope this helps,

Cor
 
Sorry,

I have overlooked that. You use Visual Studio 2005 as I may assume?

Cor
 
Back
Top