O'Reilly logo

Programming .NET Security by Allen Jones, Adam Freeman

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Programming Asymmetrical Encryption

The .NET Framework takes the same approach to representing asymmetric algorithms as it does for symmetric algorithms and hashing algorithms; abstract classes extend the System.Security.Cryptography.AsymmetricAlgorithm class for each of the supported algorithms. Individual implementations of the algorithms extend the abstract class, supporting the possibility of more than one implementation of an algorithm. Figure 15-6 shows the class hierarchy that supports asymmetric encryption algorithms, which is very simple because the .NET Framework supports only the RSA algorithm.

The .NET Framework class hierarchy for asymmetric encryption algorithms

Figure 15-6. The .NET Framework class hierarchy for asymmetric encryption algorithms

The AsymmetricAlgorithm class

Different asymmetric algorithms can take very different approaches to encrypting data, and the abstract AsymmetricAlgorithm class provides very little in the way of common functionality. Table 15-2 lists the pubic methods of the AsymmetricAlgorithm class.

Table 15-2. Members of the AsymmetricAlgorithm class

Member

Description

Properties

 

KeySize

Gets or sets the size in bits of the key modulus used by the algorithm

LegalKeySizes

Gets the key sizes supported by the algorithm

KeyExchangeAlgorithm

Gets the name of the key exchange algorithm

SignatureAlgorithm

Gets the name of the digital signature algorithm; see Chapter 16 for details of digital signatures ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required