This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Verb-Noun { | |
[CmdletBinding()] | |
param ( | |
# a normal parameter | |
[Parameter(ValueFromPipeline = $true)] | |
[System.String]$Name, | |
) | |
dynamicparam { | |
# a simple dynamic parameter, $PossibleCategories is discovered on module import | |
$DynamicParams = New-Object System.Management.Automation.RuntimeDefinedParameterDictionary |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from base64 import b64decode | |
from OpenSSL import crypto | |
def verify_chain_of_trust(certificate, trusted_cert_pems): | |
# Create and fill a X509Sore with trusted certs | |
store = crypto.X509Store() | |
for trusted_cert_pem in trusted_cert_pems: | |
trusted_cert = crypto.load_certificate(crypto.FILETYPE_PEM, trusted_cert_pem) | |
store.add_cert(trusted_cert) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# example creating certs for use with docker swarm | |
$openssl = 'C:\Program Files (x86)\OpenSSL\1.0.1L\bin\openssl.exe' | |
$Utf8NoBomEncoding = New-Object System.Text.UTF8Encoding $False | |
$CN = "some-cert-name" | |
$Fqdn = "computer1.com" | |
# create a CA | |
& $openssl genrsa -aes256 -out ca-key.pem 4096 | |
& $openssl req -new -x509 -days 365 -key ca-key.pem -sha256 -out ca.pem -subj "/CN=$CN" |
OlderNewer