The easiest way to integrate Social Login in your React Apps ...Checkout NPM

Wednesday, March 25, 2015

CryptographicException - Key not valid for use in specified state

Recently, I was caught with frustrating exception
"CryptographicException “Key not valid for use in specified state.” while attempting to generate pass using passbook generator using C#. The fix for me was to install the certificate NOT by installing the certificate by opening the cert installer but instead installing it from the MMC console.

1. Open MMC
2. If you don't see certificates, in Files selectAdd remove snap In
2a. Select Certificate options and add it to right followed by your certificates needs
3. Once you have the certificate snap-in and opt for Import from context menu, locate your pfx or pk12 and complete wizard.

Ensure to select "Mark this key as exportable" in wizard step where you punch in password