www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Question on Password Encryption, using stdlib or third party lib

reply 0xFFFFFFFF <0xFFFFFFFF mail.com> writes:
On a project I was asked to

a- Compute SHA-256 of a password
b- Do a BigInteger, convert to Hex String
c- Encrypt the key using a public key with the following 
parameters
   Entropy: I'm given some numbers
   Modulus: also given long numbers

[encrypt using RSA algorithm]

So far I'm familiar with a and b in Dlang.

how do I go about c) In Dlang ?

Thanks
Jul 29 2019
next sibling parent Cym13 <cpicard purrfect.fr> writes:
On Monday, 29 July 2019 at 14:37:54 UTC, 0xFFFFFFFF wrote:
 On a project I was asked to

 a- Compute SHA-256 of a password
 b- Do a BigInteger, convert to Hex String
 c- Encrypt the key using a public key with the following 
 parameters
   Entropy: I'm given some numbers
   Modulus: also given long numbers

 [encrypt using RSA algorithm]

 So far I'm familiar with a and b in Dlang.

 how do I go about c) In Dlang ?

 Thanks
I hope it's for a school project since I wouldn't recommend doing that in production. However you can do c) either by implementing RSA (it's rather easy to badly implement RSA which could be enough at school level) or by using a library (I recommend the library). There are several cryptographic libraries on https://code.dlang.org that implement RSA, botan and crypto for example. I'd trust botan more at the moment though I don't think any D library has received a proper cryptographic audit at the moment.
Jul 29 2019
prev sibling parent 0xFFFFFFFF <0xFFFFFFFF mail.com> writes:
On Monday, 29 July 2019 at 14:37:54 UTC, 0xFFFFFFFF wrote:
 On a project I was asked to

 a- Compute SHA-256 of a password
 b- Do a BigInteger, convert to Hex String
 c- Encrypt the key using a public key with the following 
 parameters
   Entropy: I'm given some numbers
   Modulus: also given long numbers

 [encrypt using RSA algorithm]

 So far I'm familiar with a and b in Dlang.

 how do I go about c) In Dlang ?

 Thanks
It is exponent not entropy
Jul 29 2019