cryptographic application block -Encryption problem

Topics: Cryptography Application Block
Oct 7, 2010 at 4:29 PM


1. I am trying to use the crytography application block in web app and have encountered  a problem

when i create a key file through enterprise library configuration ,i select e.g the symmetric provider and goes through the wizard of creating a key.Apart of the wizard wants to further enhance security by encrypting the key wither in user mode or machine mode,using the currently logged in userto encrypt the key or some machine information to encrypt the key

how can  i make  the cryptographic application block use a key that anyone have access to an can use?


how do i create this key?

2. when i deploy the created application using cryptography application block or logging block on some server system then  the encryption or logging is not working

do we need to install the microsoft enterprise library on the system?( microsoft dlls are already installed)




Oct 8, 2010 at 2:51 AM

1.  Are you asking if you can have the cryptographic application block use an existing key rather than create a new one?  Coz if that's the case there's an option to do that given to you in the same part where it gives you the option to create a new one.

    Or are you having trouble deciding which mode to use when encrypting the key file since both gives you a limitation on who can use the key? 


2.  Enterprise Library need not be installed as long as the assemblies are deployed with your application.  Are you encountering an exception?


Sarah Urmeneta
Global Technology and Solutions
Avanade, Inc.

Oct 8, 2010 at 5:03 AM

1. actually ihave used machine mode to encrypt but when i have deployed  it in xlocalsystem system it is throwing an exception.when i have recreated a new key in the xlocalsystem it is working i have to recreate a key to work so my question is can we create a akey which can be used in all the systems.

2.Yes i have encountered problem in logging and crytography application block.since there is no enterprise library installed on server so i have to manually copy the existing config of my local system to the server and therefore it  keeps on throwing exception in logging while the application is been executed on server.


Please help me.

Oct 8, 2010 at 5:12 AM

1.u said that theres an option to create a  new one which can be used in other systems if that is the case can you please tell me about that because i cant find it.right now i have used Rijndaelmanaged symmetric provider.

Oct 8, 2010 at 8:33 AM
Edited Oct 8, 2010 at 8:34 AM

You need to export first the key from the machine where you created it and import it to the machine where you want to deploy it using the EntLib Configuration tool.

To export the key, right click on the symmetric provider and click on Export Key.  It will prompt you for the location and file name where you want to save the file and a password.  Copy the key file and the exported file to the machine where you want to deploy it.  To import that key on that machine, open your config using the entlib config tool add a symmetric provider and select Import a password-protected key file and select the exported file.  Enter the password you used for exporting it.

On #2, what exception does it throw? 


Sarah Urmeneta
Global Technology and Solutions
Avanade, Inc.

Oct 8, 2010 at 9:31 AM

1. but what if the destination machine  doesnot contain the microsoft library installed?Any alternative where we can use same key file in other machines when microsft library is not available.

Oct 8, 2010 at 9:41 AM

Enterprise Library need not be installed but its assemblies should be copied to that machine.  If you have the assemblies, you could at least programmatically import the key file.  You may want to try out the sample code for doing this that was posted in this thread


Sarah Urmeneta
Global Technology and Solutions
Avanade, Inc.