Brief Introduction of Strong Name Signatures

Strong name signatures consist of the identities of an assembly. They are strengthened by both public keys and digital signatures (as generated from the assembly). The identities include the plain text name, version number and regional information of the assembly (if provided). An assembly with a strong name can only refer to other assemblies which also have strong names. Note, two assemblies with the same strong name should be identical. We can guarantee the name’s global uniqueness through the signing and issuing of the assembly with a strong name.

In particular, strong names satisfy the following requirements:

  • Strong names guarantee name uniqueness by relying on unique key pairs. No one can generate the same assembly name as you. This is because an assembly generated with one private key has a different name than an assembly generated with another private key.
  • Strong names protect the version lineage of an assembly. A strong name can ensure that no one can produce a subsequent version of your assembly. Users can be assured that a version of an assembly they load comes from the same publisher that created the original version of the application.
  • Strong names provide a strong integrity check. Passing the .NET Framework security checks guarantees that the contents of the assembly have not been altered from the original build. Note, however, that strong names in and of themselves do not imply the same level of trust provided, for example, by a digital signature and supporting certificate.

Through the reflection mechanism, we can easily obtain a signature of .Net assembly.  Thus, we can make a new assembly with exactly the same interfaces. However, you would not be able to prove whether or not the assembly was published by you and others will not be able to confirm whether or not the assembly is legal. To solve this problem, one way is to use the strong name signature for the publisher’s assembly. As we mentioned previously, an assembly with a strong name guarantees the name’s global uniqueness.

An assembly name contains four parts: Friendly Name, Culture, PublicKey (Token), and Version. Among these, friendly name and version are essential while, as set in the default situation, Culture=neutral and PublicKey(Token)=null. The assembly with PublicKey is called strong signature assembly. When a data type is being used, the common language runtime (CLR) will analyze and import the corresponding assembly.   The assembly must have the same PublicKey(Token) as  the one in the reference phase.  If this assembly cannot be found, an exception would be thrown. When there is no PublicKey, this process will be skipped.

PublicKey and PublicKey Token

Public key has 32 bytes of header information, while the size of the public key is generally 128 bytes. The corresponding private key is owned by the developer, this is how it can mark its developer uniquely. For convenience, we use the SHA hash algorithm to generate a public key token of only 8 bytes; therefore, we can find the corresponding assembly according to the token.

How to Generate the Strong Name Signature for your Assembly

  1. Run the Visual Studio command line, generate a public or private key pair file by Sn.exe. Without specifying the file size, its default value is 596 bytes in total: 128 bytes public key, 32 bytes public key header and 436 private key.
  2. Sign the assembly. There are several methods for doing this:

1) Add content [assembly: AssemblyKeyFile(@”StrongName.snk”)] to the   AssemblyInfo.cs file of your project.

2) Add the /keyfile parameter when you compile the command line: csc /target:library /keyfile:StrongName.snk /out:Something.dll *.cs.

3) Assign the snk file in the VS project->Property->Signning

3. After completing all of the procedures above, your assembly now has a strong name signature. To check whether or not you signed it successfully, input: Sn -v Something.dll to your VS command line; if you got the result: Something.dll is valid, it means that you generated a program with a public key successfully. To get the assembly’s public key token, input command: Sn -T Something.dll.

Delayed Strong Name Signature

However, for some large scale programs, private key is protected whilst the corresponding public key is available, and the public key can be distributed freely. Here rises the problem: how can you make sure the developer uses the strong-name signed assembly (if they designed to put the assembly into GAC)? In other words, how can you obfuscate the code aimed at increasing the difficulty level for decompiling the source code?

