xor = lambda a, b: bytes(ai ^ bi for ai, bi in zip(a, b))
- factordb API - API for getting well-known prime in FactorDB
- Pollard's rho - Efficient factor N when (p - 1) is smooth
- William's p+1 - Efficient factor N when (p + 1) is smooth
- Fermat factorization - Fermat Factorization : when p, q are close.
- Factors a number using the Elliptic Curve Method
from Crypto.PublicKey import RSA
key = RSA.importKey(open('publickey.pem','r').read())
Source : stackoverflow
Below commands allow you to convert certificates and keys to different formats to make them compatible with specific types of servers or software.
- Convert a PEM file to (.der, .crt)
openssl x509 -outform der -in certificate.pem -out certificate.der # DER
openssl x509 -outform der -in certificate.pem -out certificate.crt # CRT
openssl pkcs12 -export -out certificate.pfx -inkey privateKey.key -in certificate.crt -certfile CACert.crt # PFX, P12
openssl crl2pkcs7 -nocrl -certfile certificate.cer -out certificate.p7b -certfile CACert.cer # P7B
- Convert a DER file (.crt .cer .der) to PEM
openssl x509 -inform der -in certificate.crt -out certificate.pem
openssl x509 -inform der -in certificate.cer -out certificate.pem
openssl x509 -inform der -in certificate.der -out certificate.pem
- Convert a PKCS#12 file (.pfx .p12) containing a private key and certificates to PEM
openssl pkcs12 -in keyStore.pfx -out keyStore.pem -nodes