public-key-encryption

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

RSA Encryption: Difference between Java and Android

大兔子大兔子 提交于 2019-11-27 17:52:29
I am using RSA to encrypt username and password on Android and decrypt them on server (tomcat 6, java 1.6). Android Encryption: PublicKey pubKey = readPublicKeyFromFile(mod, ex); Cipher cipher = Cipher.getInstance("RSA"); cipher.init(Cipher.ENCRYPT_MODE, pubKey); byte[] cipherData = cipher.doFinal(data); return cipherData; Java Tomcat Decryption: PrivateKey pubKey = readPrivateKeyFromFile(mod, ex); Cipher cipher = Cipher.getInstance("RSA"); cipher.init(Cipher.DECRYPT_MODE, pubKey); byte[] cipherData = cipher.doFinal(data); return cipherData; If I use the android part OUTSIDE android (Just in a

Converting NSData to SecKeyRef

ⅰ亾dé卋堺 提交于 2019-11-27 15:25:43
问题 i have a public key which i gathered from a remote server and i want to perform RSA encryption with that public key. But the problem is i get the public key data as byte array in buffer. I can convert it to NSData but i can not convert to SecKeyRef so i can keep going with encryption. My encryption code is like: +(NSString *)encryptRSA:(NSString *)plainTextString withKey:(SecKeyRef)publicKey { size_t cipherBufferSize = SecKeyGetBlockSize(publicKey); uint8_t *cipherBuffer = malloc

How to do PGP in Python (generate keys, encrypt/decrypt)

柔情痞子 提交于 2019-11-27 11:21:45
I'm making a program in Python to be distributed to windows users via an installer. The program needs to be able to download a file every day encrypted with the user's public key and then decrypt it. So I need to find a Python library that will let me generate public and private PGP keys, and also decrypt files encrypted with the public key. Is this something pyCrypto will do (documentation is nebulous)? Are there other pure Python libraries? How about a standalone command line tool in any language? All I saw so far was GNUPG but installing that on Windows does stuff to the registry and throws

How to generate ssh compatible id_rsa(.pub) from Java

落花浮王杯 提交于 2019-11-27 11:15:54
I'm looking for a way to programmatically create ssh compatible id_rsa and id_rsa.pub files in Java. I got as far as creating the KeyPair: KeyPairGenerator generator; generator = KeyPairGenerator.getInstance("RSA"); // or: generator = KeyPairGenerator.getInstance("DSA"); generator.initialize(2048); keyPair = generator.genKeyPair(); I can't figure out however how to create the String representation of the PrivateKey and PublicKey in the KeyPair. Jcs The key format used by ssh is defined in the RFC #4253 . The format for RSA public key is the following : string "ssh-rsa" mpint e /* key public

How to use public and private key encryption technique in C#

流过昼夜 提交于 2019-11-27 10:51:20
问题 I want to encrypt data using public/private key technique. I mean, encrypt with the public key of receiver and the receiver can decrypt with their own private key. How can I do that? Do you have any suggestion or sample code ? 回答1: Code example: private static string _privateKey; private static string _publicKey; private static UnicodeEncoding _encoder = new UnicodeEncoding(); private static void RSA() { var rsa = new RSACryptoServiceProvider(); _privateKey = rsa.ToXmlString(true); _publicKey

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 Decryption in Android

不羁岁月 提交于 2019-11-27 09:10:32
问题 I am implementing a demo for RSA Encryption and Decryption in Android. I can Perform Encryption very well, but In Decryption I get an Exception: >>java.security.InvalidKeyException: unknown key type passed to RSA . KeyPairGenerator kpg; KeyPair kp; PublicKey publicKey; PrivateKey privateKey; byte [] encryptedBytes,decryptedBytes; Cipher cipher,cipher1; String encrypted,decrypted; public String RSAEncrypt (final String plain) throws NoSuchAlgorithmException, NoSuchPaddingException,

Whose key is used to encrypt a HTTPS response?

て烟熏妆下的殇ゞ 提交于 2019-11-27 03:32:28
问题 I have a web server built up relying on HTTPS. So, my server maintains its private key and publish a public key that any clients can use to encrypt their request. Since my server is the only one who has the private key to decrypt any message encryped using server's public key, any request sent this way can be considered secure. However my question is at the response part. When the server sends the response back to the client, whose public key will the server use to encrypt the response