cryptography

generating MD5 hash of a text with C#

I understand that System.Security.Cryptography has a MD5 hashing method in MD5.ComputeHash. However, the method takes and returns bytes. I don't understand how to work with this method using String key and hashes. I try to work around by doing this, var hash = MD5.Create().ComputeHash(Encoding.UTF8.GetBytes(@"text".ToCharArray())); for...

Is RNGCryptoServiceProvider as good as a hardware RNG?

I'm attempting to work out whether a hardware RNG is actually any safer than RNGCryptoServiceProvider. Given that randomness from RNGCryptoServiceProvider is provided using various system and user data such as the process ID, thread ID, system clock, system time, system counter, memory status, free disk clusters, and hashed user environ...

Custom Assymetric Cryptography Algorithm.

Hi everyone. I want to use an asymmetric cryptography algorithm, but i need it have short Key Size(not like RSA which is at least 384). I need it to be about around 20. Is it possible ? ...

Parsing bug in RSACryptoServiceProvider.ImportParameters with zero-byte-prefix elimination?

I had some problems where RSA keys created using the Security.Cryptography.RSAParameters were working only most of the time with RSACryptoServiceProvider.ImportParameters. After a bunch of debugging it appears that the properties of that object want very specific byte buffer sizes. My ASN.1 parsing code has zero-byte-prefix elimination....

Generating SHA-256 hash in Python 2.4 using M2Crypto

Is it possible to generate a SHA-256 hash using M2Crypto? Python 2.4's SHA module doesn't support 256, so I started using PyCrypto, only to find out that PyCrypto doesn't support PKCS#5 (needed elsewhere in my project.) I switched to M2Crypto as a result and now I would like to replace my PyCrypto SHA-256 call with an M2Crypto equivale...

Generating Large Prime Numbers for Diffie-Hellman in Ruby

I'm writing an implementation of a diffie-hellman key exchange in ruby for a project for one of my university classes. I need to generate large (secure) prime numbers of at least 500 bits length. Any ideas? Should I use the OpenSSL library? If so, what functions would you recommend? ...

How to export a public key in OpenSSL/libcrypto?

Hi All, I've created an RSA key using: RSA_generate_key(2048, RSA_F4, NULL, NULL); Now I want to export the public key to another party B. Right now, I've just memcpy'd the entire RSA* struct and sent that over the wire, and B is able to use that to encrypt using RSA_public_encrypt(). But I think in this case I've actually exported t...

How to create an X509Certificate2 that is signed by another (self-signed) certificate?

I have generated my own self-signed X509Certificate2 in C#. Now how do I create another certificate that is signed by the first in .NET? ...

Is there any case insensitive Unicode character encoding class ?

I am using the following code for charater encoding of unicode charater. It is giving me the different string value of MD5EncryptedString when I use the value of the DataToEncrypt as 'abc' & 'ABC' String DataToEncrypt="abc"; String MD5EncryptedString = String.Empty; MD5 md5 = new MD5CryptoServiceProvider(); Byte[] encodedBytes = A...

How can constructing an X509Certificate2 from a PKCS#12 byte array throw CryptographicException("The system cannot find the file specified.")?

I'm trying to construct an X509Certificate2 from a PKCS#12 blob in a byte array and getting a rather puzzling error. This code is running in a desktop application with administrator rights on Windows XP. The stack trace is as follows, but I got lost trying to troubleshoot because _LoadCertFromBlob is marked [MethodImpl(MethodImplOption...

What is the most secure way to encrypt a file with sensitive data?

Can anyone recommend me a way to encode files of sensitive data so that no one can crack them? I will be the only who knows the password. I am thinking of using GPG but I know next to nothing about security. Any suggestions which algorithm from GPG to use for encryption? Thanks, Boda Cydo. ...

How to create cookie which is Theft proof and can not be tempered by user/client?

Theft proof means i can detect that this is coming from different client IP/ or over different route (when client is behind proxy or something) temper proof mean i can detect that cookie is not valid and not sent by server!! ...

new encryption algorithm for ssh

hi dears I am asked to add a new algorithm to ssh so data is ciphered in new algorithm, any idea how to add new algorithm to ssh ? thanks ...

Python Asymmetric Encryption: Using pre-generated prv/pub keys

Ok first off yes I have searched google and stackoverflow and done some reading (over 4 hours JUST in this sitting) have not found what I need for these reasons: Many of them suggest just launching an exe like gpg.exe (http://stackoverflow.com/questions/1020320) Some suggested using PyCrypto or other libraries and looking at them, eith...

Equivalent to PasswordDeriveBytes in openssl

I have C# code as below: private static string password = "Password"; private static string salt = "SALT"; private static string hashAlgorithm = "SHA1"; private static int iterations = 2; var saltValueBytes = Encoding.UTF8.GetBytes(salt); var passwordKey = new PasswordDeriveBytes(passwor...

Convert.FromBase64String FormatException.....

I get a FormatException for this Convert.FromBase64String method. I don't mind about hardcoding the value. Anyone can explain why I get this exception. // Instantiate a new RijndaelManaged object to perform string symmetric encryption RijndaelManaged rijndaelCipher = new RijndaelManaged(); // Set key and IV ...

TripleDESCryptoServiceProvider FIPS 140-2 Compliance

Hello everybody. I am using the System.Security.Cryptography's TripleDESCryptoServiceProvider in the following manner: TripleDESCryptoServiceProvider CreateCipher() { TripleDESCryptoServiceProvider cipher = new TripleDESCryptoServiceProvider(); cipher.KeySize = 192; cipher.BlockSize = 64; ...

Delphi AES library (Rijndael) tested with KAT Vectors

Hi, for these 2 libraries, Delphi Encryption Compendium v 5.2 TurboPower Lockbox v 2.07 I tested their Rijndael DCB/CBC algorithm with "AES Known Answer Test (KAT) Vectors" obtained at NIST website (http://csrc.nist.gov/groups/STM/cavp/index.html) But, both of these libraries failed the tests. Not sure if it was my testing that has...

API's for implementing cryptography methods

Are there any softwares or API's that provide the implementations of cryptographic methods like RSA , DES etc... ??? ...

Ideal hashing method for wide distribution of values?

As part of my rhythm game that I'm working, I'm allowing users to create and upload custom songs and notecharts. I'm thinking of hashing the song and notecharts to uniquely identify them. Of course, I'd like as few collisions as possible, however, cryptographic strength isn't of much importance here as a wide uniform range. In addition, ...