Code Monkey home page Code Monkey logo

okhttp-peer-certificate-extractor's People

Contributors

develodroid avatar fabiomsr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

okhttp-peer-certificate-extractor's Issues

pure shell implementation

# pin.sh

CERT="$1"
if [ -z "$CERT" ]; then
  echo 'usage: pin.sh CERT.pem'
  echo
  echo 'example:'
  echo
  echo '    $ openssl s_client -showcerts -connect google.com:443 </dev/null > google.pem'
  echo '    depth=1 C = US, O = Google Trust Services, CN = GTS CA 1O1'
  echo '    verify return:1'
  echo '    depth=0 C = US, ST = California, L = Mountain View, O = Google LLC, CN = *.google.com'
  echo '    verify return:1'
  echo '    DONE'
  echo '    $ ./pin.sh google.pem'
  echo '    sha256/xG5DOW4qfP5Rkg21faMmkxUHNSlfL5OASmHYtD1dWyY='
  exit 1;
fi

echo -n 'sha256/'; printf '\'x$(openssl x509 -in $CERT -noout -sha256 -fingerprint  | cut -f 2 -d = | sed 's/:/\\x/g') | base64

# maybe a bit more readable, at the price of needing python:
# echo -n sha256/
#openssl x509 -in "$CERT" -noout -sha256 -fingerprint  | cut -f 2 -d = | python -c 'import binascii; print(binascii.b2a_base64(binascii.unhexlify(input().replace(":",""))))'

this is public domain. do with it what you will. hope it helps someone out.

most systems have base64 installed. all of them have awk and cut. and if you're already working with certs you certainly have openssl installed, so this should be widely compatible, easy to install, and fast.

how to pass certificate file to PeerCertificateExtractor.extract method

hi
i am unable to pick my certificate file from resources1 folder
help me in doing this
i tried by the way you provided in test but it throw errors.

URL certificateUrl = CommonMethods.class.getResource("/mycert.cer");
File certificate = new File(certificateUrl.toURI());
String peerCertificate = PeerCertificateExtractor.extract(certificate);

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.