rsa

C# Export Private/Public RSA key from RSACryptoServiceProvider to PEM string

て烟熏妆下的殇ゞ 提交于 2020-01-26 08:46:23
问题 I have an instance of System.Security.Cryptography.RSACryptoServiceProvider, i need to export it's key to a PEM string - like this: -----BEGIN RSA PRIVATE KEY----- MIICXAIBAAKBgQDUNPB6Lvx+tlP5QhSikADl71AjZf9KN31qrDpXNDNHEI0OTVJ1 OaP2l56bSKNo8trFne1NK/B4JzCuNP8x6oGCAG+7bFgkbTMzV2PCoDCRjNH957Q4 Gxgx1VoS6PjD3OigZnx5b9Hebbp3OrTuqNZaK/oLPGr5swxHILFVeHKupQIDAQAB AoGAQk3MOZEGyZy0fjQ8eFKgRTfSBU1wR8Mwx6zKicbAotq0CBz2v7Pj3D+higlX LYp7+rUOmUc6WoB8QGJEvlb0YZVxUg1yDLMWYPE7ddsHsOkBIs7zIyS6cqhn0yZD VTRFjVST

'EVP_DecryptFinal_ex:bad decrypt' error on nodejs

我的未来我决定 提交于 2020-01-26 04:02:05
问题 I got this error from nodejs server when perform a http POST request login: digital envelope routines:EVP_DecryptFinal_ex:bad decrypt I created keys by: openssl genpkey -out privateKEY.pem -aes256 -algorithm rsa -pkeyopt rsa_keygen_bits:4096 and openssl pkey -in privateKEY.pem -out publicKEY.pem -pubout How can I solve this? This is the code: var mysql = require('mysql'); var express = require('express'); var cors = require('cors'); const jwt = require('jsonwebtoken'); var sanitizer = require

How to convert OpenSSL digital signature to ASN1?

