Now then all.
Having a little trouble with an MVC app using Identity and Access and Azure STS on AppHarbor giving "Key not valid in specified state" errors.
From what I gather, this is due to the default encrpytion using a machine key, which obviously doesn't work with a load balanced scnario.
I've tried replacing with an RSA class RsaEncryptedSessionSecurityTokenHandler : SessionSecurityTokenHandler
That picks up a pfx file key (created with SelfCert) to use, but whilst this works locally, it doesn't work on the appharbor site: System.Security.Cryptography.CryptographicException: Keyset does not exist I'm guessing that this is because the key is tied to more than just the file.
So how does one solve the original problem? Been searching for a day for solutions, but nothing seems to apply to this situation.
TIA
EDIT: I've tried adapting this code: SessionSecurityTokenHandler trying to decrypt SessionSecurityToken in RSA-encrypted cookie using DPAPI; why?
for use in the new WIF 4.5 stuff like this:
List<CookieTransform> sessionTransforms = new List<CookieTransform>(new CookieTransform[]
{
new DeflateCookieTransform()
,
new RsaEncryptionCookieTransform
(e
.FederationConfiguration
.IdentityConfiguration
.ServiceCertificate)
,
new RsaSignatureCookieTransform
(e
.FederationConfiguration
.IdentityConfiguration
.ServiceCertificate)
});
SessionSecurityTokenHandler sessionHandler =
new SessionSecurityTokenHandler(sessionTransforms.AsReadOnly());
e.FederationConfiguration.IdentityConfiguration.SecurityTokenHandlers.AddOrReplace(sessionHandler);
But e.ServiceCertificate is always null.
Any thoughts?