encryption-asymmetric

Deterministic RSA encryption in Java

喜欢而已 提交于 2019-11-28 23:17:10
问题 This is my first question on this site, and I only have a basic mathematical understanding of RSA, so please bear with me! :) I'm writing a Java web application for my final year project at university. It's a web-based implementation of "Pret-a-voter", a secure voting system, for those who have heard of it. Essentially my problem is that I want to be able to give someone performing the role of an auditor: a source byte array (the plaintext to be encrypted) an RSA public key file a "

Hybrid cryptosystem implementation in .net. Error Specified key is not a valid size for this algorithm

旧时模样 提交于 2019-11-28 11:55:39
问题 I am trying to implement hybrid cryptosystem as mentioned in https://en.wikipedia.org/wiki/Hybrid_cryptosystem At the moment I have implemented following algorithm private void button1_Click(object sender, EventArgs e) { CspParameters cspParams = new CspParameters { ProviderType = 1 }; RSACryptoServiceProvider rsaProvider = new RSACryptoServiceProvider(1024, cspParams); string publicKey = Convert.ToBase64String(rsaProvider.ExportCspBlob(false)); string privateKey = Convert.ToBase64String

Public key encryption with RSACryptoServiceProvider

删除回忆录丶 提交于 2019-11-28 08:26:53
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. It's hard to find more info on how this is supposed to work. Does anyone see what is wrong with this?

Asymmetric Crypto on Android

懵懂的女人 提交于 2019-11-28 04:58:48
问题 I would like to ask if i can use Asymmetric Crypto (like RSA or ECC) on android mobile phones, how, and what are the best libraries i should use. 回答1: Because it is Java, you can use the Bouncy Castle Cryptographic Library :) http://www.bouncycastle.org/java.html You can use RSA or ElGamal for Asymmetric Cryptography :) http://www.bouncycastle.org/specifications.html 来源: https://stackoverflow.com/questions/3127267/asymmetric-crypto-on-android

Encrypting large files using a public key

故事扮演 提交于 2019-11-27 23:52:16
问题 I need to encrypt a 100KB file using a public key. I've been reading some posts claiming that it is not practical to directly encrypt large files using a public key, and that the preferred method is to encrypt the file using a symmetric key and then encrypt this symmetric key using the public key. It seems that a naive solution would be to break the large file to pieces and encrypt each one of them using the same public key. My question is whether and why this solution is wrong? 回答1: The

Are there any asymmetric encryption options for JavaScript?

与世无争的帅哥 提交于 2019-11-27 19:45:57
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 certain JavaScript > Server message) The reason why you need encryption at all is probably to protect

Ruby: file encryption/decryption with private/public keys

痞子三分冷 提交于 2019-11-27 19:24:24
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? Note Well: As emboss mentions in the comments, this answer is a poor fit for an actual system. Firstly, file encryption should not be carried out using this method (The lib

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

一世执手 提交于 2019-11-27 18:06:26
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 only private key (using .NET class RSACryptoServiceProvider). Not sure whether this limitation is

Encrypting data with Public Key in node.js

▼魔方 西西 提交于 2019-11-27 10:28:06
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. Jacob McKay No library necessary friends, Enter crypto Here's a janky little module you could use to encrypt/decrypt strings with RSA keys:

RSA Encryption, getting bad length

旧巷老猫 提交于 2019-11-27 03:30:05
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. blowdart 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 can encrypt 117 bytes at most, with a 2048 RSA key, you can encrypt 245 bytes. There's a good