CTF Crypto tools

OpenSSL

  • Open-source implementation of SSL and TLS
    protocols

  • Useful toolkit of cryptographic
  • Many bugs and vulnerabilities

OpenSSL : Digest

SHA

SHA-1

openssl dgst -sha1 plaintext

SHA-2

openssl dgst –sha256 plaintext

openssl dgst –sha512 plaintext

OpenSSL : AES

AES Encrypt

openssl enc –aes128 -e -in plaintext -out c.aes

AES Decrypt

openssl enc –aes128 -d -in c.aes -out c.aes.dec

OpenSSL : RSA

RSA Private Key

  • Gen Private Key

openssl genrsa -out priv.pem

  • View Private Key

openssl rsa –text –in priv.pem –out priv.pem.info

p , q , N , d , e

RSA Public Key

  • Extract Public Key

openssl rsa –in priv.pem –pubout –out pub.pem

  • View Public Key

openssl rsa –text –pubin –in pub.pem

–out public.pem.info

N , e

RSA Encrypt

openssl rsautl –encrypt –pubin –inkey pub.pem

–in plaintext –out ciphertext

RSA Decrypt

openssl rsautl -decrypt -inkey priv.pem

-in  ciphertext -out cipheretext.decrypt

RSA : Factoring N

Tools

・factordb   

http://factordb.com/

・yafu

http://sourceforge.net/projects/yafu/

・Cado-NFS  

http://cado-nfs.gforge.inria.fr/

・Mesieve

https://github.com/Tojaj/rsaalgorithm/tree/master/msieve-1.51

Construct Private Key

Tools

  • rsatool

    https://github.com/ius/rsatool

computing d with given N , e , p , q

construct .pem with given N , d

example

從 pub 拿 N,e

解 N 得 p,q

   用 rsatool 

CTF Crypto tools

By ZAL

CTF Crypto tools

  • 1,686