key-generator

Getting 1 byte extra in the modulus RSA Key and sometimes for exponents also

我的梦境 提交于 2019-12-05 11:56:06
Here is my code snippet: int eValue = 79, t; int bitLength = 1024; // KeySize BigInteger e = new BigInteger(Integer.toString(eValue)); KeyPairGenerator kpg = KeyPairGenerator.getInstance("RSA"); kpg.initialize(bitLength); KeyPair kp = kpg.generateKeyPair(); KeyFactory kfactory = KeyFactory.getInstance("RSA"); RSAPublicKeySpec kspec = (RSAPublicKeySpec) kfactory.getKeySpec(kp.getPublic(), RSAPublicKeySpec.class); System.out.println("Byte Length is : " + kspec.getModulus().toByteArray().length); String testString; try { testString = new String (kspec.getModulus().toByteArray() , "ISO-8859-1");

How to generate PKCS#1 RSA keys in PEM Format?

亡梦爱人 提交于 2019-12-03 13:51:00
问题 Sorry for my english and honestly I have a very little understanding on this so please bear with me. I am developing a java application that sends a signed request to a Server. To do so, I have to generate a PKCS#1 RSA key pair in PEM format for signing and verification. I've tried using OpenSSL v.1.0.1 . but the public key generated is a X.509 PEM . Here's the openssl command I used to generate the keys: Private Key : openssl genrsa -out name_of_private_key.pem 1024 Public Key openssl rsa

How to generate PKCS#1 RSA keys in PEM Format?

丶灬走出姿态 提交于 2019-12-03 08:38:45
Sorry for my english and honestly I have a very little understanding on this so please bear with me. I am developing a java application that sends a signed request to a Server. To do so, I have to generate a PKCS#1 RSA key pair in PEM format for signing and verification. I've tried using OpenSSL v.1.0.1 . but the public key generated is a X.509 PEM . Here's the openssl command I used to generate the keys: Private Key : openssl genrsa -out name_of_private_key.pem 1024 Public Key openssl rsa -in name_of_private_key.pem -pub out > name_of_public_key.pem I've gone through this thread also and I

Generate RSA key pair in javascript, based on a password

六眼飞鱼酱① 提交于 2019-11-30 02:10:52
As far as I understand, RSA keys are usually generated based on a (strong) random generator. Instead, I want to create them based on a password. Or rather on its hash, for example sha512(sha512(password+salt)+password+pepper) This needs to be done client side, in JavaScript. Would anyone know how to do this? Is there an easy JavaScript library that creates RSA key pairs deterministically, based on a given input? (Actually, I'm mentioning RSA but any secure asymmetrical encryption would suffice, I just need public-private encryption) Addition: I need this because I'm building some secure