rsa

Keystore operation failed with RSA sign and verify

≡放荡痞女 提交于 2020-01-14 03:09:58
问题 I have difficulties to use RSA for signing and verifying. Below is part of my RSA class that I use. The methods init() , privateKey() and publicKey() work fine with encrypt() and decrypt() methods (last two not listed here), so I assume I made some mistake inside of my sign() method. Method verify() wasn't tested yet, because signing was unsuccessful, so I wasn't able to move further. Please take a look... My RSA class is: class RSA { private final static String ANDROID_KEY_STORE =

How do I use RSACryptoServiceProvider to decrypt, given that I only have p, q, d and u?

南笙酒味 提交于 2020-01-14 03:07:36
问题 I am creating a simple client app to experiment with Mega and I am having trouble wrapping my head around the way RSA is used. Let's take, for example, the decryption of the session ID - this is one of the first things that must be done in order to log in. The API provides me the following RSA data: p (1024 bits) q (1024 bits) d (2044 bits) u (1024 bits) To start with, I do not know what "u" stands for. I see from code that it is calculated by modinverse(p, q) - is this what is commonly

企业付款到银行卡API,RSA加密总是报解密真实姓名或银行卡号出错?

霸气de小男生 提交于 2020-01-13 22:23:27
最近对接企业付款到银行卡的过程中,总是提示RSA加密总是报解密真实姓名或银行卡号出错 最后发现是为了通用在公钥加密私钥解密的代码中使用了非默认的OPENSSL_PKCS1_OAEP_PADDING填充模式,这在微信接口中可以正常使用,否则会出现如下错误:解密真实姓名或银行卡号出错 openssl_public_encrypt( i n p u t , input, i n p u t , output,$this->public_key_resource,OPENSSL_PKCS1_OAEP_PADDING); 来源: CSDN 作者: qq_37913859 链接: https://blog.csdn.net/qq_37913859/article/details/103955934

How do I use libtomcrypt to import an RSA public key?

隐身守侯 提交于 2020-01-13 19:17:13
问题 I am experimenting with using libtomcrypt to do RSA-2048 bit encryption. My current objective is to import a public key from a file. This file was generated using OpenSSL with the command: $ openssl rsa -in private.pem -outform PEM -pubout -out public.pem So I believe my public key is in PKCS#1 padding and in OpenSSL's PEM format. I believe the function I need to use is rsa_import(), but that takes an in buffer, a length, and outputs an rsa_key pointer. Just to be clear, I believe what I need

RSA Encrytion throws an exception intermittently on JavaCard

℡╲_俬逩灬. 提交于 2020-01-13 18:30:09
问题 I've written a program to encrypt 10 bytes random number using an RSA public key on my Java Card. The random number is generated each time that the card receives that APDU command, and as the related cipher object block size is 2048 bit in my applet, I append 242 bytes of 0x00 at the end of this 10 byte random number to make it 256 bytes length. The problem is that sometimes the response is a Crypto Exception with 05 value. As you know and as JC API documents mentioned: 0x05 = ILLEGAL_USE

Generate RSA private key from n, e, d, p, q values in bash with OpenSSL [duplicate]

两盒软妹~` 提交于 2020-01-13 11:24:09
问题 This question already has answers here : How to Generate rsa keys using specific input numbers in openssl? (2 answers) Closed 3 years ago . I have calculated n, e, d, p, q values of an RSA key. Now, how can I generate a private key file (pem or der) with openssl command line tools? I was thinking about openssl asn1parse -genconf asn1.cnf -noout -out asn1.der but I cannot understand how to build the conf file. 回答1: The OpenSSL manpage for asn_generate_nconf comes with an example cnf for

gitosis asking for password

岁酱吖の 提交于 2020-01-13 09:36:09
问题 I have setup a gitosis server following instructions from here. It works fine for the initial user but I have recently added a new user. Here are the steps I took. Created an rsa keypair using ssh-keygen with filename johndoe. Then copied it to the keydir in gitosis admin repo. Edited the gitosis config file and added user johndoe to the list of members Commited the changes using git commit -a -m "what i did" Pushed the changes to the server After that I tried to check out with the new

RSA加密、解密、签名、验签的原理及方法

一笑奈何 提交于 2020-01-13 08:24:54
https://www.cnblogs.com/pcheng/p/9629621.html 一、RSA加密简介   RSA加密是一种非对称加密。可以在不直接传递密钥的情况下,完成解密。这能够确保信息的安全性,避免了直接传递密钥所造成的被破解的风险。是由一对密钥来进行加解密的过程,分别称为公钥和私钥。两者之间有数学相关,该加密算法的原理就是对一极大整数做因数分解的困难性来保证安全性。通常个人保存私钥,公钥是公开的(可能同时多人持有)。    二、RSA加密、签名区别   加密和签名都是为了安全性考虑,但略有不同。常有人问加密和签名是用私钥还是公钥?其实都是对加密和签名的作用有所混淆。简单的说,加密是为了防止信息被泄露,而签名是为了防止信息被篡改。这里举2个例子说明。 第一个场景 :战场上,B要给A传递一条消息,内容为某一指令。 RSA的加密过程如下: (1)A生成一对密钥(公钥和私钥),私钥不公开,A自己保留。公钥为公开的,任何人可以获取。 (2)A传递自己的公钥给B,B用A的公钥对消息进行加密。 (3)A接收到B加密的消息,利用A自己的私钥对消息进行解密。   在这个过程中,只有2次传递过程,第一次是A传递公钥给B,第二次是B传递加密消息给A,即使都被敌方截获,也没有危险性,因为只有A的私钥才能对消息进行解密,防止了消息内容的泄露。 第二个场景: A收到B发的消息后,需要进行回复

RSA加密解密(PHP Demo)

杀马特。学长 韩版系。学妹 提交于 2020-01-13 04:17:12
$private_key = '-----BEGIN RSA PRIVATE KEY----- MIICXQIBAAKBgQDpoODVtnSztGyb//p+g/Ob36jb3jzWzS2qovOjpY/rrTjwlVcQ pB2m1nZDQNpTFsG8ZBl7uPw3M81lr7NRRn6tY7Om8tbOOsRgY6u0xwbgdRStFFvw PzZ1HehiQ6WB8za8cucCyvuqmBRp7HOjO4Aa9t0rIvZ/hoWMeSvjnAVbMwIDAQAB AoGBAOEHsaiIDs6NKdP08r1rsXjhLI9i92zawnLKdCybKw4RknfBENSZj2oExnKv A9vmXoNsU1NlcaJmRh/85ZaSdS4L+Zx8iz18uwXAjCPpfMd7nG4FD55713Lszhua DQIxK06w2mI0ytwEf4cqQmct2/BWchBXZIlz9O0Q70CF2brpAkEA/3NtHrQNxbF0 KRvrrTw4c9Y76PyeESEmKuF8ZKQu6v1qSb/V3aZsiGPTH+vUf0oAmoJoGx1AtRuk DAe9uQ5efQJBAOohcXTh7vgm5ujlyJEi85jGp2BnHxmNAHN6n1q44Hs1wbvICujH SEaHhVt6hSf7

openssl/RSA - Using a Public key to decrypt

旧巷老猫 提交于 2020-01-12 18:53:34
问题 I'm looking to secure the software update procedure for a little device I'm maintaining that runs Linux. I want to generate an md5sum of the update package's contents and then encrypt that hash with a private key before sending it out to the customer. When they load the update, the device should then decrypt the hash, verify it, and proceed with installation of the package. I'm trying to do this with OpenSSL and RSA. I found this thread, and was discouraged. I then found this thread and