Quickies

[categories] [index] [all (531)] [latest]

OpenSSL
  1. $ openssl rsa -in pri.pem -modulus -noout
    Modulus=E5EC8AFD
    
  2. $ echo "-----BEGIN PUBLIC KEY-----                
    MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAobed3lKVSW7OB5ufeoLR
    hunKSX5pjmqcFypG2d+RPRCFRslNZJTzt6XJ6zwBftcORmJJWC1No7cbTmhmbq+r
    q3MJ1azR4mTTyL462K+KEJx9oOASdruBmE4YDOJ3q9noTRARmfLy747udLzFVuam
    kmtkAWvpyePq0aQanK6HHyhoklA2hs38eV0X2RVDLC+sbmNlXQ+elRan3jr+rVyf
    iWr01C0yS6vAaIrDAk6FgHuDNMi9EzfSuJe9ixHOqdLSHjE17xcZUJi2Hydvh3VW
    O2X+fDVGSKgAV7j4rV9691vKTS/PerPrlP+I9nmTVC+28LK2Sur5jNw153RqFSJ2
    dQIDAQAB
    -----END PUBLIC KEY-----" | openssl rsa -pubin -modulus -noout
    Modulus=A1B79DDE5295496ECE079B9F7A82D186E9CA497E698E6A9C172A46D9DF913D108546C94D6494F3B7A5C9EB3C017ED70E466249582D4DA3B71B4E68666EAFABAB7309D5ACD1E264D3C8BE3AD8AF8A109C7DA0E01276BB81984E180CE277ABD9E84D101199F2F2EF8EEE74BCC556E6A6926B64016BE9C9E3EAD1A41A9CAE871F286892503686CDFC795D17D915432C2FAC6E63655D0F9E9516A7DE3AFEAD5C9F896AF4D42D324BABC0688AC3024E85807B8334C8BD1337D2B897BD8B11CEA9D2D21E3135EF17195098B61F276F8775563B65FE7C354648A80057B8F8AD5F7AF75BCA4D2FCF7AB3EB94FF88F67993542FB6F0B2B64AEAF98CDC35E7746A15227675
    
  3. $ openssl rsa -text -in pri.pem -noout
    
    Private-Key: (50 bit)
    modulus: 932104465369093 (0x34fbe7b8d4805)
    publicExponent: 65537 (0x10001)
    privateExponent: 714399564038593 (0x289be1c3e01c1)
    prime1: 30607469 (0x1d3086d)
    prime2: 30453497 (0x1d0aef9)
    exponent1: 19335801 (0x1270a79)
    exponent2: 15609409 (0xee2e41)
    coefficient: 27047014 (0x19cb466)
    
  4. $ openssl x509 -pubkey -noout -in crt.pem
    -----BEGIN PUBLIC KEY-----
    MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAobed3lKVSW7OB5ufeoLR
    hunKSX5pjmqcFypG2d+RPRCFRslNZJTzt6XJ6zwBftcORmJJWC1No7cbTmhmbq+r
    q3MJ1azR4mTTyL462K+KEJx9oOASdruBmE4YDOJ3q9noTRARmfLy747udLzFVuam
    kmtkAWvpyePq0aQanK6HHyhoklA2hs38eV0X2RVDLC+sbmNlXQ+elRan3jr+rVyf
    iWr01C0yS6vAaIrDAk6FgHuDNMi9EzfSuJe9ixHOqdLSHjE17xcZUJi2Hydvh3VW
    O2X+fDVGSKgAV7j4rV9691vKTS/PerPrlP+I9nmTVC+28LK2Sur5jNw153RqFSJ2
    dQIDAQAB
    -----END PUBLIC KEY-----
    
  5. from Crypto.PublicKey import RSA
    pem = open("pub.pem").read()
    key = RSA.importKey(pem)
    print(key.n)
    
  6. $ openssl s_client -connect twap.swissquote.ch:443
    

    To use Mac OS X Keychain certificates, export then in .pem format, then use the -CAfile flag:

    $ openssl s_client -connect twap.swissquote.ch:443 -CAfile Certificates.pem