Skip to content

Instantly share code, notes, and snippets.

View MarkRobertJohnson's full-sized avatar

Mark R. Johnson MarkRobertJohnson

  • Axian, Inc.
  • Portland, OR
View GitHub Profile
@MarkRobertJohnson
MarkRobertJohnson / BLU_Paver
Last active December 31, 2015 20:59
BLU Paving
<#
.SYNOPSIS
This is a BoxStarter script for paving BLU machines
#>
Set-ExplorerOptions -showHidenFilesFoldersDrives -showProtectedOSFiles -showFileExtensions
Enable-RemoteDesktop
#Should we create domain users and groups? or assume their existence?
#Perhaps for now just assume their existence, but add the users to the local groups
@MarkRobertJohnson
MarkRobertJohnson / gist:7012670
Last active December 25, 2015 17:19
Extract certificate from WCF secure envelope
var ms = new MemoryStream(secureEnvelopeBytes);
var xRdr = new XmlTextReader(ms);
var message = Message.CreateMessage(xRdr, int.MaxValue, MessageVersion.Soap12);
var securityHeader = message.Headers.FirstOrDefault(x => x.Name == "Security");
if (securityHeader != null)
{
var securityElement = XElement.Parse(securityHeader.ToString());
var binarySecurityToken = securityElement.Descendants(
XName.Get("BinarySecurityToken", "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd")).Single();