public-key-encryption

exchange public/private key in PKCS#1 OAEP encryption/decryption

拟墨画扇 提交于 2019-11-30 13:50:34
I only have some very rudimentary theoretical knowledge about RSA. While reading different sources about how to use it in practice, it seemed that PKCS#1 OAEP would be a good thing. For a test implementation, I use Python with PyCrypto. E.g. this is an example using PKCS#1 OAEP. Encrypting using the public key and then decrypting using the private key works fine. E.g. the public can send some data to person X with the private key. From my basic understanding of how RSA works, I thought that I can just interchange the public/private key, i.e. I can use the public key for encrypting and the

Cracking short RSA keys

岁酱吖の 提交于 2019-11-30 10:05:33
问题 Given the following RSA keys, how does one go about determining what the values of p and q are? Public Key: (10142789312725007, 5) Private Key: (10142789312725007, 8114231289041741) 回答1: Your teacher gave you: Public Key: (10142789312725007, 5) which means n = 10142789312725007 e = 5 where n is the modulus and e is the public exponent. In addition, you're given Private Key: (10142789312725007, 8114231289041741) meaning that d = 8114231289041741 where d is the decryption exponent that should

Equivalent to OpenSSL commands in java

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-30 09:44:24
问题 I'm not very familiar with encryption of files in java or openssl for that matter. I know the basics from school but have never actually implemented it. Now I've been given the following 3 commands: //generate random base64 private key openssl rand -base64 32 -out (keypath) //Encrypt random key with public key openssl rsautl -encrypt -inkey (encryptionkey) -pubin -in (input) -out (output) //encrypt file openssl enc -aes-256-cbc -salt -in (input) -out (output) -pass file:(keypath) I need to

RSA Encryption output size

早过忘川 提交于 2019-11-30 07:52:43
问题 What is RSA encryption output size when using 2048 bit key (using pkcs1padding). Is it always 256 bytes independent of input size? how can i calculate it for other key sizes? 回答1: Yes , it is. The output-size should always equals the size of the Modulus (part of the key), so: 2048 bit Modulus -> 2048 bit output 1024 bit Modulus -> 1024 bit output ... If it is not, there exist numerous attacks on RSA , see here for basic information about that. So to guarantee that the output is 2048 bit even

Encryption (mode and padding)

强颜欢笑 提交于 2019-11-30 07:49:41
I was tasked with writing a small Java console application that involves encryption. I am not familiar with encryption, so I had to do some reading up first. So far the high level requirements given is that AES-256 should be used to generate a one-time key to encrypt a file. After that, the recipient's public key (RSA-2048) should be used to encrypt that AES-256 one-time key. The encrypted file and the encrypted one-time AES-256 key will then be zipped up and send to recipient. From what I understand about encryption and decryption from reading up, apart from the algorithm (RSA, AES, etc),

How can I fill in RSAParameters value in c#

ぐ巨炮叔叔 提交于 2019-11-30 05:20:00
问题 I was using below code for encryption in my project and everything was working fine. RSACryptoServiceProvider x_alg = new RSACryptoServiceProvider( ); // export only the public key RSAParameters x_public_params = x_alg.ExportParameters(false); // export the private key RSAParameters x_private_params = x_alg.ExportParameters(true); Now client changed the requirement and he want to store all the RSAParameters value into config file and provided below details for demo <project name="netCard

How to protect media content (video, audio) on Android from being saved/redistributed?

前提是你 提交于 2019-11-30 04:57:59
What opportunities are there for regular app developers (with that I mean, you're not a million dollar content producing company or distribution channel provider, but a regular, small app development company) to secure video/audio content for the app from being saved/distributed. I mention the 'regular developer', because I had seen in the Android core code that Sony had added some code portions into it, in the DRM packages. Let's assume we're not that powerful to talk to Google to include such in their core code. Are there any real secure ways to protect video/audio (as part of an app) on

How to establish a secure connection by using Synapse?

坚强是说给别人听的谎言 提交于 2019-11-30 03:02:59
问题 I'm testing Synapse and want to know how can I establish a secure connection. I noticed it supports SSL, but I'm not sure whether it suits my needs. I don't have a certificate from CA. I just want to encrypt all data between my server program and client program. Sure, I can encrypt the data myself before sending out. But if SSL can encrypt the data, maybe I can just use it. From what I know, SSL is for "encryption" and "authentication". What I need is only "encryption". Is it possible with

gpg decryption fails with no secret key error

荒凉一梦 提交于 2019-11-30 02:55:51
I have a gpg .key file that is used as passphrase for decrypting a .dat.pgp file. The encrypted .data.pgp file gets successfully decrypted on one server with same .key file using following command cat xxx_gpg.key | /usr/bin/gpg --batch --quiet -o xxx.dat --passphrase-fd O -d xxx.dat.pgp But, when I move same key to another server xxx_gpg.key and run same above command, I get following error - gpg: decryption failed: No secret key EDIT: I find that gpg --list-secret-keys returns some data on server where it works but no results are returned for other server. How can we configure secret key

How to convert from String to PublicKey?

会有一股神秘感。 提交于 2019-11-30 00:34:08
I've used the following code to convert the public and private key to a string KeyPairGenerator keyPairGen = KeyPairGenerator.getInstance("RSA"); keyPairGen.initialize(2048); KeyPair keyPair = keyPairGen.genKeyPair(); PublicKey publicKey = keyPair.getPublic(); PrivateKey privateKey = keyPair.getPrivate(); String publicK = Base64.encodeBase64String(publicKey.getEncoded()); String privateK = Base64.encodeBase64String(privateKey.getEncoded()); Now I'm trying to convert it back to public ad private key PublicKey publicDecoded = Base64.decodeBase64(publicK); I'm getting error of cannot convert from