AES string encryption in Objective-C

This line near the top says you’re adding AES functionality to NSMutableData: @implementation NSMutableData(AES) In Objective-C, this is called a category; categories let you extend an existing class. This code would typically go in a file named NSMutableData-AES.m. Create a header file too, NSMutableData-AES.h. It should contain: @interface NSMutableData(AES) – (NSMutableData*) EncryptAES: (NSString *) key; … Read more

Mcrypt js encryption value is different than that produced by PHP mcrypt / Mcrypt JS decrypt doesn’t work for UTF-8 chars

The main issue appears to be that your string_encrypt and string_decrypt PHP functions don’t have access to the $key variable, so for the encryption key mcrypt_encrypt is using \0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0. See this question for an explanation. PHP should report a notice that key is undefined, have you turned off error reporting perhaps? Echo the key from … Read more

SSLHandshakeException: Received fatal alert: handshake_failure when setting ciphers on tomcat 7 server

Well, I got this issue solved. It appears that by creating a self-signed certificate, using keytool, without providing -keyalg parameter makes the key-pair algorithm default to DSA. None of my ciphers suite included DSA algorithm. In that case, although the client and the server had intersection between their cipher-suites, neither was suitable for the key … Read more

How to build the Qt-SQL-driver-plugin ‘QSQLCIPHER’ for SQLite-DB with SQLCipher-extension using the Windows/MinGW-platform?

How to build the Qt-SQL-driver-plugin ‘QSQLCIPHER’ for SQLite-DB with SQLCipher-extension using the Windows/MinGW-platform: Qt 5.4.0 for Windows/MinGW Download Qt Install including the sources e.g to C:\Qt\Qt5.4.0 OpenSSL for Windows Download Win32 OpenSSL v1.0.2a Download Visual C++ 2008 Redistributable Install Visual C++ 2008 Redistributable by executing ‘vcredist_x86.exe’ Install OpenSSL v1.0.2a by executing ‘Win32OpenSSL-1_0_2.exe’ Target directory e.g. … Read more

How can I encrypt a querystring in asp.net?

Here is a way to do it in VB From: http://www.devcity.net/Articles/47/1/encrypt_querystring.aspx Wrapper for the encryption code: Pass your querystring parameters into this, and change the key!!! Private _key as string = “!#$a54?3” Public Function encryptQueryString(ByVal strQueryString As String) As String Dim oES As New ExtractAndSerialize.Encryption64() Return oES.Encrypt(strQueryString, _key) End Function Public Function decryptQueryString(ByVal strQueryString As … Read more

How to securely store a connection string in a WinForms application?

Simply , the .net framework allows you to do that , see http://msdn.microsoft.com/en-us/library/89211k9b(v=vs.80).aspx Relevant information: This goes into the machine.config file: <configProtectedData defaultProvider=”RsaProtectedConfigurationProvider”> <providers> <add name=”RsaProtectedConfigurationProvider” type=”System.Configuration.RsaProtectedConfigurationProvider, … /> <add name=”DataProtectionConfigurationProvider” type=”System.Configuration.DpapiProtectedConfigurationProvider, … /> </providers> </configProtectedData> And this is the application code: Shared Sub ToggleConfigEncryption(ByVal exeConfigName As String) ‘ Takes the executable file name without … Read more

How to decrypt simple XOR encryption

One of the cool things about XOR encryption is that when you apply it twice, you get back the original string – see http://en.wikipedia.org/wiki/XOR_cipher. In your function, xor_decrypt, you take string and key and return string ^ key. If, now, you xor that with the key again, you get (string ^ key) ^ key = string … Read more