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

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 … Read more

How many prime numbers are there (available for RSA encryption)?

RSA doesn’t pick from a list of known primes: it generates a new very large number, then applies an algorithm to find a nearby number that is almost certainly prime. See this useful description of large prime generation): The standard way to generate big prime numbers is to take a preselected random number of the … Read more

Digital signature for a file using openssl

To Generate Private Key openssl genrsa -out privatekey.pem 2048 To Sign openssl dgst -sha256 -sign privatekey.pem -out data.txt.signature data.txt To Generate The Public Key dgst -verify requires the public key openssl rsa -in privatekey.pem -outform PEM -pubout -out publickey.pem To Verify openssl dgst -sha256 -verify publickey.pem -signature data.txt.signature data.txt In case of success: prints “Verified … Read more

verifying a file signature with openssl dgst

openssl dgst -verify foo.pem expects that foo.pem contains the “raw” public key in PEM format. The raw format is an encoding of a SubjectPublicKeyInfo structure, which can be found within a certificate; but openssl dgst cannot process a complete certificate in one go. You must first extract the public key from the certificate: openssl x509 … Read more

PKCS#1 and PKCS#8 format for RSA private key [closed]

(Expanding more than I feel is appropriate for an edit.) PKCS1, available in several versions as rfcs 2313 2437 3447 and 8017, is primarily about using the RSA algorithm for cryptography including encrypting decrypting signing and verifying. But since crypto is often used between systems or at least programs it is convenient to have a … Read more