rsa

how to store/retreieve RSA public/private key

I want to use RSA public key encryption, and I'm wondering what is the best way to store or retrieve private and public key. Is XML a good idea here? How to get the keys? RSAParameters privateKey = RSA.ExportParameters(true); RSAParameters publicKey = RSA.ExportParameters(false); Because RSAParameters have the following members: D, D...

how to use RSA to encrypt files (huge data) in C#

I'm new to encryption. I need to implement asymmetric encryption algorithm, which i think it uses private/public key. I started using a sample of RSACryptoServiceProvider. it was ok with small data to encrypt. But when using it on relatively larger data "2 lines", i get the exception CryptographicException "Bad Length"! //Create a new ...

Security.framework interoperability

I have a situation where we have some server side data that is generated with a ruby script. That data is signed using the Ruby OpenSSL module like so: def sign_string(string) Base64.encode64(@private_key.sign(OpenSSL::Digest::SHA1.new, string)); end That data eventually ends up on an iPhone, where I would like to verify it using th...

Biginteger in Iphone and related funtions

I have a RSA Exponent key value which is supposed to be a biginteger but i have it in NSString/NSdata with full value in(UTF8 encoded) as Part of RSA encryption , i need to do the following in the Iphone Env I need to find the bit length of the above exponent value I need to do arithmatic operations on exponent and modulus values incl...

RSA decrypt with Java

I am trying to decrypt a string with RSA. It was encrypted in C# on the iPhone and I have the private key. This seems like a silly problem, but all of the examples I have seen show generating the private key. I have the private key (it is a byte[] of hex). It using PKCS#1 padding. The part I cannot figure out how to do is create a ja...

Bouncycastle: what does the subKeyID-Parameter of AddKeyTransRecipient do?

I'm trying to asymetrically encrypt a message of arbitrary length with bouncycastle. (1.4+ with C#) This is the code I have right now. It is supposed to (but doesn't) generate a CMS message where the data itself is encrypted with AES256 with a random key and the key is encrypted with the public key from keyPair. keyPair is an RSA-Key ...

Reading a ASN.1 DER-encoded RSA Public key

I'm writing an app to get a better understanding of DKIM. The spec says I retrieve a "ASN.1 DER-encoded" public key from the domain TXT record. I can seen the key on "s1024._domainkey.yahoo.com" = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDrEee0Ri4Juz+QfiWYui/E9UGSXau/2P8LjnTD8V4Unn+2FAZVGE3kL23bzeoULYv4PeleB3gfm". How can I use this key...

Padding error when using RSA Encryption in C# and Decryption in Java

Currently I am receiving the following error when using Java to decrypt a Base64 encoded RSA encrypted string that was made in C#: javax.crypto.BadPaddingException: Not PKCS#1 block type 2 or Zero padding The setup process between the exchange from .NET and Java is done by creating a private key in the .NET key store then from the ...

Alternate solution for RSA security ID

Do we have any alternate solution to replace RSA Security ID for the web-application developed in JAVA-Servlet? More Details: The Current application uses RSA Security ID for authentication. Now we are planning to replace "RSA Security ID" technology. Is there any way to implement this authentication? (Simply db/ldap password are not ...

C# How to Generate Unique Public and Private Key via RSA

I am building a custom shopping cart where CC numbers and Exp date will be stored in a database until processing (then deleted). I need to encrypt this data (obviously). I want to use the RSACryptoServiceProvider class. Here is my code to create my keys. public static void AssignNewKey(){ const int PROVIDER_RSA_FULL = 1; const...

How do I decrypt RSA data in C#.NET appropriately?

Hello. My server creates a RSACryptoServiceProvider and exports its parameters to a variable (RSAKeyInfo). Then, the public key is sent to the client, and the client encrypts something with that public key. Now, I need to be able to decrypt this very data when sent back to the server - hence why RSA is useful in my case. However, I g...

How do I combine n and e to create the public key in RSA?

Hello :) I have a 128 byte (1024 bit) modulus (in a byte array format) and my exponent (also in a byte array format). I need to create a 128 bytes byte array representing the public key. According to Wikipedia, "The public key consists of the modulus n and the public (or encryption) exponent e." But that doesn't tell me how to mix both...

Using Crypto++ generated RSA keys on OpenSSL

Is there a way to use the RSA keys I've generated with the Crypto++ API in OpenSSL? What I am looking for is a way to store the keys in a format that both Crypto++ and OpenSSL can easily open them. I'm writing a licensing scheme and would want to verify signatures and decrypt files using the Crypto++ API, but to generate the license fil...

How do I get the fully-qualified object name in a BIRT report?

I have a BIRT report in Rational Software Architect that outputs an element's name in one column. When I run the report on my whole project, I get lots of duplicate columns because I have elements with the same (unqualified) name in different packages. How can I edit the BIRT report to use the fully-qualified name? ...

open type dialog is empty - RSA (Rational Software Architetc) for WebSphere 7.5.0 on Linux (Ubuntu 9.04)

I have a fresh install of RSA 7.5.3 in Linux (Ubuntu 9.04). I've create a new workspace with one Java project. When I open the "open type" dialog I get an empty box - see attached screenshot. You can notice that there is no package specified at the bottom of the dialog. when I try to look for a class I get the following exception: Error...

Why can't I import this data to my RSACryptoServiceProvider? (C#.NET)

Hello :) For testing purposes, I have a set modulus and private exponent that I want to export into RSACryptoServiceProvider. Here is my code: byte[] N = { 0x00, 0x8C, 0x35, 0x04, 0xC8, 0x40, 0xB3, 0x67, 0xD8, 0x42, 0x35, 0x78, 0xF6, 0x2A, 0x02, 0xBE, 0xF7, 0x1C, 0xCD, 0x9D, 0x98, 0x55, 0x16, 0x3F, 0x81, 0xA4, 0xE5, 0x3E, 0x3...

"Bad Key." exception when decrypting with RSACryptoServiceProvider (C#.NET)

Hello. I am trying to decrypt data that has been encrypted previously in RSA (don't worry, I'm supposed to be able to, I have the keys. Nothing illegal :). However, I get a "Bad Key." error at the decryption line. I am sure this key is right, as I took it from vectors. The vectors are provided in the following code. Theoretically, I ha...

Unspecified error when encrypting data with C#.NET RSA

Hello :) I have no idea how to describe my problem. It is the simplest way to encrypt a byte array, and I literally get "Unspecified Error" at the .Encrypt(...) method. byte[] cleartext = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0...

How to make RSACryptoServiceProvider work without padding (nopadding)?

Hello :) I need to make a C# application compatible with a Java application. The Java application uses a Cipher.getInstance("RSA/ECB/nopadding"); initializer to make the cipher ECB and no-padding. However, in C#, you have 2 options for padding: OAEP padding or PKCS#1 v1.5 padding. I need a no-padding version, or else I'm definitely s...

Encrypting with RSA private key in Java

I'm trying to encrypt some content with an RSA private key. I'm following this example: http://www.junkheap.net/content/public_key_encryption_java but converting it to use private keys rather than public. Following that example, I think what I need to do is: Read in a DER-format private key Generate a PCKS8EncodedKeySpec call gener...