This is the reason why Delayed Signature was born.

  1. Run the VS command line, generate a public/private key pair file. Without specifying the file size, its default value is 596 bytes in total: 128 byte public key, 32 byte public key header, and 436 private key. Use the command: Sn –k StrongName.snk
  2. Extract the public key: sn -p StrongName.snk public.snk
  3. Make the delayed signature for the assembly:
    1) Add content [assembly:AssemblyKeyFile(@”StrongName.snk”)]and [assembly: AssemblyDelaySign(true)] to  AssemblyInfo.cs;
    2) Add /keyfile and /delaysign parameters when you compile the command line: csc /target:library /keyfile:StrongName.snk /delaysign /out:Something.dll *.cs
    3)  Assign the snk file in VS project->Property->Signing, and tick the Delay Sign Only option.
  4. Make sure the CLR-trusted content of the assembly does not execute the Hash processing:  sn -Vr Something.dll (Note: the above naming adds the corresponding items from  the registry form, therefore you only need to execute it once for each assembly.
  5. Other programmers could refer to this assembly as any other assembly with a strong name signature. Meanwhile you can obfuscate the code.
  6. Make the final signature through the private key: sn -R Something.dll StrongName.snk (Note: we cannot extract the private key alone, since the private key and the public key are in the same file. However, public key can be extracted alone in order to distribute it.
  7. Open it to verify, the corresponding registry items mentioned in 4) would be removed: sn -Vu MyDll.dll

How does Android 4.4 KitKat Impress Me

Android 4.4 KitKat has been out for a couple of days now. Google has brought us some excellent few features. And, I can see the smokeless war between Google and Apple heating up. It is no doubt that competition makes for a better product experience. I would like to share some of Android 4.4’s exciting features , and make a comparison to Android’s biggest rival iOS 7.

Google Now vs Siri

How many users have dreamed about using a touch-less control for their phones? Now you just need to say “OK Google” to run Google Now. Without your hand, you can search your contacts, make a phone call, send SMS, check the weather, and so on. In the meantime, iOS Siri still needs to be triggered by holding down the home button. I still remember there was an ad showing how Siri assists people while they are driving. How can we manipulate our phones if we have to focus on the steering wheel?  Finally, Google has really allowed us to free-up our hands.

Hangouts vs iMessage

iMessage is definitely the killer of traditional SMS services, but it is only accessible to Apple users. Now, the new Hangouts app has brought this feature to Android users, and even made it better. Not only SMS and MMS are supported, but also locations and animated GIFs.

CloudPrint vs AirPrint

Android users do not need to be jealous of iOS users any more. Android 4.4 allows users to print web pages, photos and documents to any printer that’s connected to Google CloudPrint. This service is the same as AirPrint. Congratulations to all Android users.

Quickoffice vs iWork

Quickoffice has been redesigned by Google, and is totally free now. It is compatible with Microsoft Office Word, Excel, and PowerPoint. What’s more, you can save your work to Google Drive which provides up to 15G of storage for free. How generous Google is comparing to Apple. As we know, Apple announced iWork for free recently, but it is still only for those who purchased the latest iOS devices.

Nexus 5 vs iPhone 5S

Google has said that Android 4.4 will run on handsets with just 512MB of RAM. This is absolutely a breakthrough, because the current Android market seems to be much like a hardware race. Some big companies always put their focus on flagship devices as a sales strategy, not the software user experience. In contrast to iOS, Apple is still limiting its hardware, including RAM, battery volume, camera resolution and CPU frequency. Apparently, Google wants to change this situation. The new system has been optimized a lot, and can even run on old devices. With such a system, the performance of Nexus 5 is much better than any of the previous Nexus devices. With its low price, the Nexus 5  could be the biggest iPhone 5S challenger to date.

In additional to these features compared above, we can explore more unique features like screen recording, support for IR blasters, immersive experience, smart caller ID and so forth. If you are an Android fan, do not hesitate to get the best Android experience right now.

Is the Age of Free Operating System Coming?

There was news earlier this week that Apple will be providing its latest operating system, Mavericks, for free. It is apparently good news to just about all Mac users. There are also sure to be some people that may wonder whether this is a strategy against Microsoft. Just a couple of days ago, Microsoft announced that it would not charge consumers who upgrade their OS from Windows 8 to Windows 8.1.

For most consumers, there is nothing more important than an acceptable price point. Who doesn’t want to have a free meal? Apple began to drop OS prices starting with version 10.6 of Snow Leopard, which at the time was around $29 for the upgrade. It keeps getting lower and lower with each new release. Version 10.8 is currently $19.99. It’s well known that the operating system and Office suite are very significant products for Microsoft. They have been a primary source of Microsoft’s revenue to date. However, the OS and Office business is shrinking. There’s considerable agreement that what Apple is doing is having a huge impact on these Microsoft products.

Besides the free OS, Apple also announced that iLife and iWork are both free for consumers who purchased the latest Mac and iOS devices. So how will Apple then make a profit? Apple has established an excellent ecosystem with the Appstore for developers and consumers. This business model consists of advertisements, in-app purchases and cheap apps. With billions of consumers and probably hundreds of thousands of developers in hand, it is pretty easy for Apple to make money.

Also, the effective marketing of the booming mobile market is having a big influence on the PC market. Apple, as the pioneer of the smartphone, is trying to fuse their mobile OS and desktop OS with consistent experiences. To this end, it seems Apple decided to make the desktop OS free, just like the mobile OS. It is also a good approach to try and attract more consumers to the Mac platform, especially when comparing it to Windows’ price.

So, Apple is making a profit with hardware and services and this is Apple’s unique business model. Let’s think about what Google is doing. Google’s Nexus series may be the cheapest mobile devices in the world and its Android operating system is even open-source. The OS is provided to transplant to any hardware, including mobile devices, TVs, vehicles, fridges, and so forth. So, even Google is about the service and not making money on the OS. For example, most apps in the Apple or Google platform are free now. They instead depend on added value in apps or ads for income. Another typical example can be seen in telecommunications. Here consumers sign up for a service contract for a period of time to get a cellphone for free. Instead of paying for hardware they pay for service – they pay for their call and data usage plans each month. This is an established business model in telecommunications that earns them more money.

In the end, the competition between these giant companies benefits consumers. It spurs new technology and changing business model that address consumer wants. Perhaps it has even ushered in the age of the free operating system.

Webcam in HTML5

In the previous blog post, I have glanced at HTML5. Probably many people have already experienced some cool functions of HTML5. In this article, I would like to share how to invoke Webcam in HTML5.

While strolling through StackOverflow, I found there are many questions about how to display webcam in a web browser. Using HTML5, with a few tricks, can manage to show a Webcam in a web browser conveniently.

Please follow this tutorial step by step, and you can instantly build a webcam application in a web browser.

Create a <video> element and two <button> elements

<video id="video"></video>
<button id="start">start</button>
<button id="stop">stop</button>


var streaming = false,
video = document.querySelector('#video'),
start = document.querySelector('#start'),
stop = document.querySelector('#stop'),
width = 320,
height = 0;

Get video

navigator.getMedia = (navigator.getUserMedia ||
                                   navigator.webkitGetUserMedia ||
                                   navigator.mozGetUserMedia ||
                  video: true,
                  audio: false
              function (stream) {
                  if (navigator.mozGetUserMedia) {
                      video.mozSrcObject = stream;
                  } else {
                      var vendorURL = window.URL || window.webkitURL;
                      video.src = vendorURL.createObjectURL(stream);
              function (err) {
                  console.log("An error occured! " + err);

Resize video

video.addEventListener('canplay', function (ev) {
                if (!streaming) {
                    height = video.videoHeight / (video.videoWidth / width);
                    video.setAttribute('width', width);
                    video.setAttribute('height', height);
                    canvas.setAttribute('width', width);
                    canvas.setAttribute('height', height);
                    streaming = true;
            }, false);

 Start or stop video

start.addEventListener('click', function (ev) {
            }, false);
stop.addEventListener('click', function (ev) {
            }, false);

Pretty easy. For further reading, you can refer to Mozilla’s WebRTC docs.

HTML5 is definitely the trend of web technology. However, it is not so mature yet. Browsers are adopting features from HTML5 and evolving themselves over time. In the current stage, considering the compatibility and the security, using a 3rd-party webcam plugin, like ImageCapture Suite, would be a good option, especially if your image capture project has a tight schedule. Besides image acquisition, the plugin also allows you to do simple image processing, HTTP uploading and downloading. ImageCapture Suite supports all the mainstream web browsers like Chrome, IE, Firefox, and Opera on both Mac and Windows platform.

If you have any questions or comments, please leave a message in the comments section below or email me at

New to HTML5

What is HTML5

HTML5 is a markup language based on HTML 4 and XHTML 1. It’s goal is to support the latest multimedia and be much more readable and understandable by humans and devices. Also, it is dedicated to reducing the dependency on RIA (Rich Internet Application) such as Flash, Silverlight, JavaFX and so forth, providing more handy APIs for strengthening Internet applications. A generic definition of HTML5 is “HTML5 + CSS3 + JS”.


  • Standard
  • Cross-platform
  • Auto-adapt to the web page
  • Update in real-time
  • No plugin needed
  • Open and free
  • Friendly to search engines

What can HTML5 do

For experiencing what HTML5 can do, here are some amazing HTML5 web pages:

Features of HTML5


HTML5 defines some new HTML elements, which makes document description much more precise and readable.


Here are some useful HTML5 elements:

<article> <header> <aside> <hgroup> <figure> <figure> <figcaption> <section> <footer> <time>.

Deprecated elements: <acronym> <applet> <basefont> <big> <center> <dir> <font> <frame> <s> <isindex> <noframes> <frameset> <strike> <tt> <u> and <xmp>



WebSocket provides for full-duplex communication, which makes more possible interaction between client and server, facilitating live content and the creation of real-time games.




Website can push notifications to the desktop via the following code.

if (window.webkitNotifications.checkPermission() == 0) {
    var title = 'HTML5 notification',
        text = 'Can you see HTML5 notification?';
    window.webkitNotifications.createNotification('', title, text).show(); 


In HTML5, inserting a video or audio is as convenient as inserting an image.

HTML5 video

<audio src="sound.mp3" controls></audio>
<video src="movie.webm" autoplay controls></video>

3D Graphics Effects


Dynamically draw something on the web page.

<canvas id="canvas" width="300" height="300"></canvas>
  var ctx = document.getElementById("canvas").getContext("2d");
  ctx.fillRect(20, 25, 150, 100);

  ctx.arc(220, 110, 100, Math.PI * 1/2, Math.PI * 3/2);
  ctx.lineWidth = 15;
  ctx.lineCap = 'round';
  ctx.strokeStyle = 'rgba(255, 127, 0, 0.5)';


Without needing a plugin, WebGL provides some APIs to render 2D and 3D graphics in the web browser. This website helps you check whether your browser supports WebGL. Here are some amazing WebGL samples.

HTML5 vs Flash


  • No plugin for web browser.
  • Complex
  • Low popularity so far
  • Cross-platform
  • Lacks an engine
  • Free development tools.


  • Smooth and stunning
  • Easy to learn
  • High popularity
  • High battery cost
  • Not open
  • Paid development tools

For more specifications, refer to Wikipedia: Comparison of HTML5 and Flash

Please feel free to contact

Using Git-TFS in Visual Studio 2013 Express

Microsoft has released Visual Studio 2013 Preview, and announced the availability of Git for Visual Studio and Team Foundation Service. Today, let’s go through the new experience of version control in VS 2013 Preview.

Account Creation

Microsoft provides Team Foundation Service Free Plan for up to 5 users. I’m using the service for demo in this article. If you don’t have an in-house TFS Server, you can also take advantage of it and sign up for an account here. If you need a TFS Hosting service with good customer service, you may check out Dynamsoft TFS Hosting plans.

After creating an account with Microsoft TFS Service, you will be directed to your TFS page like the one shown below. You can see two options for creating a team project. The account URL is located below “Getting started”.

TFS main page

Team Project Creation

Click “New team project + Git” to create a team project using Git as the source control provider.

create git project


Specify the project name and select Git for version control.

specify new project


This is the page for my newly created team project. After creating the team project, we can then push the local repo to remote server.

project created

Local Project Creation

Create a new project in Visual Studio, and do not forget to check “Add to source control”.

create local project


Choose Git as your source control system.

choose git


Now you will be able to view the changes of your source code.

changes of source code


Commit your code.

commit changes


Right click a file in Team Explorer, you can compare version differences with syntax highlighting.

diff files


Also, checking repo history is convenient by right click.

view history

Publish to Remote Repository

Switch to Commits.

switch to Commits


Find Git URL on your TFS account.

git URL


Copy the URL to remote repository configuration, and click “Publish” to upload your local files to remote server.

publish to remote repo


Check commits information online.

commit log


Import Git from GitHub

Clone Git repo.

git clone


Download source code to local disk.

clone finished


Double-click your repo and click “Open” to mount your project.

open cloned project


That’s all about how to simply use Git between Visual Studio 2013 Express and Git remote server. Don’t hesitate to email if you have any idea to share with me.



What’s New in Visual Studio 11 for Developers

Last month I wrote a quick review for Visual Studio 11, which is literally a quick and general introduction to VS 11. The article today, as my exploration deepens, focuses on the improvements that are crucial for developers. They are:

  1. Windows Metro style apps
  2. IDE
  3. Async feature and Caller information for VB & C#
  4. Parallel related improvements for C++
  5. New in JavaScript & Visual F#
  6. New in Debugging
  7. New for data application development
  8. ASP.Net 4.5 and Web Development
  9. .Net 4.5
  10. Integration with Dynamsoft Source Control


1. Windows Metro style apps

Windows Metro style apps come with Windows 8. They are similar to Android apps and iOS apps but brand new on Windows platform. There’re two things you need to do before starting to develop and test these apps. First, you must install Visual Studio 11 on Windows 8. Second, you must obtain a developer license1 for the Windows Store.
You can develop a Metro style app2 using HTML5, CSS3, JavaScript; XAML with C++, C#, or Visual Basic; native C++ and HLSL. See the diagram below.

2. IDE

The IDE of Visual Studio 11 is backward compatible. I can open all files, projects or solutions that were created in Visual Studio 2010 with SP1. The earlier versions like VS 6.0, VS 2003, VS 2005 are not tested yet. However, I strongly recommend you to upgrade your projects in avoid of any unex
The new Solution Explorer brings much convenience for developers to manage codes. We can left click on a file to preview the code inside, double left click to open it. The code preview tab is in the top-right of the code editor. See the screenshot below.pected problems.

Read more

Quick Review: Microsoft Visual Studio 11

vs 11 beta logo

Ever since its development information unveiled to the public, Visual Studio 11 has received lots of concerns and discussions from software developers. The latest beta version was released in early this month. Download

So finally I had the chance to open Visual Studio 11 Beta after hours of waiting and setting up Windows 8 virtual environment. The first thing I must say is that, the Metro UI is revolutionary, neat and of great simplicity. Comparing to the popular Mac OS X UI, Windows has at last found its own style.

1. Trouble-free Installation
2. Developer-friendly UI
3. IDE Enhancements
4. Connect to Team Foundation Server
5. Other Improvements
6. Installation Requirements

1. Trouble-free Installation

The installation is unbelievably trouble-free! It took me about only 5 minutes to walk through the process. Double-click, install then finish.
If installed on Windows 8, the VS 11 will put several tiles on the Metro screen. A system restart is required after the installation to update all added components.

VS 11 Beta install

Read more