Skip to content

Instantly share code, notes, and snippets.

View xabim's full-sized avatar

Javier Martí xabim

View GitHub Profile

Keybase proof

I hereby claim:

  • I am xabim on github.
  • I am xabim (https://keybase.io/xabim) on keybase.
  • I have a public key whose fingerprint is 042F D72C E015 EAB4 F385 DAEE 2AC2 A942 BA95 DB8C

To claim this, I am signing this object:

{"version":1,"resource":"file:///Users/javier.marti/code/work/development/flywire-core/deploy/infra/environments/puzzle.json","entries":[{"id":"lNdK.json","timestamp":1651816919166}]}
@xabim
xabim / issue_cloudflare_record_srv.log
Created July 4, 2018 17:51
Terraform-Cloudflare-Issue
2018-07-04T11:57:25.165+0200 [DEBUG] plugin.terraform-provider-cloudflare_v1.0.0_x4:
2018/07/04 11:57:25 [DEBUG] CloudFlare Record create configuration: cloudflare.DNSRecord{
ID:"",
Type:"SRV",
Name:"_sipfederationtls._tcp.DOMAIN.com",
Content:"",
Proxiable:false,
Proxied:false,
TTL:0, Locked:false,
ZoneID:"e51da254a970ea32cd0a36f6189f8186",
@xabim
xabim / Certificate-Request.ps1
Created June 6, 2018 10:29
Certificate Request with exportable
Write-Host "Creating CertificateRequest(CSR) for $CertName `r "
Invoke-Command -ComputerName testbox -ScriptBlock {
$CertName = "Script Automation"
$CSRPath = "c:\temp\$($CertName)_.csr"
$INFPath = "c:\temp\$($CertName)_.inf"
$Signature = '$Windows NT$'
@xabim
xabim / Decrypt-Text-Certificate-v2.ps1
Created June 5, 2018 14:54
Encrypt a plain text with certificate in powershell with CMS
$Cert = Get-ChildItem Cert:\LocalMachine\My | Where-Object {$_.Subject -like 'CN=Script Automation'}
$EncryptedPwd = @'
-----BEGIN CMS-----
MIIBqAYJKoZIhvcNAQcDoIIBmTCCAZUCAQAxggFQMIIBTAIBADA0MCAxHjAcBgNVBAMMFVBvd2Vy
HrgQ84JxSV7RYpwSMPJRuSXlgVubOIew8KsYXr/E8kd/wOyT/2NPi3d+4xb67CLUM4infqOrt9Q+
ReAtINvfVB5EPc9wU8yDpdz+WKProT4RJ94nzGH5qW5SK4O1Siu0VSPJZaCNb+CmYNFNNvLu6MN4
-----END CMS-----
'@
$DecryptedPwd = $EncryptedPwd | Unprotect-CmsMessage -To $Cert | ConvertTo-SecureString -AsPlainText -Force
@xabim
xabim / Decrypt-Text-Certificate.ps1
Created June 5, 2018 14:53
Decrypt a plain text with certificate in powershell
$EncryptedPwd = "ts32rCLLdZl3/6wINHtLD6bQO65ub….. <shortened for simplicity>"
$EncryptedBytes = [System.Convert]::FromBase64String($EncryptedPwd)
$DecryptedBytes = $Cert.PrivateKey.Decrypt($EncryptedBytes, $true)
$DecryptedPwd = [system.text.encoding]::UTF8.GetString($DecryptedBytes)
@xabim
xabim / Encrypt-Text-Certificate-v2.ps1
Created June 5, 2018 14:51
Encrypt a plain text with certificate in powershell with CMS
$Cert = Get-ChildItem Cert:\LocalMachine\My | Where-Object {$_.Subject -like "CN=Script Automa*"}
$Password = 'Password'
Protect-CmsMessage -To $Cert -Content $Password
@xabim
xabim / Encrypt-Text-Certificate.ps1
Created June 5, 2018 14:48
Encrypt a plain text with certificate in powershell
$Cert = Get-ChildItem Cert:\LocalMachine\My | Where-Object {$_.Subject -like "CN=Script Automa*"}
$Password = 'Password'
$EncodedPwd = [system.text.encoding]::UTF8.GetBytes($Password)
$EncryptedBytes = $Cert.PublicKey.Key.Encrypt($EncodedPwd, $true)
$EncryptedPwd = [System.Convert]::ToBase64String($EncryptedBytes)