Invalid algorithm specified ASP.net & x509

I’m trying to convert a library designed for Desktop Apps into one i can use for asp.net, its been going pretty well so far and I have overcome most of the problems but the one that has me stumped is: System.Security.Cryptography.CryptographicException: Invalid algorithm specified. X509Certificate2 cert = new X509Certificate2(certPrivateKeyData, certFilePwd, X509KeyStorageFlags.MachineKeySet | X509KeyStorageFlags.PersistKeySet | X509KeyStorageFlags.Exportable); […]