Skip to content

Instantly share code, notes, and snippets.

@rjsocha
rjsocha / powershell_script_sign.ps1
Last active Jan 25, 2019
PowerShell self-signed script
View powershell_script_sign.ps1
# CA Generation
# {hex}30030101FF => ASN.1 BasicConstraints: CA:TRUE
# $asn1=([System.Security.Cryptography.X509Certificates.X509BasicConstraintsExtension]::new($true, $flase, 0,$true)).RawData
# $asn1 | Format-Hex -Encoding Ascii
$ca_params =@{
"Type" = "Custom";
"Subject" = "CN=Local CA";
"FriendlyName" = "Local CA";
"KeyAlgorithm" = "RSA";
@rjsocha
rjsocha / rjslibrary.sh
Last active Jan 29, 2020
BASH support library
View rjslibrary.sh
function trim-string() {
local _var="$1"
_var="${_var#"${_var%%[![:space:]]*}"}" # remove leading whitespace characters
_var="${_var%"${_var##*[![:space:]]}"}" # remove trailing whitespace characters
echo -n "$_var"
}
function dns-query() {
local _r
if [[ -n $1 ]]
You can’t perform that action at this time.