encryption-asymmetric

Opening an RSA private key from Ruby

I think I know how to create custom encrypted RSA keys, but how can I read one encrypted like ssh-keygen does? I know I can do this: OpenSSL::PKey::RSA.new(File.read('private_key')) But then OpenSSL asks me for the passphrase... How can I pass it to OpenSSL as a parameter? And, how can I create one compatible to the ones generated b...

Truststore and Keystore Definitions

In Java, what's the difference between a keystore and a truststore? ...

Any tutorials on public key encryption in java?

I've been able find information on symmetric encryption and hashing but I've been having quite a bit of trouble finding much information on any sort of public key encryption for java. What I'd like to do is make a very simple proof of concept program that takes a string ( or a file I suppose), encrypts it with a public key and then decry...

Ok, so I've encrypted my data now where do I hide the key?

I have a database that contains sensitive information. I can encrypt / decrypt the data on the read write operations. The problem is that I need to store the key in the application. If someone has hacked their way in such they have access to the database then they can also grab the application (java) decomplie it and pull the key. This ...

Given a private key, is it possible to derive it's public key?

From whatever little I understand by reading various material, public-private key pair are the basis of assymetric encryption and also something about choosing 2 prime numbers (which is roughly your private key) and multiplying them (which is roughly your public key), I appears that it is possible to generate a public key if you know the...

X509Certificate encryption/decryption

I'm just starting to learn XML security. We have VS-2005 & ASP.Net 2.0. I want to send XML to a outside URL and it needs to be encrypted. I'm doing exactly what the MSDN articles ms229744 & ms229943 are doing, but when doing the DecryptDocument() method, I keep getting the "Unable to retrieve the decryption key." I'm using our SSL web ce...

Should one use Cryptographic message syntax (CMS) for this task?

Hello, I've the task to transfer small binary messages (1 or 2 kb long) between a desktop application and mobile devices. The messages should be encrypted asymmetrically (RSA for instance). From what I've learned one should use a hybrid cryptosystem for this kind of task: Generate random symmetric key Encrypt plain text with symmetric...

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 ...

Are there valid reasons for using a hardware encryption device (e.g. USB encryption dongle/keystore) over using a software library?

If your application needs to encrypt/decrypt data (for various reasons), are there any reasons why you would use a hardware device (e.g. a USB encryption device - like a Marx CryptoBox) instead of using a software encryption library (like .net Cryptography or writing your own) and keep your keys in a safe key store? I am looking for som...

Verifying a signature in java using a certificates public key

I'm looking to convert some C# code to the equivalent in Java. The C# code takes some string content, and a signature (generated using the private key, on a seperate machine) and combined with the public key it verifies the signature matches, providing a level of assurance that the request has not been tampered with. public bool Veri...

Is it possible to enforce web service calls from known client only?

Scenario: A publically available Web Service that I have full control over. But I only want this specific desktop application (my published application) to have access to the Web Service. I could store a secret password in the desktop client, but that would be easy to crack. Is there any known implementation that enforces this? PKI, as...

Why shouldn't we crypt with the private key in an asymmetrical cryptographic system?

In standard use of asymmetrical cryptographic system, encryption is done with public key, decryption with private key. Inversing the process, "encryption with private key" is called "signing". Standard tools, despite terminology and lack of direct tools, allows to implement encryption system that would use the private key for encryptio...

PGP - GnuPG - A few questions

I want to use GnuPG (http://www.gnupg.org/), the open source software that is a full replacement for PGP. The software looks great though I have never used it before. I will be using the software to encrypt files to transfer via the web, I am not using the software for emails. I have a few questions: 1) What are recommended GUI's av...

Implementing License Validation with RSA

I am about to sell a program I have written in C# and I want to control licenses for it, strictly. That means I want to let the client connect to my server every single time it starts. This also gives me the ability to disable keys (in case of chargebacks on paypal or distribution of the code). Of course this might be a hassle for other ...

RSA Encryption, getting bad length

When calling the following function : byte[] bytes = rsa.Encrypt(System.Text.UTF8Encoding.UTF8.GetBytes(stringToEncrypt), true); I am now getting the error: bad length. With a smaller string it works, any ideas what the problem could be the string I am passing is under 200 characters. ...

Java Encryption C# Decryption

Hi, I got a module which RSA encrypts the data and passes on to the C#. C# needs to decrypt it based on the public key (64 bit encoded) and the passed token. I have token , 64 bit encoded public key, can some help me get with the sample to get started. All I know from Java end is, it is using. I have got the result from Java end and nee...

rsacryptoserviceprovider using x509 certificates c#

i am using a certificate generated by makecert which has both private and public key. The java side uses this public key to encrypt the data and .net decrypts it back. I am trying to decrypt Java's encrypted 64 bit encoded string and getting bad data. To see if all is good on.Net end, I frist tried to encrypt with the public key and th...

Encryption and Decryption

i want to implement following scenario Client Application will have function which will 1)get a image as parameter 2)convert it into byte of array 3)encrypt it call a web service and pass this byte of array to that service Service Will have a function which will 1)recieve byte of array as parameter 2)decrypt it it 3)generate image f...

python X.509 asymmetric encryption

Hello I'm trying to understand how certificate and asymmetric encryption works. I'm looking for a python library where i can import public or private ca signed certificates and automatically encrypt or decrypt message in string format, i viewed the crypto library embedded in python source, but i don't know how to use the hex modulus and ...

Can I use the assemblies PublicKey to decrypt a string encrypted with the corresponding PrivateKey?

Signing an assembly in .NET involves a public/private key pair. As far as I can tell from what I've read .NET uses the RSA algorithm and the private key to sign the assembly, checking it with the embedded public key. I know how to retrieve the public key (Assembly.PublicKey). I was wondering, if that key could be used to decrypt a short...