Sajay

Life, The Universe and Everything Distributed.

March, 2006

Posts
  • Sajay

    Getting the X509Certificate Serial Number out of the ClaimSet

    • 0 Comments

    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;
            }

  • Sajay

    Script for setting up Certificates for WCF

    • 1 Comments

    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. makecert
    2. certmgr
    3. FindPrivateKey
    You 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 off
    echo ************
    echo Client cert setup starting
    echo ************
    set CLIENT_NAME=client.com
    set SERVER_NAME=localhost

    echo ****************
    echo Cleanup starting
    echo ****************

    echo -------------------------
    echo del client certs
    echo -------------------------
    certmgr -del -r CurrentUser -s My -c -n %CLIENT_NAME%
    certmgr -del -r CurrentUser -s TrustedPeople -c -n %SERVER_NAME%

    echo -------------------------
    echo del service certs
    echo -------------------------
    certmgr -del -r LocalMachine -s My -c -n %SERVER_NAME%
    certmgr -del -r LocalMachine -s TrustedPeople -c -n %CLIENT_NAME%

    echo *****************
    echo Cleanup completed
    echo *****************


    echo ************
    echo making client cert
    echo ************
    makecert.exe -sr CurrentUser -ss MY -a sha1 -n CN=%CLIENT_NAME% -sky exchange -pe
    echo ************
    echo copying client cert to server's CurrentUserstore
    echo ************
    certmgr.exe -add -r CurrentUser -s My -c -n %CLIENT_NAME% -r LocalMachine -s TrustedPeople


    echo ************
    echo Server cert setup starting
    echo %SERVER_NAME%
    echo ************
    echo making server cert
    echo ************
    makecert.exe -sr LocalMachine -ss MY -a sha1 -n CN=%SERVER_NAME% -sky exchange -pe
    echo ************
    echo copying server cert to client's CurrentUser store
    echo ************
    certmgr.exe -add -r LocalMachine -s My -c -n %SERVER_NAME% -r CurrentUser -s TrustedPeople


    echo ************
    echo setting privileges on server certificates
    echo ************
    for /F "delims=" %%i in ('"FindPrivateKey.exe" My LocalMachine -n CN^=%SERVER_NAME% -a') do set PRIVATE_KEY_FILE=%%i
    set WP_ACCOUNT=NT AUTHORITY\NETWORK SERVICE
    (ver | findstr "5.1") && set WP_ACCOUNT=%COMPUTERNAME%\ASPNET
    echo Y|cacls.exe "%PRIVATE_KEY_FILE%" /E /G "%WP_ACCOUNT%":R
    iisreset

  • Sajay

    ThoughtWorks Master Class Series

    • 0 Comments

  • Sajay

    DPWS

    • 0 Comments

    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.

  • Sajay

    WS Management

    • 0 Comments
    Check out the road map and specification here
  • Sajay

    Smart Client Architecture and Design Guide

    • 0 Comments

    This is quite a good read for programmers/architects for Smart Client Applications

  • Sajay

    My Live Mail

    • 1 Comments

    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

     

  • Sajay

    Retreat '06

    • 0 Comments
    I really loved the view they had. Wished we had more time to enjoy the view at Colombo.
Page 1 of 1 (8 items)