Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7609207
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T01:06:58+00:00 2026-05-31T01:06:58+00:00

I’m newly experimenting with the cryptography application block while using Autofac as the container.

  • 0

I’m newly experimenting with the cryptography application block while using Autofac as the container.

As a result, I’m using the nuget package EntLibContrib 5.0 – Autofac Configurator.

With the DPAPI Symmetric Crypto Provider, I was able to encrypt/decrypt data just fine.

However, with RijndaelManaged, I receive an ActivationException:

Microsoft.Practices.ServiceLocation.ActivationException: Activation error occured while trying to get instance of type ISymmetricCryptoProvider, key “RijndaelManaged” —> Autofac.Core.Registration.ComponentNotRegisteredException: The requested service ‘RijndaelManaged (Microsoft.Practices.EnterpriseLibrary.Security.Cryptography.ISymmetricCryptoProvider)’ has not been registered. To avoid this exception, either register a component to provide the service, check for service registration using IsRegistered(), or use the ResolveOptional() method to resolve an optional dependency.

Per instructions here: http://msdn.microsoft.com/en-us/library/ff664686(v=pandp.50).aspx
I am trying to inject CryptographyManager into MyService.

My bootstrapping code looks like this:

        var builder = new ContainerBuilder();
        builder.RegisterEnterpriseLibrary();
        builder.RegisterType<MyService>().As<IMyService>();
        _container = builder.Build();

        var autofacLocator = new AutofacServiceLocator(_container);
        EnterpriseLibraryContainer.Current = autofacLocator;

App.config has this info defined for symmetricCryptoProviders:

name: RijndaelManaged
type: Microsoft.Practices.EnterpriseLibrary.Security.Cryptography.HashAlgorithmProvider, Microsoft.Practices.EnterpriseLibrary.Security.Cryptography, Version=5.0.505.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
algorithmType:System.Security.Cryptography.RijndaelManaged
protectedKeyFilename:[path_to_my_key]
protectedKeyProtectionScope: LocalMachine

Anyone have experience in this combination of technologies?

After some testing, I believe I may go with a Unity container instead, since I have no preference in IOC containers other than whatever I use should integrate nicely with ASP.NET MVC3 and http-hosted WCF services.

My bootstrapping code then becomes more simple:

var container = new UnityContainer()
.AddNewExtension<EnterpriseLibraryCoreExtension>();
container.RegisterType<IMyService, MyService>();

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T01:07:00+00:00Added an answer on May 31, 2026 at 1:07 am

    I actually wrote the Autofac EntLib configurator (with some help from some of the P&P folks). It’s been tested with the exception handling block and logging block, but I haven’t tried it with the cryptography stuff.

    EntLib has an interesting thing where it sometimes requires registered services to be named, and I’m guessing from the exception where it says…

    type ISymmetricCryptoProvider, key "RijndaelManaged"
    

    …I’m thinking EntLib wants you to register a named service, like:

    builder.Register(c =>
                     {
                       // create the HashAlgorithmProvider using
                       // RijndaelManaged algorithm
                     })
            .Named<ISymmetricCryptoProvider>("RijndaelManaged");
    

    I’m sort of guessing at the exact registration since, again, I’ve not got experience with it or tested it, but the idea is that EntLib is trying to register a named service whereas the actual service isn’t getting registered with the name.

    The RegisterEnterpriseLibrary extension basically goes through and tries to use the same algorithm that Unity uses to do the named/unnamed registrations. I’m guessing you’ve encountered an edge case where something’s not getting handled right. EntLib is pretty well tied to Unity, even if they did try to abstract it away.

    If you’re not tied to Autofac, Unity is going to be your lowest-friction path forward. I like the ease of use and more lightweight nature of Autofac, and my apps are tied to it, so I needed everything to work that way; if you don’t have such an affinity, might be easier to just use Unity.

    Sorry that’s not a super answer. EntLib wire-up in IoC is a really complex beast.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am reading a book about Javascript and jQuery and using one of the
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
We are using XSLT to translate a RIXML file to XML. Our RIXML contains
I have thousands of HTML files to process using Groovy/Java and I need to
I am using Paperclip to handle profile photo uploads in my app. They upload

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.