public-key-encryption

RSA on Android is different from PC

南笙酒味 提交于 2019-12-07 08:26:31
I search a lot but I didn't find the useful answer. I develop java and android security application. I found some problem that when I create RSA key on PC and I transfer RSA public key to android. When I encrypt my data with public key on android and I decrypt the data by using private key on PC, it shows Badpadding Exception. I search on the google on this exception. I found some user that has the same problem to me but the answer is no use. They told me to use Base64 to encode it but the key is still wrong. here is my code. public void generateKeys(){ try { KeyPairGenerator generator;

iOS SecItemCopyMatching RSA public key format?

纵饮孤独 提交于 2019-12-07 07:22:30
问题 I'm trying to extract a 1024-bit RSA public key from an already generated key pair (two SecKeyRef s), in order to send it over the wire. All I need is a plain (modulus, exponent) pair, which should take up exactly 131 bytes (128 for the modulus and 3 for the exponent). However, when I fetch the key info as a NSData object, I get 140 bits instead of 131. Here's an example result: <30818902 818100d7 514f320d eacf48e1 eb64d8f9 4d212f77 10dd3b48 ba38c5a6 ed6ba693 35bb97f5 a53163eb b403727b

How to do Diffie Hellman Key Generation and retrieve raw key bytes in Java

时间秒杀一切 提交于 2019-12-07 06:36:49
问题 I am writing a test harness in java for an existing program. As part of this i need to generate a Diffie Hellman key pair and pass the public key to the other program in its raw (i.e unencoded bytes) form. I can successfully the key pair using the following code: KeyPairGenerator kpg = KeyPairGenerator.getInstance("DiffieHellman"); kpg.initialize(512); KeyPair dkp = kpg.generateKeyPair(); However, i cannot seem to retrieve the raw byte value of the keys :-( Calling dkp.getPublic().getEncoded(

open source code for RSA implementation in C/C++ (Use library or write my own) [closed]

强颜欢笑 提交于 2019-12-06 15:55:40
Closed. This question is off-topic . It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 3 years ago . I need open source code for RSA implementation (encrypt/decrypt and others). Can anyone suggest some. Edit: Is it good to use a open source library like opessl or write it your own (Library include other redundant stuff too) OpenSSL library is the obvious choice. CryptLib is another option, yet you need to check the license (it's quite specific). Regarding writing your own code: if you need only RSA, it's not

How to limit people access to my EC2 with their public key

拟墨画扇 提交于 2019-12-06 15:39:14
Working on EC2 is a snap, you just download the .pem file, give it the right permissions, and you are ready to go, yet ... if you have the .pem file you have full access to the EC2 instance!! What shall I do to limit people's access to the instance in a controllable way, e.g. people pass me their public key and add it to the instance a la Github Follow the steps in this document: http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/managing-users.html There are 3 steps: You have to add a user account (adduser) for each user Make sure the user-home/.ssh dir has 600 permission (chmod) Add the user

encrypt or sign string with public key in iOS with Objective C

谁说胖子不能爱 提交于 2019-12-06 12:20:17
问题 i have a private key. Text File that begins like "--- begin private key..." i want to use that key to encrypt an NSString. since its the private key, better call it sign an NSString. can this be done without any external frameworks? the result should be equivalent to the php openssl_sign function. 回答1: The iOS SDK framework you will need to use is called CommonCrypto . Here's a very good article that describes the right way to go about it. Edit: I missed the part about compatibility with the

BouncyCastle J2ME RSA using custom keys

社会主义新天地 提交于 2019-12-06 12:04:08
I would like to use BouncyCastle J2ME/RIM Crypto in my Blackberry Application. The issue i'm having is that I would like to generate the public key for encryption from a C#.NET program that sends the key to the BlackBerry. Is it possible to encrypt a message using a raw string? Also, do I need to know other common variable such as modulo etc? Apologies but i'm completely new to cryptography algorithms. Do I need BouncyCastle for this or can the above be done with RIM Crypto? Thanks, Conor I did it using bouncycastle, but with RIM Crypto is similar. Follow the example. As you can see the keys

RSA Implementation in C#

北慕城南 提交于 2019-12-06 10:53:22
问题 I am trying to implement the RSA Algorithm in C#. The code below works when p and q are small, but not when trying to replicate RSA-100 or greater where p and q are very large. For example when: p = 61, q = 53, n = 3233, phi(n) = 3120, e = 17, d = 2753 Once decrypted, I get the correct original messsage. I got these values from the RSA Wikipedia page. The code also works for other small values of p and q. However, when using RSA-100 or greater, I do not get back my original message. I have

Getting BouncyCastle to decrypt a GPG-encrypted message

爱⌒轻易说出口 提交于 2019-12-06 08:27:20
问题 How can I get BouncyCastle to decrypt a GPG-encrypted message? I have created a GPG key pair at the CentOS 7 command line using gpg --gen-key . I chose RSA RSA as the encryption types, and I exported the keys using gpg --export-secret-key -a "User Name" > /home/username/username_private.key and gpg --armor --export 66677FC6 > /home/username/username_pubkey.asc I am able to import username_pubkey.asc into a remote Thunderbird client of another email account and successfully send an encrypted

Software licencing scheme [closed]

我的梦境 提交于 2019-12-06 07:53:52
Closed . This question is opinion-based . It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post . Closed 4 years ago . I've devised the following mechanism so as to license a software without direct connection to a server, it seems simple, yet I fail to find any serious flaw: I plan to use asymetric crypto so as to send a message from 1 server (the licence server) to n clients (the n computers on which the software is installed) The client sends (via mail, for example) some informations