public-key-encryption

Generate a public key with a predefined modulus and exponent (strange values)

一曲冷凌霜 提交于 2021-01-29 04:58:19
问题 "n": "rKZ-1zdz_CoLekSynOtyWv6cPSSkV28Kb9kZZHyYL-yhkKnH_bHl8OpWiGxQiKP0ulLRIaq1IhSMetkZ8FfXH-iptIDu4lPb8gt0HQYkjcy3HoaKRXBw2F8fJQO4jQ-ufR4l-E0HRqwLywzdtAImNWmju3A4kx8s0iSGHGSHyE4EUdh5WKt-NMtfUPfB5v9_2bC-w6wH7zAEsI5nscMXnvz1u8w7g2_agyhKSK0D9OkJ02w3I4xLMlrtKEv2naoBGerWckKcQ1kBYUh6WASPdvTqX4pcAJi7Tg6jwQXIP1aEq0JU8C0zE3d33kaMoCN3SenIxpRczRzUHpbZ-gk5PQ", "e": "AQAB", How can I generate a public key from these values? Preferable via python or Linux programs. I'm sorry if the question is nonsense

import .net public xml key to javascript in RSA

拟墨画扇 提交于 2021-01-28 02:25:48
问题 I have public key in XML that created in C# the format is: <Modulus>rYDd94biRAJ1P6j68xjARl......and so on</Modulus> <Exponent>A**B</Exponent> I want to create this key in Javascript, and encrypt string with it, how can I do it? Thanks, 回答1: After so many hours researching, testing, giving up, researching again, etc., for a solution on RSA interoperability for .NET and Javascript, I have found this library: http://www.jocys.com/Common/JsClasses/Documents/ Their classes have the same working

RSA public key generated in Java is not valid in php

独自空忆成欢 提交于 2021-01-27 23:21:04
问题 I'm creating a RSA key pair in Java and want to use it in PHP. Java code is as follows: public static boolean keyGen() throws NoSuchAlgorithmException, IOException, OperatorCreationException, InvalidKeySpecException { KeyPairGenerator kpGen = KeyPairGenerator.getInstance("RSA"); kpGen.initialize(2048, new SecureRandom()); KeyPair keyPair = kpGen.generateKeyPair(); PublicKey pub = keyPair.getPublic(); byte[] pubBytes = pub.getEncoded(); SubjectPublicKeyInfo spkInfo = SubjectPublicKeyInfo

How to decrypt the message using private key -RSA algorithm in java

风格不统一 提交于 2020-12-15 06:53:41
问题 As I'm generating the encrypted string using .cer file but unable to do decryption. for decryption I have a file with .key extension and inside start with: -----BEGIN RSA PRIVATE KEY----- Algorithm: RSA/ECB/PKCS1Padding // encrypting session key using public key public static String encryptSessionKey_PublicKey(String data) throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, IllegalBlockSizeException, BadPaddingException, CertificateException, FileNotFoundException {

How to decrypt the message using private key -RSA algorithm in java

送分小仙女□ 提交于 2020-12-15 06:52:15
问题 As I'm generating the encrypted string using .cer file but unable to do decryption. for decryption I have a file with .key extension and inside start with: -----BEGIN RSA PRIVATE KEY----- Algorithm: RSA/ECB/PKCS1Padding // encrypting session key using public key public static String encryptSessionKey_PublicKey(String data) throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, IllegalBlockSizeException, BadPaddingException, CertificateException, FileNotFoundException {

RSA should I use X.509 or PKCS #1

夙愿已清 提交于 2020-12-06 15:47:45
问题 Use case: I have a use case wherein client generates private and public key , sends the base 64 encoded public key to the server. On server side I will encrypt a message using this public key and send the encrypted message to client , which the client decrypts using its private key.The algorithm agreed upon is 'RSA'. The problem is on server side I am seeing that certain keys are working using X509EncodedKeySpec as key spec byte[] publicBytes = Base64.decodeBase64(base64EncodedPubKey);

RSA should I use X.509 or PKCS #1

空扰寡人 提交于 2020-12-06 15:47:44
问题 Use case: I have a use case wherein client generates private and public key , sends the base 64 encoded public key to the server. On server side I will encrypt a message using this public key and send the encrypted message to client , which the client decrypts using its private key.The algorithm agreed upon is 'RSA'. The problem is on server side I am seeing that certain keys are working using X509EncodedKeySpec as key spec byte[] publicBytes = Base64.decodeBase64(base64EncodedPubKey);