encryption-asymmetric

Public key encryption with RSACryptoServiceProvider

和自甴很熟 提交于 2019-11-27 02:12:33
问题 I have been over an article at CodeProject a for a while that explains how to encrypt and decrypt using the RSA provider: RSA Private Key Encryption While the old version from 2009 was buggy, the new 2012 version (with System.Numerics.BigInteger support) seems more reliable. What this version lacks though is a way to encrypt with a public key and decrypt using the private key. So, I tried it myself but get garbage when I decrypt. I'm not familiar with the RSA provider, so I'm in the dark here

Encrypting data with Public Key in node.js

瘦欲@ 提交于 2019-11-26 22:20:00
问题 I need to encrypt a string using a public key (pem file), and then sign it using a private key (also a pem). I am loading the pem files fine: publicCert = fs.readFileSync(publicCertFile).toString(); but after hours of scouring google I can't seem to find a way to encrypt data using the public key. In php I simply call openssl_public_encrypt, but I don't see any corresponding function in node or in any modules. If anyone has any suggestions, let me know. 回答1: No library necessary friends,

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

拜拜、爱过 提交于 2019-11-26 21:28:39
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 instance of RSACryptoServiceProvider. using (RSACryptoServiceProvider RSA = new RSACryptoServiceProvider()) { //Import the RSA Key information. This only needs //toinclude the public key information. //RSA.ImportParameters(RSAKeyInfo); byte[] keyValue = Convert

Are there any asymmetric encryption options for JavaScript?

╄→尐↘猪︶ㄣ 提交于 2019-11-26 19:59:08
问题 I have to transfer some sensitive information over a JavaScript AJAX Call, over an unencrypted channel (HTTP, not HTTPS). I'd like to encrypt the data, but encryption on the JavaScript side means I expose the key, which makes symmetric encryption only an exercise in security by obscurity. Is there any asymmetric encryption for JavaScript? That way, I can keep the Server decryption key secret. (I'm not worried about the security of Server > JavaScript messages, only about the security of a

Ruby: file encryption/decryption with private/public keys

て烟熏妆下的殇ゞ 提交于 2019-11-26 19:52:01
问题 I am searching for an algorithm for file encryption/decryption which satisfies the following requirements: Algorithm must be reliable Algorithm should be fast for rather big files Private key can be generated by some parameter (for example, password) Generated private key must be compatible with public key (public key is generated only once and stored in database) Is there any Ruby implementation of suggested algorithms? 回答1: Note Well: As emboss mentions in the comments, this answer is a

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

半腔热情 提交于 2019-11-26 19:17:31
问题 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 private key. Is it correct or I am mistaking something? [EDIT] What made me more confusing was that it is not possible to serialize the RSA key to XML with

How to load the RSA public key from file in C#

安稳与你 提交于 2019-11-26 16:11:18
I need to load the following RSA public key from a file for use with the RSACryptoServiceProvider class. How can I do this? -----BEGIN PUBLIC KEY----- XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/syEKqEkMtQL0+d XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX+izR KbGMRtur2TYklnyVkjeeHfAggo8vWQmWesnOG55vQYHbOOFoJbk0EkwEr5R/PbKm byXPPN8zwnS5/XXXXXXXXXXXX -----END PUBLIC KEY----- This code works with my pub key: http://www.jensign.com/opensslkey/ Here is the code I am using static string RSA(string input) { RSACryptoServiceProvider rsa = DecodeX509PublicKey(Convert

Truststore and Keystore Definitions

六月ゝ 毕业季﹏ 提交于 2019-11-26 15:38:33
What's the difference between a keystore and a truststore? A keystore contains private keys, and the certificates with their corresponding public keys. A truststore contains certificates from other parties that you expect to communicate with, or from Certificate Authorities that you trust to identify other parties. A keystore contains private keys. You only need this if you are a server, or if the server requires client authentication. A truststore contains CA certificates to trust. If your server’s certificate is signed by a recognized CA, the default truststore that ships with the JRE will

RSA Encryption, getting bad length

早过忘川 提交于 2019-11-26 10:30:36
问题 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. 回答1: RSA encryption is only mean for small amounts of data, the amount of data you can encrypt is dependent on the size of the key you are using, for example for 1024 bit RSA keys, and PKCS # 1 V1.5 padding, you

encryption/decryption with multiple keys

痞子三分冷 提交于 2019-11-26 07:55:40
问题 Is it possible to encrypt data, such that it can be decrypted with several different keys? Example: I\'ve encrypted data with key1, but I want to be able to decrypt with keys 2, 3, and 4. Is this possible? 回答1: GnuPG does multi-key encryption in standard. The following command will encrypt doc.txt using the public key for Alice and the public key for Bob. Alice can decrypt using her private key. Bob can also decrypt using his private key. gpg --encrypt --recipient alice@example.com \ -