拥有回忆 提交于 2020-01-25 21:52:33
问题 Using the openssl library I have created a digital signature of a file. I can see that if I use the openssl command: openssl rsautl -verify -inkey pubkey.pem -pubin -asn1parse -in sigfile I get a nice output of something like: 0:d=0 hl=2 l= 49 cons: SEQUENCE 2:d=1 hl=2 l= 13 cons: SEQUENCE 4:d=2 hl=2 l= 9 prim: OBJECT :sha256 15:d=2 hl=2 l= 0 prim: NULL 17:d=1 hl=2 l= 32 prim: OCTET STRING 0000 - c9 8c 24 b6 77 ef f4 48-60 af ea 6f 49 3b ba ec ..$.w..H`..oI;.. 0010 - 5b b1 c4 cb b2 09 c6 fc

git设置多账户

一世执手 提交于 2020-01-25 18:47:44
1.设置公司gitlab 0.先给git 设置一个全局的账户, 如果是公司的电脑环境, 全局的账户当然是用你在公司的邮箱了 git config --global user.name "yourname" git config --global user.email "mygitlab@mali.cn" 1. 使用公司邮箱生成 密钥对 (默认生成id_rsa) "mygitlab@mail.com" 对应你的公司邮箱 ssh-keygen -t rsa -C "mygitlab@mail.cn"   输入完这个回车会让你输入电脑密码, 再确认一次即可 至此你的公司gitlab 用的密钥对就生成了, 在 ~/.ssh 文件夹下( ~/.ssh 中的‘~’ 对应的是跟你目录,可能对应的就是/c/Users/Administrator/ )已经生成了两个文件, 一个是 id_rsa (没有后缀名) , 这个是密钥, 放在自己电脑里的 另一个是id_ras.pub ,这个是公钥, 里面的内容要复制到github或者gitlab上的, 取决于你想用在哪。 2.设置github密钥对 第二步生成github上用的密钥 使用如下命令 -f 后是你要放的位置,及新密钥对要用的名字, 这里使用id_rsa_github这个名字 $ ssh-keygen -t rsa -C

git tips

大城市里の小女人 提交于 2020-01-25 18:17:46
本文基于mac系统 换电脑之后无法链接git ssh-keygen -t rsa -C "你的邮箱" 会生成一个rsa文件(私钥)和一个rsa.pub(公钥) sublime rsa.pub #sublime 命令请移步https://blog.csdn.net/qq_36688622/article/details/104037305 将公钥添加到git的ssh中。 可能会出现添加玩public ssh key之后还是无法连接的情况 add-ssh "之前生成rsa(私钥)的路径" 重新git pull就可以了。 来源: CSDN 作者: 铁面无情哈士奇 链接: https://blog.csdn.net/qq_36688622/article/details/104037207

在 Linux 下搭建 Git 服务器

陌路散爱 提交于 2020-01-25 17:49:35
在 Linux 下搭建 Git 服务器 环境: 服务器 Ubuntu12.04.5LTS + git(version 1.7.1)客户端 Windows10 + git(version 2.8.4.windows.1) ① 安装 Git Linux 做为服务器端系统,Windows 作为客户端系统,分别安装 Git 服务器端: #sudo apt-get install git-core #ps -ef|grep "sshd"                      //查看是否配置了ssh#sudo apt-get install openssh-server openssh-client 安装完后,查看 Git 版本 [root@localhost ~]# git --version git version 1.7.1 客户端: 下载 Git for Windows ,地址: https://git-for-windows.github.io/ 安装完之后,可以使用 Git Bash 作为命令行客户端。 安装完之后,查看 Git 版本 $ git --version git version 2.8.4.windows.1 ② 服务器端创建 git 用户,用来管理 Git 服务,并为 git 用户设置密码 [root@localhost home]# id git id:

How to properly use setSeed() method in SecureRandom to generate RSA primes

不羁岁月 提交于 2020-01-25 15:12:29
问题 I want to produce the two prime numbers for RSA key generation. I think in order to increase both primes' randomness, the random may be generated as the following: SecureRandom r = SecureRandom.getInstance("SHA1PRNG"); r.setSeed(1232); p = BigInteger.probablePrime(1024, r); q = BigInteger.probablePrime(1024, r); My question is: Do you think using SecureRandom will increase the p and q randomness? If so, how can I randomly set the value of setSeed() instead of making it a fixed value ( here i

How to properly use setSeed() method in SecureRandom to generate RSA primes

感情迁移 提交于 2020-01-25 15:12:04
问题 I want to produce the two prime numbers for RSA key generation. I think in order to increase both primes' randomness, the random may be generated as the following: SecureRandom r = SecureRandom.getInstance("SHA1PRNG"); r.setSeed(1232); p = BigInteger.probablePrime(1024, r); q = BigInteger.probablePrime(1024, r); My question is: Do you think using SecureRandom will increase the p and q randomness? If so, how can I randomly set the value of setSeed() instead of making it a fixed value ( here i

rsa special

断了今生、忘了曾经 提交于 2020-01-25 12:29:10
[ReSnAd]-- iqmp ipmq e,c, \(\phi(n)\) 题目: class Key: PRIVATE_INFO = ['P', 'Q', 'D', 'DmP1', 'DmQ1'] def __init__(self, **kwargs): for k, v in kwargs.items(): setattr(self, k, v) assert self.bits % 8 == 0 def ispub(self): return all(not hasattr(self, key) for key in self.PRIVATE_INFO) def ispriv(self): return all(hasattr(self, key) for key in self.PRIVATE_INFO) def pub(self): p = deepcopy(self) for key in self.PRIVATE_INFO: if hasattr(p, key): delattr(p, key) return p def priv(self): raise NotImplementedError() def genkey(bits): assert bits % 2 == 0 while True: p = genprime(bits // 2) q =

OpenSSL RSA_sign() returns zero error code

独自空忆成欢 提交于 2020-01-24 20:47:11
问题 I am playing with OpenSSL 1.0.2o version. I compiled from OpenSSL only static libcrypto. I used this configuration flags: no-demos, no-bugs, no-apps, no-ssl, no-test, no-shared, no-zlib, no-zlib-dynamic, no-ssl-trace, no-unit-test, no-ec_nistp_64_gcc_128, no-libunbound, no-ssl1, no-ssl2, no-ssl3, no-asm, no-dtls, no-dtls1, no-threads, no-npn, no-weak-ssl-ciphers, no-rfc3779, no-sctp, no-ui, no-async, no-dgram, no-posix-io, no-sock, no-des, no-dso, no-srp, no-store, no-ts, no-txt_db, no-hw, no