Certificates: Difference between revisions

From Piszczynski
piszczynski>Aleks
piszczynski>Aleks
Line 34: Line 34:


Add certificate to port:
Add certificate to port:
*netsh http add sslcert ipport:10.141.146.227:7001 certhash=<thumbprint of cert without spaces> appid='{EDE3C891-306C-40fe-BAD4-895B236A1CC8}'
*netsh http add sslcert ipport:0.0.0.0:443 certhash=<thumbprint of cert without spaces> appid='{EDE3C891-306C-40fe-BAD4-895B236A1CC8}'


Delete sslcert
Delete sslcert
*netsh http delete sslcert ipport=0.0.0.0:443
*netsh http delete sslcert ipport=0.0.0.0:443

Revision as of 16:16, 23 November 2021

Certificates

Certificates can be found with the .mmc certificates snapin

Export option with key to allow import to another computer

Find certificate authority:

  • certutil -config - -ping

Extract .crt

if you need cert in .crt format with key for ssl you can use open ssl to extract the keys.


Use the following command to extract when running openssl as admin:

  • openssl pkcs12 -in C:\PathToThePFXfile\myPFXfileName.pfx -out certificate.txt -nodes

This will extract the cert to a text file where you can grab the public and private keys and save them in text as a .crt and .key file.

Extract the key to encrypted key

  • openssl pkcs12 -in [yourfile.pfx] -nocerts -out [keyfile-encrypted.key]

Extract unencrypted key

  • openssl rsa -in [keyfile-encrypted.key] -out [keyfile-decrypted.key]

Extract Just certificate

  • openssl pkcs12 -in [yourfile.pfx] -clcerts -nokeys -out [certificate.crt]


SSL Certificates netsh

Check certificates bound to ports in netsh:

  • netsh http show sslcert

Add certificate to port:

  • netsh http add sslcert ipport:0.0.0.0:443 certhash=<thumbprint of cert without spaces> appid='{EDE3C891-306C-40fe-BAD4-895B236A1CC8}'

Delete sslcert

  • netsh http delete sslcert ipport=0.0.0.0:443