gcc modexp.cpp -o modexp.exe gcc sha256.c -o sha256.exe # generate a rsa key ( needs to be more than 256 bits ) openssl genrsa -out tst.pvk 260 # extract the pubkey, exponent, and priv key. pq=`openssl asn1parse -in tst.pvk | awk "NR==3"|cut -d: -f4` e=`openssl asn1parse -in tst.pvk | awk "NR==4"|cut -d: -f4` d=`openssl asn1parse -in tst.pvk | awk "NR==5"|cut -d: -f4` # generate a message: msg=`./sha256.exe modexp.cpp` echo ..... hash echo $msg # calculate rsa_crypt(sha256(), privkey) encrypted=`echo "16 o 16 i $msg $d $pq |p"|dc|tr -d "\134\n"` echo .... privkey encrypted hash echo $encrypted # verify that we can decrypt this: echo .... pubkey decrypted hash ./modexp.exe $encrypted $e $pq | sed s/^0*//