KeyAlgorithmNames 类

定义

定义多个常用的公钥算法名称。 可以在 CertificateRequestProperties 类的 KeyAlgorithmName 属性中使用此类。

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
继承
Object Platform::Object IInspectable KeyAlgorithmNames
属性

Windows 要求

设备系列
Windows 10 (在 10.0.10240.0 中引入)
API contract
Windows.Foundation.UniversalApiContract (在 v1.0 中引入)

示例

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;
        }
    }
}

注解

此类仅包含静态属性。 无需创建 类的实例来检索属性。 请改用类名,后跟点运算符 (.) ,后跟属性名称。

属性

Dsa

返回“DSA”作为密钥算法名称。

Ecdh

返回“ECDH”作为密钥算法名称。

Ecdh256

返回“ECDH256”作为密钥算法名称。

Ecdh384

返回“ECDH384”作为密钥算法名称。

Ecdh521

返回“ECDH521”作为密钥算法名称。

Ecdsa

返回“ECDSA”作为密钥算法名称。

Ecdsa256

返回“ECDSA256”作为密钥算法名称。

Ecdsa384

返回“ECDSA384”作为密钥算法名称。

Ecdsa521

返回“ECDSA521”作为密钥算法名称。

Rsa

返回“RSA”作为密钥算法名称。

适用于

另请参阅