Home All Groups Group Topic Archive Search About

Trying to use Cryptography Quickstart

Author
17 Jul 2006 9:07 PM
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?

Author
18 Jul 2006 4:50 AM
Cor Ligthert [MVP]
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

Show quoteHide quote
"BK" <bkunn***@hotmail.com> schreef in bericht
news:1153170428.779131.198670@p79g2000cwp.googlegroups.com...
>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?
>
Author
18 Jul 2006 11:39 AM
BK
Yes, I set a reference.

Cor Ligthert [MVP] wrote:
Show quoteHide quote
> 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
>
> "BK" <bkunn***@hotmail.com> schreef in bericht
> news:1153170428.779131.198670@p79g2000cwp.googlegroups.com...
> >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?
> >
Author
18 Jul 2006 11:46 AM
Cor Ligthert [MVP]
Sorry,

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

Cor

Show quoteHide quote
"BK" <bkunn***@hotmail.com> schreef in bericht
news:1153222752.878653.232150@m73g2000cwd.googlegroups.com...
> Yes, I set a reference.
>
> Cor Ligthert [MVP] wrote:
>> 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
>>
>> "BK" <bkunn***@hotmail.com> schreef in bericht
>> news:1153170428.779131.198670@p79g2000cwp.googlegroups.com...
>> >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?
>> >
>
Author
18 Jul 2006 11:57 AM
BK
No problems, yes I use VS 2005.

Show quoteHide quote
> Sorry,
>
> I have overlooked that. You use Visual Studio 2005 as I may assume?
>
> Cor