cryptographicexception

NetworkCredential error in ASP.NET

…衆ロ難τιáo~ 提交于 2020-01-14 08:35:09
问题 I am trying to access a webpage through ASP.NET using the NetworkCredential class. However I keep getting an exception with the following message System.Security.Cryptography.CryptographicException: The handle is invalid Below is my code on how I am trying to call the function. Any help is greatly appreciated. C#: System.Net.WebClient client = new System.Net.WebClient(); client.Credentials = new System.Net.NetworkCredential("Admin", "Nimda"); Stack Trace [CryptographicException: The handle is

Bad Data when Encrypt and Decrypt with TDES

馋奶兔 提交于 2019-12-25 09:57:33
问题 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 encrypt the string: public void MssGenerateKeyPair(string ssSymmetricKey, out string ssCipheredKeyPair, out string ssPublicKey) { ssCipheredKeyPair = string.Empty; ssPublicKey = string.Empty; //Symmetric key is the hash of user's signing password

How to make openjdk 11 to support elliptic curve cryptography algorithm?

大城市里の小女人 提交于 2019-12-11 08:43:25
问题 Getting error "javax.net.ssl.SSLException: Could not generate ECDH keypair" when tried to invoke https URL in java application.It worked fine with Oracle JDK 1.8.0.152.It is not working when we migrated to Openjdk 11. How to make openjdk 11 to support elliptic curve cryptography algorithm? Note: We use windows 10 server, Tomcat8 and we use trusted CA certificate 来源: https://stackoverflow.com/questions/54922389/how-to-make-openjdk-11-to-support-elliptic-curve-cryptography-algorithm

Using X509Certificate2 to get PrivateKey causes CryptographicException “Invalid provider type specified”

谁说我不能喝 提交于 2019-12-10 15:24:00
问题 everyone, I am developing a web application that uses X509Certificate2 to get a private key from a certification file. Code snippet looks like following: public static RSACryptoServiceProvider GetSignProviderFromPfx() { var strFileName = "c:\cer\mycerfile.pfx"; var strPassword = "000000"; X509Certificate2 pc = new X509Certificate2(strFileName, strPassword, X509KeyStorageFlags.MachineKeySet); var ThePivateKey = pc.PrivateKey; return (RSACryptoServiceProvider)ThePivateKey; } But the statement

CryptographicException in RSA.ImportParameters() - Bad Data in special 1024 keys

僤鯓⒐⒋嵵緔 提交于 2019-12-06 11:15:25
问题 We have a C#/.Net 4.0 application which imports RSA Private Keys from a String in Base64 received in a WebService. This application works perfectly for RSA-Keys in 1024 bits, but doesn't with a special kind of rsa private keys (around 1% of keys). Here are the byte lengths: Working-Key: Modulus => 128 Bytes Exponent => 3 Bytes D => 128 Bytes P => 64 Bytes Q => 64 Bytes DP => 64 Bytes DQ => 64 Bytes IQ => 64 Bytes Not-Working-Key: Modulus => 128 Bytes Exponent => 3 Bytes D => 127 Bytes P => 64

TripleDES: Specified key is a known weak key for 'TripleDES' and cannot be used

孤街浪徒 提交于 2019-11-30 05:04:25
I'm using the .NET 3.0 class System.Security.Cryptography.MACTripleDES class to generate a MAC value. Unfortunately, I am working with a hardware device that uses " 1111111111111111 " (as hex) as a single-length DES key. The System.Security.Cryptography library does some sanity checking on the key and returns a Exception if you try to use a cryptographically weak key. For example: byte[] key = new byte[24]; for (int i = 0; i < key.Length; i++) key[i] = 0x11; byte[] data = new byte[] { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; byte[] computedMac = null; using (MACTripleDES mac = new

TripleDES: Specified key is a known weak key for 'TripleDES' and cannot be used

﹥>﹥吖頭↗ 提交于 2019-11-29 02:50:03
问题 I'm using the .NET 3.0 class System.Security.Cryptography.MACTripleDES class to generate a MAC value. Unfortunately, I am working with a hardware device that uses " 1111111111111111 " (as hex) as a single-length DES key. The System.Security.Cryptography library does some sanity checking on the key and returns a Exception if you try to use a cryptographically weak key. For example: byte[] key = new byte[24]; for (int i = 0; i < key.Length; i++) key[i] = 0x11; byte[] data = new byte[] { 0x00,

“Error occurred during a cryptographic operation” when decrypting Forms cookie

我只是一个虾纸丫 提交于 2019-11-28 21:05:25
I've uploaded my website to a webhosting and this error came up; ' Error occurred during a cryptographic operation .'. I've done some research and it seems that the formauthenticated cookie is bound to the MachineKey (which differs when using webhost). I've found a method that should fix this problem but the error remains. CODE: /// <summary> /// This method removes a cookie if the machine key is different than the one that saved the cookie; /// </summary> protected void Application_Error(object sender, EventArgs e) { var error = Server.GetLastError(); var cryptoEx = error as

CryptographicException was unhandled: System cannot find the specified file

a 夏天 提交于 2019-11-28 03:33:08
I am trying to embrace the mysteries of SSL communication and have found a great tutorial on this site . I was trying to test my own certificate. Using Visual Studio 2012, I simply added an existing file (my certificate in .pfx format) and then changed the "certificate" and "password" settings in app.config. However, when trying to run it, I got an error: CryptographicException was unhandled: System cannot find the specified file Then, I tried the same in my Web Service. There I got some more details about the error: System.Security.Cryptography.CryptographicException: System cannot find

App.config connection string Protection error

一世执手 提交于 2019-11-28 01:32:41
I am running into an issue I had before; can't find my reference on how to solve it. Here is the issue. We encrypt the connection strings section in the app.config for our client application using code below: config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None) If config.ConnectionStrings.SectionInformation.IsProtected = False Then config.ConnectionStrings.SectionInformation.ProtectSection(Nothing) ' We must save the changes to the configuration file.' config.Save(ConfigurationSaveMode.Modified, True) End If The issue is we had a salesperson leave. The old laptop is