The ClaimSet is quite interesting and extracting the Serial number from the certificate was something that wasn't that straight forward using FindClaims which takes the ClaimType Enumerator. For this you can cast the claim set into a X509CertificateClaimSet and get the Serial Number
public string GetCertificateSerialNumber() { foreach (ClaimSet cs in OperationContext.Current.ServiceSecurityContext.AuthorizationContext.ClaimSets) if (cs is X509CertificateClaimSet) return ((X509CertificateClaimSet)cs).SerialNumber;
return null; }
I thought this script might be quite useful to set up certificates for testing with services hosted in IIS. This uses 3 tools present in the SDK folder. 1. makecert2. certmgr3. FindPrivateKeyYou can find these in the WCF samples.Note: Make sure you run this from the Windows SDK prompt and check the cert stores for the certifcates.
--------------------------------Setup.bat----------------------------
echo offecho ************echo Client cert setup startingecho ************set CLIENT_NAME=client.comset SERVER_NAME=localhost
echo ****************echo Cleanup startingecho ****************
echo -------------------------echo del client certsecho -------------------------certmgr -del -r CurrentUser -s My -c -n %CLIENT_NAME%certmgr -del -r CurrentUser -s TrustedPeople -c -n %SERVER_NAME%
echo -------------------------echo del service certsecho -------------------------certmgr -del -r LocalMachine -s My -c -n %SERVER_NAME%certmgr -del -r LocalMachine -s TrustedPeople -c -n %CLIENT_NAME%
echo *****************echo Cleanup completedecho *****************
echo ************echo making client certecho ************makecert.exe -sr CurrentUser -ss MY -a sha1 -n CN=%CLIENT_NAME% -sky exchange -peecho ************echo copying client cert to server's CurrentUserstoreecho ************certmgr.exe -add -r CurrentUser -s My -c -n %CLIENT_NAME% -r LocalMachine -s TrustedPeople
echo ************echo Server cert setup startingecho %SERVER_NAME%echo ************echo making server certecho ************makecert.exe -sr LocalMachine -ss MY -a sha1 -n CN=%SERVER_NAME% -sky exchange -peecho ************echo copying server cert to client's CurrentUser storeecho ************certmgr.exe -add -r LocalMachine -s My -c -n %SERVER_NAME% -r CurrentUser -s TrustedPeople
echo ************echo setting privileges on server certificatesecho ************for /F "delims=" %%i in ('"FindPrivateKey.exe" My LocalMachine -n CN^=%SERVER_NAME% -a') do set PRIVATE_KEY_FILE=%%iset WP_ACCOUNT=NT AUTHORITY\NETWORK SERVICE(ver | findstr "5.1") && set WP_ACCOUNT=%COMPUTERNAME%\ASPNETecho Y|cacls.exe "%PRIVATE_KEY_FILE%" /E /G "%WP_ACCOUNT%":Riisreset
http://events.thoughtworks.co.in/
I was trying to explain PNP-X to a collegue of mine. This was something I was pretty interested as I was reading about Device Profiles for Web Services(DPWS) and was going through the specs.
NCD or Network connected devices have taken device integration to a new level and v2 is targetted on the WS discovery,eventing and control aspects.
This is quite a good read for programmers/architects for Smart Client Applications
I know many have moved to the live mail experience. I had my account moved today and I just love the space and the drag and drop features that got added to my hotmail account.
http://live.com