Outils pour utilisateurs

Outils du site


informatique:crypto:rsa

RSA

/glossaire/rsa

Présentations de l'algo RSA:

  • key generation
    • p, q are two large random primes
    • n = pq is of the required bit length
    • phi = (p-1)(q-1)
    • public exponent e: 1 < e < phi, gcd(e, phi) = 1
    • secret exponent d: 1 < d < phi, ed ≡ 1 (mod phi)
    • destroy p, q and phi
  • public key: n , e
  • private key: n, d
  • Encryption: c = me mod n
  • Decryption: m = cd mod n
  • Signing: s = md mod n
  • Signing verification: v = se mod n
  • Then use advanced schemes:
    • RSAES-OAEP: (PKCS#1 version 2 and in IEEE P136) The encoding technique involves a Mask Generation Function (MGF) based on a hash function
    • RSASSA-PSS: The PSS encoding method is used to encode before creating a signature. However, there are active patents associated with this method

Divers

RSA en Javascript

Implémentations RSA (et du BigInt) en Javascript:

Bench Signature RSA clé 2048 bits:

  • AMD ATHLON 64 X2 core processor 4200
    • FF: 1.872
    • IE: 12.406
  • Intel Core i7 M640 2.80GHz
    • FF: 2.846
    • Chromium: 0.210
  • Intel Core2 à 2.40GHz
    • Firefox: 3.762
    • Epiphany: 1.498

Bench Signature RSA clé 1024 bits:

  • AMD ATHLON 64 X2 core processor 4200
    • FF:
    • IE:
  • Intel Core i7 M640 2.80GHz
    • FF: 0.247
    • Chromium: 0.038
  • Intel Core2 à 2.40GHz

.Net RSA Parameters

RSAParameters Structure (msdn)

RSAParameters field Contains Corresponding PKCS #1 field
D d, the private exponent privateExponent
DP d mod (p - 1) exponent1
DQ d mod (q - 1) exponent2
Exponent e, the public exponent publicExponent
InverseQ (InverseQ)(q) = 1 mod p coefficient
Modulus n modulus
P p prime1
Q q prime2
int dwKeySize = 384 ;
bool exportPrivateKey = true ;
RSACryptoServiceProvider rsa = new RSACryptoServiceProvider( dwKeySize );
using( StreamWriter sw = new StreamWriter( "RSAParameters.xml" ) )
{
 sw.Write( rsa.ToXmlString( exportPrivateKey ) );
 sw.Close();
}

Format .Net System.Security.Cryptography.RSACryptoServiceProvider.ToXmlString() :

Private:

 <RSAKeyValue>
  <Modulus>3XGodAOyDWfoGGMelpKft1Wx1E15m5yot4Rj0ppWpa/wTaHcudYfl+VIq+0EaC4N</Modulus> 
  <Exponent>AQAB</Exponent> 
  <P>+dhBWqM/4f1FBB3dP2fqKfhRnsfGqgTz</P> 
  <Q>4uZIM7QCetizjB9PGLoLcLIM2f1vDcD/</Q> 
  <DP>U2mXqCMImPJtsEooK5sN2qVE2rXn5atx</DP> 
  <DQ>xblS9etJte+dFuA5txx4163w0Q2udtfV</DQ> 
  <InverseQ>3q9gba8r1cFdsp/0uAYO3aVn7gnwqCPG</InverseQ> 
  <D>W9XmAW8C6XJdG7gHmHRoTlT4sc4Lj9BwliwVb9fN0sSqbF4UlABupXlIZTyuCBS1</D> 
 </RSAKeyValue>

Public only:

 <RSAKeyValue>
   <Modulus>t6yVboVvHOyCpOH7/hdA2cRlmkDoMZJc3cC72PpakR2/7dbq9Lqc1a+MY09sOMDH</Modulus>
   <Exponent>AQAB</Exponent>
 </RSAKeyValue>
informatique/crypto/rsa.txt · Dernière modification : 06/08/2023 09:58 de cyrille

Sauf mention contraire, le contenu de ce wiki est placé sous les termes de la licence suivante : CC0 1.0 Universal
CC0 1.0 Universal Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki