Questions tagged [cryptographicexception]

41 questions
0
votes
1 answer

How to avoid CryptographicException?

You receive a System.Security.Cryptography.CryptographicException when a decryption fails because the key is wrong. How does one avoid it? Is there a built-in solution that preferably looks like this? if (someClass.TryDecrypt(encrypted key, out var…
Behrooz
  • 1,696
  • 2
  • 32
  • 54
0
votes
0 answers

set load user profile to true for cryptographic exception but it is writing logs in AppData

I have a WCF service which in turn calls other service and uses .p12 key for verification. I have set Load User Profile in Application pool to true to handle "CryptographicException was unhandled: System cannot find the specified file" exception.…
Krish
  • 25
  • 1
  • 1
  • 6
0
votes
1 answer

Bad Data when Encrypt and Decrypt with TDES

I'm encrypting a big string with TDES and trying to decrypt it. Can't understand what's is wrong. When it does the READ function in decryption I get "Bad Data" from the Cryptographic Exception. (I marked the line with comments) To generate and…
Miguel Ribeiro
  • 8,057
  • 20
  • 51
  • 74
0
votes
1 answer

System.Security.Cryptography.CryptographicException: 'The key {00000000-0000-0000-0000-000000000000} was not found in the key ring.'

I have deployed a webjob (.Net 4.6) which encrypts some url strings and sends it to customers via email. I used .NET Core's IDataProtector for the encrpytion and I had to manually reference the DLL since webjob .net 4.6 was not supporting its…
0
votes
1 answer

CryptographicException: Invalid input block size when decrypt a binary file by RijndaelManaged

I want to encrypt a binary file in server side by javascript and decrypt on client side by c# in Unity. The code server side: var reader = new FileReader(); if(body.hasClass('encrypt')){ // Encrypt the file! reader.onload…
TccHtnn
  • 916
  • 2
  • 8
  • 12
0
votes
1 answer

Configuring DataProtectionSecurityStateEncoder, to resolve CryptographicException in Web Farm

We have an Authenticated WCF service running in a web farm that is intermittently throwing this error: MessageSecurityException: The SecurityContextSecurityToken has an invalid Cookie. The following error occurred when processing the Cookie: 'Error…
Chris
  • 3,487
  • 3
  • 25
  • 37
0
votes
0 answers

RSACryptoServiceProvider.Decrypt() throws "bad data" in console application while the same code works in WCF application

string keyName = "c94a1e1f-177c-460a-8a34-bf1a3da300a2"; string valueToDecrypt =…
Binu Vijayan
  • 803
  • 1
  • 9
  • 24
0
votes
0 answers

RC2 Encryption/Decryption

When I'm trying to decrypt a string the visual studio throws an exception: System.Security.Cryptography.CryptographicException and says that length of data for decrypting is invalid. Exception trows when compiler reaches cs.Close() in RC2_Decrypt…
0
votes
1 answer

Unity mobile phones SSL connection error

I'm struggling with an error when connecting to SSL server. I still get some cryptographic error when I do something like this: _client = new TcpClient(); _sslStream = new SslStream(_client.GetStream(), false, (x, y, z, v) => true, null); It…
0
votes
0 answers

CryptographicException: a signature method is required in ASP.NET

In Visual Studio 2012, when running in Debug mode using the built-in server ("Use Visual Studio Development Server") the following code runs fine: Dim mySignedXml As SignedXml = SignResponse(doc, cert) Dim xml As XmlElement =…
Tim
  • 8,669
  • 31
  • 105
  • 183
0
votes
1 answer

Orchard signalr CryptographicException

I got this exception with Orchard with SignalR 1.3.1 chat module deploed on IIS on windows server 2008. It works fine in debug environment. The data protection operation was unsuccessful. This may have been caused by not having the user profile…
1 2
3