Notes:
System.SecurityCryptography namespace is used for encrypting and decrypting data.
System.Security.AccessControl namespace is used for access to the DACLs, SACLs, and ACLs.
Access control list (ACL) – The operating system’s method for tracking who should have access to what, and determining which actions require adding an event to the event log.
Advanced Encryption Standard (AES) – Also known as Rijndael, RijndaeManaged - A government encryption standard. It is the only .NET framework symmetric encryption class that is fully managed. All other encryption classes call unmanaged code. Because of this it is the preferred choice when your application will be running in a partially trusted environment.
Key Length: 128 through 256 bits, in 32-bit increments
Asymmetric encryption – Also known as public-key encryption, overcomes symmetric encryption’s most significant disability: requiring both the encryptor and the decryptor to know a shared secret. Asymmetric encryption relies on key pairs. In a key pair, there is one public key and one private key. The public key can be freely shared because it cannot be easily abused, even by an attacker. Messages encrypted with the public key can be encrypted only with the private key, allowing anyone to send encrypted messages that can be decrypted only by a single individual.
Advantages:
Harder to break than symmetric algorithms
Disadvantages:
Not as fast as symmetric algorithms
Key management – led to the creation of the Public Key Infrastructure (PKI), or certificate services
http://en.wikipedia.org/wiki/Asymmetric_encryption
Authentication – Checking a user’s identity
1
2
3
4
5
6
7
8
9
10
11
12
13
14
| WindowsIdentity currentIdentity = WindowsIdentity.GetCurrent();
Console.WriteLine(“Name: “ + currentIdentity.Name);
Console.WriteLine(“Token: “ + currentIdentity.Token.ToString());
Console.WriteLine(“Authentication Type: “ + currentIdentity.AuthenticationType);
If (currentIdentity.IsAnonymous)
Console.WriteLine(“This user is an anonymous user”);
If (currentIdentity.IsAuthenticated)
Console.WriteLine(“This users is an authenticated user”);
If (currentIdentity.IsGuest)
Console.WriteLine(“This user is a Guest”);
If (currentIdentity.IsSystem)
Console.WriteLine(“This user is part of the System”); |
Authorization – The process of verifying that a user is allowed to access a requested resource. Authorization generally happens only after authentication.
1
2
| If (currentPrincipal.IsInRole(@”Division\Accounting”))
Console.WriteLine(“User is in Accounting”); |
Cipher text – Encrypted data
Data Encryption Standard (DES) – A symmetric encryption algorithm that uses relatively short key lengths that are vulnerable to cracking attacks. As a result, it should be avoided. However it remains commonly used because it is compatible with a wide range of legacy platforms.
Key Length: 56 Bits
Declarative RBS demands – Instructs the runtime to perform an RBS check before running a method. This is the most secure way to use RBS to restrict access to code because security is enforced by the runtime before it runs your code.
There are two primary disadvantages to declarative RBS demands:
- They can be used only to restrict access to entire methods
- They might result in the runtime throwing an exception. If the method was called by a windows event, windows catch the exception, and your application might stop running.
To use declarative RBS demands, you must have three elements in your code:
- The System.AppDomain.CurrentDomain.SetPrincipalPolicy method to specify the principal security policy
- A Try/Catch block to catch underprivileged access attempts and to report the error appropriately
- A PrincipalPermission attribute to declare the method’s access requirements
Digital Signature – A value that can be appended to electronic data to prove that it was created by a user who possesses a specific private key.
Note: Digital signatures do not protect the secrecy of the data being signed. To protect the secrecy of the file, you must encrypt it.
Discretionary Access Control List (DACL) – is an authorization restriction mechanism that indentifies the users and groups that are allowed or denied access to an object. Through the use of Access Control Entries (ACEs) the DACL determines user access to the object.
Note: The difference between SACLs and DACLs:
DACLs restrict access, whereas SACLs audit access.
Encryption key – A value, used in the encryption and decryption process, which controls how the data is ciphered.
Hash – A checksum that is unique to a specific file or piece of data. You can use a hash value to verify that a file has not been modified after the hash was generated.
Imperative RBS demands – Are declared within your code and can be used to restrict access to portions of code on a more granular basis than declarative RBS demands. In other words, imperative RBS demands allow you to restrict portions of a method whereas declarative RBS demands require you to restrict entire methods. To use imperative RBS demands, you must have four elements in your code:
- The System.AppDomainCurrentDomainSetPrincipalPolicy method to specify the principal security policy
- A Try/Catch block to catch underprivileged access attempts and report the error appropriately
- A PrincipalPermission object, with properties set according to the restrictions you want to impose.
- A call to the PrincipalPermission.Demand method to declare the method’s access requirements
Inherited Permission – Propagates to an object from its parent object.
Initialization Vector (IV) – Data that symmetric encryption algorithms use to further obscure the first block of data being encrypted, which makes unauthorized decrypting more difficult.
Keyed Hash algorithms – Algorithms that protect against modification of the hash by encrypting it with a secret key that both the sender and receiver must have.
MD5 – (Message Digest algorithm) The hash size for the MD5 algorithm is 128 bits.
Implementation Class: MD5CryptoServiceProvider
Principal – A representation of the identity of the active user and any roles to which the user belongs.
RC2 – An encryption standard designed to replace DES that uses variable key sizes.
Key Length: Variable
Rijndael, RijndaeManaged - A government encryption standard, this algorithm is also knows as Advanced Encryption Standard, or AES. It is the only .NET framework symmetric encryption class that is fully managed. All other encryption classes call unmanaged code. Because of this it is the preferred choice when your application will be running in a partially trusted environment.
Key Length: 128 through 256 bits, in 32-bit increments
Role-based Security (RBS) – Allows you to control what users can access based on their user name and group memberships.
Security Access Control List (SACL) – is a usage event logging mechanism that determines how file or folder access is audited. Unlike the DACL, an SACL cannot restrict access to a file or folder. However, an SACL can cause an event to be recorded in the security event log when a user accesses a file or folder.
Note: The difference between SACLs and DACLs:
DACLs restrict access, whereas SACLs audit access.
SHA1 – The Secure Hash Algorithm 1. The hash size for the SHA1 algorithm is 160 bits.
Other versions: SHA256, SHA284, SHA512
Implementation Class: SHA1CryptoServiceProvider
Shared Secret – The shared key that is required for two peers to encrypt and decrypt messages.
Symmetric encryption – Also known as secret-key encryption, it is a cryptography technique that uses a single secret key to both encrypts and decrypts data. Symmetric algorithms are extremely fast and are well suited for encrypting large quantities of data.
Advantages:
Fast
Well suited for encrypting large files
Disadvantages:
Cracking is only a manner of time. (the longer the key the harder it would be to crack the key)
Requires a shared key
Types of Symmetric Cryptography Classes:
RijindaelManaged, RC2, DES, TripleDES
http://en.wikipedia.org/wiki/Symmetric-key_algorithm
Triple DES – Essentially applies the DES algorithm three times.
Key Length: 156 Bits, of which only 112 bits are effectively used for encryption
please wait...
Rating: 0.0/10 (0 votes cast)