rsa

Create x509 certificate with openssl/makecert tool

I'm creating a x509 certificate using makecert with the following parameters: makecert -r -pe -n "CN=Client" -ss MyApp I want to use this certificate to encrypt and decrypt data with RSA algoritm. I look to generated certificate in windows certificate store and everything seems ok (It has a private key, public key is a RSA key...

RSA Cryptography in c#

Suppose an RSA algorithm created private key on two machines. Is there any possibility that both keys are the same? ...

How do i generate random data with RSA?

After loading my RSACryptoServiceProvider rsa object i would like to create a key for my AES object. Since i dont need to store the AES key (i only need it to decrypt on my prv side) i figure i dont need to store it and i can generate it with my public key. I thought doing rsa.Encrypt(byte[] with 4 hardcoded bytes); would generate the d...

Encryption Product Keys : Public and Private key encryption

I need to generate and validate product keys and have been thinking about using a public/private key system. I generate our product keys based on a client name (which could be a variable length string) a 6 digit serial number. It would be good if the product key would be of a manageable length (16 characters or so) I need to enc...

Is it possible to use pure Encrypting and Decrypting keys in asymmetric cryptography instead of private and public keys?

Is it possible to use pure Encrypting and Decrypting keys instead of private and public keys? As I know in .Net asymmetric RSA implementation private key RSAParameters parameters = (new RSACryptoServiceProvider()).ExportParameters(true) is a superset of public key. And using private key we can both encrypt and decrypt our data. But I nee...

Cryptography - RSA Algorithm in Java 1.4

Hi folks! I am using Java 1.4.2_10 and I am trying to use RSA encryption: I am getting the NoSuchAlgorithmException for the following code: cipher = Cipher.getInstance("RSA"); This is the error: java.security.NoSuchAlgorithmException: Cannot find any provider supporting RSA at javax.crypto.Cipher.getInstance(DashoA6275) T...

RSA decryption using only D, Exponent and Modulus

I'm trying to decrypt using RSACryptoServiceProvider, but I only have the modulus and d pair as a private key and also the exponent. RsaParameters struct wont make do with these. It rejects me upon decryption with an exception "Bad key". To my understanding, this pair is enough to decrypt without the entire DQ DP INVERSEQ parts. More o...

How to encrypt fields in XML document with PHP and RSA / Triple DES

I am developing an application for schools in South Africa which is required to submit data in XML format to the State IT Agency for statistical processing. I am currently generating the XML files using PHP's DOMDocument class. My files have gone through a first stage verification process. The next stage is to implement encryption and c...

Bouncy Castle RSA keypair generation using Lightweight API

Surprisingly enough there's very little information on the Web about using Bouncy Castle's lightweight API. After looking around for a while I was able to put together a basic example: RSAKeyPairGenerator generator = new RSAKeyPairGenerator(); generator.init(new RSAKeyGenerationParameters ( new BigInteger("10001", 16),//publ...

How do I convert an XML RSA key to a PEM file?

I have two XML files, structured as follows: My Key <RSAKeyValue> <Modulus> ... </Modulus> <Exponent> ... </Exponent> <P> ... </P> <Q> ... </Q> <DP> ... </DP> <DQ> ... </DQ> <InverseQ> ... </InverseQ> <D> ... </D> </RSAKeyValue> A Public Key <RSAKeyValue> <Modulus> ... </Modulus> <Exponent> ... </Exponent> </RS...

How to properly use Bouncy Castle's OAEPEncoding for RSA (Lightweight API)

I've been playing around with Bouncy Castle's implementation of RSA (Lightweight API) and got the basics figured out. Looking at their spec for JCE provider implementation I noticed that different padding schemes can be used with RSA. From what I understand, by default null padding is used. So I began exploring OAEP padding, particularly...

How do I encrypt with an RSA private key read from a PEM file using the Go programming language?

How do I do the equivalent of the following C++ code in go? RSA *key = PEM_read_RSAPrivateKey(f, NULL, NULL, NULL); std::vector<CK_BYTE> out(128); RSA_private_encrypt(in.size(), &in[0], &out[0], key, RSA_PKCS1_PADDING) I've looked at the Go rsa package. It looks like EncryptPKCS1v15() may be the equivalent of RSA_private_encrypt(). ...

C# Public Key verify Perl Private key and use as AES key ? Possible and/or viable ?

Hi, i was thinking if it is possible and/or viable for obfuscation and security to do as the follow: Client start session with Server (which means a valid login and password was sent and accepted) Server encrypt a random password with it is Private Key that will then be used into a data encryption using Rijndael's method and send both...

RSA: Get exponent and modulus given a public key

I need to encrypt some data using RSA in JavaScript. All of the libraries around ask for an exponent and a modulus, yet I get a single public.key file from my opponent. How do you retrieve the public exponent and modulus part from an RSA file? ...

Finding my Valid RSA Host Key

I recently migrated one of my domains to a new hosting service, so I switched the DNS name servers, moved the content to the new hosting service, etc. Now I am trying to log into the site (now on the new host) and there seems to be a problem on my own machine regarding this issue. Question: Where and How do I find the new correct RSA k...

Loading a private key from a file in Java.

I've created an RSA key pair using OpenSSL. The private key file is DER encoded. I need to load this file into my Java app and sign some data. Here's what I have: byte[] private_key = new byte[] ... ... load bytes from file into private_key .. PKCS8EncodedKeySpec pkcs8_key_spec = new PKCS8EncodedKeySpec( private_key ); KeyFactory k...

How I can encrypt a string in c #?

MD5 md5 = MD5.Create(); byte[] Ostring = System.Text.Encoding.UTF8.GetBytes("original string"); byte[] hashMD5 = md5.ComputeHAsh(Ostring); StringBuilder sb = new StringBuilder(); for (int i=0; i<hashMD5.Length; i++) { sb.Append(hashMD5[i].ToString("X2")); } string strMD5 = sb.ToString(); the value of strMD5 I want encrypt it, using ...

CryptographicException intermittently occurs when encrypting/decrypting with RSA

I'm trying to encrypt and decrypt data using RSA in C#. I have the following MSTest unit test: const string rawPassword = "mypass"; // Encrypt string publicKey, privateKey; string encryptedPassword = RSAUtils.Encrypt(rawPassword, out publicKey, out privateKey); Assert.AreNotEqual(rawPassword, encryptedPassword, "Raw password and e...

Does sha-1 ever produce collisions for input messages less than 160bits?

I have a 128bit ID that I want to perform a one way hash on, but I don't want to ever get the same digest for an input message. Does anyone know if sha-1, or an alternative, is guaranteed not to produce collisions for the set of messages less than its output digest size? This is at least theoretically possible... I also considered using...

convert RSA public key to RSA DER

Hello., I have id_rsa.pub key generated by ssh-keygen. I need to prigrammically convert id_rsa.pub to RSA DER formatted key. How it is possible? Preferably ruby language but I would be glad for algorythm in any language. ...