rsa

Python: How to add RSA padding?

I've been looking at most python crypto libraries, I've decided to use either PyCrypto or M2Crypto. I've discarded ezPyCrypto because it only supports MD5 for signing and Keyczar because it's not mature enough. So I've read that RSA is vulnerable to several attacks if the to-be-encrypted text (or signature hash) is not properly padded. ...

SSH Public Key for user without home directory

I'm running a Mac OS X Leopard Server and I created a new user without designating a home directory for that user. Is it possible to have that user authenticate using a Public Key? I know that when a user does have a home directory it goes in to ~/.ssh/authorized_keys I don't want to create a home directory for this user because my und...

How is public key used to decrypt in .NET assemblies?

.NET signed assemblies contain public key, but the public key is used for encryption in RSA, then how does .NET uses the public key for decryption of signed assemblies? Ok, the signed assemblies contain the hash, but the hash is encrypted using the private key and not the public key. So, why and how in .NET private keys are used for enc...

Crypto library for C++

Duplicate of this one. I'm about to embark on journey that may change my career by doing a rather big project this time. I have experience in cryptography as I have taken several courses and written my own implementation of some algorithms (DES,AES,Schnorr) but I have never used any complete library for it. I want to know what library...

C# RSA equivalent code to the C++ Crypto API

DWORD nSize; LPBYTE lpData; HCRYPTKEY hPublicKey; nSize = ReadFromFile(lpszUserPublicKey, NULL); if(nSize == -1) return FALSE; lpData = new BYTE[nSize]; ReadFromFile(lpszUserPublicKey, lpData); if(!CryptImportKey(hProv, lpData, nSize, NULL, 0, &hPublicKey)) { delete lpData; return FALSE; } Erase(lpData, nSize); // Get the data...

RSACryptoServiceProvider <-> CryptImportKey Equivalency

If I have a key created from a unmanaged app and If I want to import this key in a managed app and generate another key or encrypt it. Basically the same key will be imported/exported back and forth from managed and unmanaged code. Therefore what is the equivalent to CryptExportKey(hKey, hPublicKey, SIMPLEBLOB, 0, lpData, &nSize); a...

CryptExportKey in C#

What is the C# equivalent to this CryptExportKey call? CryptExportKey(hKey, hPublicKey, SIMPLEBLOB, 0, lpData, &nSize); and it would be nice if you can give a description on your C# code where hKey, hPublicKey and SIMPLEBLOB (or their equivalent in C#) are being used ...

Encrypted data size using RSA encryption (RSACryptoServiceProvider)

I need to use some encryption mechanism in one of the project I am working on. I was exploring RSA encryption and wrote some sample programs to learn. I understand that block size of RSA encryption is 16 bytes. So I gave the string "12345678" as input to below function: public static string Encrypt (string input) { var byteConvert...

Crypto API <-> .NET RSA interoperability

I have a unmanaged application that is generates an RC4 encryption key using Crypto API. This unmanaged application encrypts some data using this RC4 key. There is also a client side unmanaged application that uses this RC4 key to decrypt information. However, for this client app we're sending a session key -> the RC4 key encrytped usi...

Managed SIMPLEBLOB blob doesn't match Unmanaged SIMPLEBLOB (RSA -Cryptography)

The simple blob that is generated using CryptExportKey(hKey, hPublicKey, SIMPLEBLOB, 0, lpData, &nSize); does not match the one generated from the following code (note that client.key is the plain text key value of hKey found using http://www.codeproject.com/KB/security/plaintextsessionkey.aspx ) CspParameters cspParams = new CspPa...

How do I automate a "last modified" text field in an RSM diagram?

My team is using Rational Software Modeler to build some UML diagrams. Each diagram has a little text box stating a human-readable title, the last-modified date, and some other information about the diagram. Is there a way to automatically keep the last-modified date up to date? A macro, perhaps? Or some sort of plugin to Eclipse? ...

Are there any other open source JCE libraries besides BouncyCastle?

I am looking for open source JCE libraries that implement some of the more esoteric encryption algorithms so that I can study their implementation. I would be especially interested in ones that implement Identity Based Encryption (IBE) as published by Stanford. ...

Web.Config encryption using RsaProtectedConfigurationProvider - "Bad Data" error

I am attempting to encrypt connection string values in the Web.Config file for an ASP.NET 2.0 web application, following the procedure described on MSDN. Using the RsaProtectedConfigurationProvider, I created and exported a machine-level key on my development machine (using the -pri flag), and imported the key and granted access on the w...

RSA Encryption-Decryption in iphone

I am developing Iphone application. I have used SecKeyGeneratePair method of Security/Security.h framework. I am getting public & private keys as SecKeyRef objects. Can I access the key or print its value to console? Can I get NSString or NSData object from it ? When i print the key to console using NSLog I am getting . Can we pass these...

Import RSA keys to iPhone keychain?

I have a couple of NSString objects that represent an RSA public-private keypair (not generated by SecKeyCreatePair, but by an external crypto library). How can I create SecKeyRef objects (which are required for the SecKeyDecrypt/Encrypt methods) from these NSString objects? Do I need to import them into the Keychain first? If so, how? ...

How to get public key from a certificate in iPhone programe?

Now I have a certificate which includes a public key,i want to get the public key from it in iPhone SDK programming, and encrypt a string by RSA with the public key.What should i do? Please help me!!Thanks very much. ...

Java RSA decryption did not work for the data decrypted with its public key in IPhone

Hi I have created my rsa public key in java and send to my friend. My friend is using IPhone, he encrypted data with that key and send me the decrypted data then I decrypted the data with my private key. But I am getting errors for Bad Padding. I and my friend both did not use any padding explicitly for RSA. Thanks Bapi ...

What mode to use to decrypt RSA message from iPhone in Java?

My friend has encrypted data with PKCS1 padding on an iPhone. How can I decrypt that data in Java? Java requires me to specify "algorithm/ciphermode/padding". The padding and the algorithm are known, but neither of us knows the cipher mode; it is not specified when encrypting on the iPhone. ...

Adding RSA keys to the iPhone keychain

Hello everyone, I'm trying to add a public and private RSA keys to the iPhone's keychain, so I can use the CommonCrypto library, but am not entirely sure how to do that. The MYCrypto library seems to only work for the Mac and not the iPhone right now. Can anyone help and explain how to add a private/public key to the keychain and get a ...

Cracking a N bit RSA modulo numbers

This is related to my previous post, where my only option was to have a RSA algorithm which seemed relatively weak. Let us assume that I want to encode a 35 bit number (From 0 upto 34359738367) with a 36 bit modulo (between 34359738368 upto 68719476735). Referring to http://en.wikipedia.org/wiki/RSA I can see that my n is between 34359...