Skip to content

Instantly share code, notes, and snippets.

View PieterHeijman's full-sized avatar

Pieter Heijman PieterHeijman

View GitHub Profile
@PieterHeijman
PieterHeijman / check_key_cert.md
Created August 31, 2017 14:43
Check if a certificate file matches a private key file in Powershell

You can verify if a private key file matches a certificate file by comparing their modulus (which you can retrieve using openssl). I've wrapped this in the little script below.

param(
  [String]$cert,
  [string]$key
)

$certMod = openssl x509 -noout -modulus -in $cert
$keyMod = openssl rsa -noout -modulus -in $key

Keybase proof

I hereby claim:

  • I am pieterheijman on github.
  • I am pieterheijman (https://keybase.io/pieterheijman) on keybase.
  • I have a public key ASD-uFcfYl4DX56JMfPWdBFdxyjHeo52e6kVTh2kz30IxAo

To claim this, I am signing this object: