Delen via


KeyAlgorithmNames Class

Definition

Defines several commonly used public key algorithm names. You can use this class in the KeyAlgorithmName property on the CertificateRequestProperties class.

public ref class KeyAlgorithmNames abstract sealed
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class KeyAlgorithmNames final
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public static class KeyAlgorithmNames
Public Class KeyAlgorithmNames
Inheritance
Object Platform::Object IInspectable KeyAlgorithmNames
Attributes

Windows requirements

Device family
Windows 10 (introduced in 10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced in v1.0)

Examples

using Windows.Security.Cryptography.Certificates;

namespace SampleKeyAlgorithmNames
{
    sealed partial class KeyAlgNamesApp : Application
    {
        public KeyAlgNamesApp()
        {
            // Initialize the application.
            this.InitializeComponent();

            // Demonstrate how to retrieve and set public key algorithm name.
            this.SamplePublicKeyAlgNames();
        }

        public void SamplePublicKeyAlgNames()
        {
            // Create a new CertificateRequestProperties object.
            CertificateRequestProperties reqProperties = new CertificateRequestProperties();

            // Retrieve the default value (RSA).
            String strDefaultAlgName = reqProperties.KeyAlgorithmName;

            // Set the value to DSA.
            reqProperties.KeyAlgorithmName = KeyAlgorithmNames.Dsa;

            //Set the value to ECDH_P256.
            reqProperties.KeyAlgorithmName = KeyAlgorithmNames.Ecdh256;

            //Set the value to ECDH_P384.
            reqProperties.KeyAlgorithmName = KeyAlgorithmNames.Ecdh384;

            //Set the value to ECDH_P521.
            reqProperties.KeyAlgorithmName = KeyAlgorithmNames.Ecdh521;

            //Set the value to ECDSA_P256.
            reqProperties.KeyAlgorithmName = KeyAlgorithmNames.Ecdsa256;

            //Set the value to ECDSA_P384.
            reqProperties.KeyAlgorithmName = KeyAlgorithmNames.Ecdsa384;

            //Set the value to ECDSA_P521.
            reqProperties.KeyAlgorithmName = KeyAlgorithmNames.Ecdsa521;
        }
    }
}

Remarks

This class contains only static properties. You do not have to create an instance of the class to retrieve the properties. Instead, use the class name followed by the dot operator (.), followed by the property name.

Properties

Dsa

Returns "DSA" as the key algorithm name.

Ecdh

Returns "ECDH" as the key algorithm name.

Ecdh256

Returns "ECDH256" as the key algorithm name.

Ecdh384

Returns "ECDH384" as the key algorithm name.

Ecdh521

Returns "ECDH521" as the key algorithm name.

Ecdsa

Returns "ECDSA" as the key algorithm name.

Ecdsa256

Returns "ECDSA256" as the key algorithm name.

Ecdsa384

Returns "ECDSA384" as the key algorithm name.

Ecdsa521

Returns "ECDSA521" as the key algorithm name.

Rsa

Returns "RSA" as the key algorithm name.

Applies to

See also