public-key-encryption

Can we have multiple public keys with a single private key for RSA?

回眸只為那壹抹淺笑 提交于 2019-12-20 16:19:15
问题 Can we have multiple public keys associated with a single private key for RSA public-key encryption? 回答1: In practice and with respect to security, no, mathematically, yes. If you have a private key (N, D), there is algebraically an infinite number of solutions to the equation 1 = E*D (mod Phi(N)). However, if you make two such solutions (E, N) and (E', N) that both satisfy the equation public, you will have compromised the secrecy of the private key. However given one of the usual asymmetric

Swift 3 export SecKey to String

家住魔仙堡 提交于 2019-12-20 14:38:06
问题 I am developing an iOS app using swift 3. I need to export an SecKey (which is the user RSA publickey reference) to a string (e.g base64) in order to share it through a generated QRCode. It also has to work the other way since the other user that scans the QRCode , will be able to rebuild a SecKey reference from the string extracted from the QRCode. I found few tutorials but I don't understand exactly what I need to extract from the SecKey reference, and I don't know how to convert it to a

how to convert raw modulus & exponent to RSA public key (.pem format)

独自空忆成欢 提交于 2019-12-20 09:51:04
问题 I have the modulus & exponent of an RSA public key embedded into a binary file, and I am trying to extract the entire blob and create a usable .pem public key. Currently, I am extracting the full 260 bytes (4 bytes for the exponent, 256 bytes for the modulus) and encoding as base64. I am doing that using the following shell command : tail -c $((filesize - start_of_key_data)) filename | head -c $size_of_key_data | base64 > outkey This gives me the following string : <<<<<< modulus & exponent

Not able to encrypt using public key in golang

*爱你&永不变心* 提交于 2019-12-20 07:56:13
问题 I am using golang crypto library. func encrypt(publicKey *rsa.PublicKey, message string) []byte { msg := []byte(message) println(message, msg) cipherText, err := rsa.EncryptPKCS1v15(rand.Reader, publicKey, msg) if err != nil { println("Error:", err.Error()) } return cipherText } I am getting following errors panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x40e86d6] . How to handle it? How to encrypt using

How to Export Private Key For ECDiffieHellmanCng

梦想的初衷 提交于 2019-12-19 09:07:16
问题 I am trying to export the keys from a new instance of a ECDiffieHellmanCng object so I can create an instance of it later with the same keys. But I am getting an error when trying to export it. //Create new ECDiffieHellmanCng which automatically creates new keys var ecdh = new ECDiffieHellmanCng(); //Export the keys var privateKey = ecdh.Key.Export(CngKeyBlobFormat.EccPrivateBlob); I am getting a CryptographicException when I call the Export method with the message " The requested operation

Java ssh-rsa string to public key

狂风中的少年 提交于 2019-12-18 16:48:33
问题 I want to get the public key of the content of an .pub file. This is an example what the content of a .pub file looks like(generated with ssh-keygen ): ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDBPL2s+25Ank3zS6iHUoVk0tS63dZM0LzAaniiDon0tdWwq4vcL4+fV8BsAEcpMeijS92JhDDc9FccXlHbdDcmd6c4ITOt9h9xxhIefGsi1FTVJ/EjVtbqF5m0bu7ruIMGvuP1p5s004roHx9y0UdHvD/yNWLISMhy4nio6jLailIj3FS53Emj1WRNsOrpja3LzPXzhuuj6YnD9yfByT7iGZipxkmleaXrknChPClLI9uhcqtAzBLdd0NVTJLOt/3+d1cSNwdBw9e53wJvpEmH+P8UOZd+oV

Calculate d from n, e, p, q in RSA?

三世轮回 提交于 2019-12-18 15:28:12
问题 Not sure if this is the correct place to ask a cryptography question, but here goes. I am trying to work out "d" in RSA, I have worked out p, q, e, n and ø(n); p = 79, q = 113, e = 2621 n = pq ø(n) = (p-1)(q-1) n = 79 x 113 = 8927 ø(n) = 78 x 112 = 8736 e = 2621 d = ??? I cant seem to find d, I know that d is meant to be a value that.. ed mod ø(n) = 1. Any help will be appreciated As an example would be e = 17, d = 2753, ø(n) = 3120 17 * 2753 mod 3120 = 1 回答1: You are looking for the modular

gpg decryption fails with no secret key error

試著忘記壹切 提交于 2019-12-18 11:02:15
问题 I have a gpg .key file that is used as passphrase for decrypting a .dat.pgp file. The encrypted .data.pgp file gets successfully decrypted on one server with same .key file using following command cat xxx_gpg.key | /usr/bin/gpg --batch --quiet -o xxx.dat --passphrase-fd O -d xxx.dat.pgp But, when I move same key to another server xxx_gpg.key and run same above command, I get following error - gpg: decryption failed: No secret key EDIT: I find that gpg --list-secret-keys returns some data on

gpg decryption fails with no secret key error

妖精的绣舞 提交于 2019-12-18 11:01:16
问题 I have a gpg .key file that is used as passphrase for decrypting a .dat.pgp file. The encrypted .data.pgp file gets successfully decrypted on one server with same .key file using following command cat xxx_gpg.key | /usr/bin/gpg --batch --quiet -o xxx.dat --passphrase-fd O -d xxx.dat.pgp But, when I move same key to another server xxx_gpg.key and run same above command, I get following error - gpg: decryption failed: No secret key EDIT: I find that gpg --list-secret-keys returns some data on

I understand the mathematics of RSA encryption: How are the files in ~/.ssh related to the theory?

為{幸葍}努か 提交于 2019-12-18 06:21:55
问题 I went through the math in the "worked example" in the RSA wiki page: https://en.wikipedia.org/wiki/RSA_(algorithm) and understood it entirely. For the remainder of this question, I will use math variables consistent with the wiki page. I'm on a Unix machine and I'm looking in the ~/.ssh directory and I see all these files id_rsa id_rsa.pub and I want to connect the theory with the practice. What exactly is in id_rsa? If I cat it cat id_rsa I get a big jumble of characters. Is this some