Questions tagged [rsa]

RSA is a common public key algorithm, which can be used for encryption and signature. It is a core component of most the security protocols used on the Internet, including the SSL/TLS protocol suite. For questions about IBM Rational Software Architect, use the rational-rsa tag.

RSA is a public key cryptography algorithm. It is used in many Internet protocols that use cryptography, including /-based protocols (, etc.), , , and more. The name RSA comes from its inventors: Rivest, Shamir and Adleman.

RSA Security, Inc. is also the name of a security firm. Among other things, RSA publishes a series of standards related to public-key cryptography known as PKCS. The standard defines RSA.

RSA can be used for both encryption and signature. It is an asymmetric algorithm. A public key consists of two numbers: the modulus n, which is a large integer and determines the key size (1024 bits, 2048 bits and 4096 bits are common key sizes), and the public exponent e, which can be any odd integer between 3 and n but is often 3 or 65537. A private key consists of n and the private exponent d, which is generally almost as large as n. A private key may contain other fields to speed up computations.

The raw RSA operation is a mathematically simple operation: exponentiation modulo n. The exponent is the private exponent for encryption and signature, and the public exponent for decryption and verification. Only numbers up to n can be encrypted or signed. Therefore, instead of encrypting a whole message for RSA, one usually generates a session key (a symmetric key, for example an key) and encrypts this key with RSA. Instead of signing a message with RSA, one usually generates a cryptographic digest of the message (, , , …) and signs this digest.

The raw RSA operation is not secure. RSA requires a padding scheme. Common padding scheme include OAEP for encryption and PSS for signing, as well as other algorithms defined by .

For IBM Rational Software Architect, use .

6847 questions
62
votes
7 answers

SHA1 VS RSA: what's the difference between them?

What are the differences between SHA1 and RSA? Are they just different algorithms or are they fundamentally (i.e. used for different things) different on some level.
Ted Smith
  • 9,415
  • 16
  • 50
  • 52
61
votes
6 answers

How to store/retrieve RSA public/private key

I want to use RSA public key encryption. What is the best way to store or retrieve private and public keys? Is XML a good idea here? How to get the keys? RSAParameters privateKey = RSA.ExportParameters(true); RSAParameters publicKey =…
ala
  • 7,070
  • 13
  • 47
  • 54
60
votes
12 answers

Cracking short RSA keys

Given the following RSA keys, how does one go about determining what the values of p and q are? Public Key: (10142789312725007, 5) Private Key: (10142789312725007, 8114231289041741)
Donald T
  • 10,234
  • 17
  • 63
  • 91
60
votes
3 answers

Digital signature for a file using openssl

Is there a way to digitally sign a x509 certificate or any document using openssl?
Ajay kumar
  • 709
  • 1
  • 8
  • 6
57
votes
1 answer

Signing and verifying signatures with RSA C#

I recently posted about issues with encrypting large data with RSA, I am finally done with that and now I am moving on to implementing signing with a user's private key and verifying with the corresponding public key. However, whenever I compare the…
Simon Langhoff
  • 1,395
  • 3
  • 18
  • 28
57
votes
1 answer

How to create public and private key with openssl?

My questions are How to create a public key and private key with OpenSSL in windows? How to put the created public key in .crt file and the private one in .pcks8 file I want to use these two keys to sign a SAML assertion in Java. Thanks in…
Karim
  • 637
  • 1
  • 5
  • 13
57
votes
3 answers

How to recover a RSA public key from a byte[] array?

I'm wondering if it's possible to recover a RSA public key that I have converted to byte array previously. byte[] keyBytes = publicKey.getEncoded(); Thanks for the help.
kiewic
  • 15,852
  • 13
  • 78
  • 101
57
votes
6 answers

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

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…
nidzo732
  • 721
  • 1
  • 8
  • 10
52
votes
3 answers

ssh-keygen - how to set an rsa key with a certain username

I just installed ubuntu and would like to set its rsa keys up with bitbucket/github. When I ssh-keygen the keys are generated as they should be ssh-rsa AA...yBEz3pLL georgemauer@ubuntu which is perfectly usable except the username part. In every…
George Mauer
  • 117,483
  • 131
  • 382
  • 612
51
votes
1 answer

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

Can we have multiple public keys associated with a single private key for RSA public-key encryption?
Priyank Bolia
  • 14,077
  • 14
  • 61
  • 82
51
votes
2 answers

Blackberry smartcard reader example

I am writing an app for BlackBerry that utilizes a BlackBerry smartcard reader. There is not much documentation on the subject, so I'd really like if someone could give me starting examples. Basically, there is one RSA private key on the card plus a…
pajton
  • 15,828
  • 8
  • 54
  • 65
51
votes
2 answers

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

Am I mistaken in thinking that the security of RSA encryption, in general, is limited by the amount of known prime numbers? To crack (or create) a private key, one has to combine the right pair of prime numbers. Is it impossible to publish a list of…
pinhead
  • 1,017
  • 2
  • 12
  • 16
50
votes
4 answers

Private key length bytes

So im generating 2048 RSA keypair. But when i look at the private key the lenght is only 1232 bytes. Does this have anything to do with the 2048 or is the 2048 just the modulus size?
hs2d
  • 6,027
  • 24
  • 64
  • 103
50
votes
5 answers

RSA Encryption Decryption in Android

I am implementing a demo for RSA Encryption and Decryption in Android. I can Perform Encryption very well, but In Decryption I get an Exception: >>java.security.InvalidKeyException: unknown key type passed to RSA. KeyPairGenerator kpg; …
Riddhi Barbhaya
  • 1,205
  • 1
  • 11
  • 19
49
votes
5 answers

How do RSA tokens work?

I would like to understand how RSA tokens (SecurID) work, what is the algorithm used there, is it the same algorithm as the regular RSA encryption/decryption ?
Jau L
  • 904
  • 2
  • 8
  • 20