c#

The .NET CryptoStream class in C#

The CryptoStream wraps an ordinary stream and uses an ICryptoTransform. The CryptoStream have the following key advantages:

– You can use automatic encryption without worrying about the block size required by the algorithm, because the CryptoStream uses buffered access.

– CryptoStream wraps an ordinary .NET stream-derived class and you can easily use …

Learn more

How to use the .NET ICryptoTransform interface in C#

The ICryptoTransform interface represents blockwise cryptographic transformation which could be an encryption, ecryption, hashing, Base64 encoding/decoding, or formatting operation.  You can create an ICryptoTransform object for a given algorithm by using the:

–   CreateEncryptor() method – if you want to encrypt data.

–   CreateDecryptor() method – if you want to encrypt data.

The next code …

Learn more

The .NET abstract encryption classes

The .NET abstract encryption classes provide the following:

1. They define the basic members that encryption implementations need to support.

2. They offer some functionality through the static Create() method, which you can use to indirectly create …

Learn more

How to generate cryptographically strong random numbers in C#

You can create strong random number values with the System.Security.Cryptography.RandomNumberGenerator class. You use these random key or salt values when you want to store salted password hashes. A salted password hash is a hash created from a password and a so-called salt where salt is a random value. This guarantees that even if two users select …

Learn more

How do Windows certificate stores work

Windows supports several types of certificate stores that are called store locations. You can create a separate store for each Windows service of a machine, and every user has a separate certificate store. Certificates are kept securely in those stores. The local machine store is encrypted with a key managed by the local security authority of …

Learn more

How to read X509 certificates in C#

X509 certificates play an important role in the world of the Web, because they establish SSL communication and perform certificate authentication to secure traffic between the web server and its clients. Our site provides more details in the articles How does Secure Sockets Layer (SSL) technology work,  How do certificates work and  How does SSL work …

Learn more

How to use the Roles API with Windows authentication in ASP.NET in C#

The roles API  ships a provider that integrates with Windows roles for Windows authentication: the WindowsTokenRoleProvider. This provider retrieves the Windows group membership information for the currently logged-on user and provides it for your application. When using the WindowsTokenRoleProvider, you have to configure your application using Windows authentication and then configure the WindowsTokenRoleProvider as follows:

 

<configuration>

Learn more

How to perform authorization checks for Role-Based authorization in ASP.NET in C#

When you enable the roles API, by following the approach described in the article How to use Roles API for Role-Based Authorization in ASP.NET, the RoleManagerModule automatically creates a RolePrincipal instance. This instance contains both the authenticated user’s identity and the roles of the user. The RolePrincipal is a custom implementation of IPrincipal, which is the …

Learn more