AsymmetricAlgorithm.Create メソッド

定義

非対称アルゴリズムを実行するために使用する暗号オブジェクトを作成します。

オーバーロード

Create()
古い.
古い.

非対称アルゴリズムを実行するために使用する既定の暗号オブジェクトを作成します。

Create(String)
古い.

非対称アルゴリズムの指定した実装のインスタンスを作成します。

Create()

ソース:
AsymmetricAlgorithm.cs
ソース:
AsymmetricAlgorithm.cs
ソース:
AsymmetricAlgorithm.cs

注意事項

The default implementation of this cryptography algorithm is not supported

注意事項

The default implementation of this cryptography algorithm is not supported.

非対称アルゴリズムを実行するために使用する既定の暗号オブジェクトを作成します。

C#
[System.Obsolete("The default implementation of this cryptography algorithm is not supported", DiagnosticId="SYSLIB0007", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
public static System.Security.Cryptography.AsymmetricAlgorithm Create ();
C#
[System.Obsolete("The default implementation of this cryptography algorithm is not supported.", DiagnosticId="SYSLIB0007", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
public static System.Security.Cryptography.AsymmetricAlgorithm Create ();
C#
public static System.Security.Cryptography.AsymmetricAlgorithm Create ();

戻り値

<cryptoClass> 要素を使用して既定の設定が変更されていない限り、新しい RSACryptoServiceProvider インスタンス。

属性

例外

.NET Core 2.0 - 3.1 および .NET 5 以降: すべての場合。

注釈

このメソッドは、.NET 5 以降のバージョンでは使用されていません。

次のコード例では、拡張クラスに メソッドを Create 実装する方法を示します。 このコード例は、AsymmetricAlgorithm クラスのために提供されている大規模な例の一部です。

C#
// The create function attempts to create a CustomCrypto object using
// the assembly name. This functionality requires modification of the
// machine.config file. Add the following section to the configuration
// element and modify the values of the cryptoClass to reflect what is
// installed in your machines GAC.
//        <cryptoClass CustomCrypto="Contoso.CustomCrypto, 
//          CustomCrypto, 
//          Culture=neutral, 
//          PublicKeyToken=fdb9f9c4851028bf, 
//          Version=1.0.1448.27640" />
//      <nameEntry name="Contoso.CustomCrypto" class="CustomCrypto" />
//      <nameEntry name="CustomCrypto" class="CustomCrypto" />
new static public CustomCrypto Create() 
{
    return Create("CustomCrypto");
}

こちらもご覧ください

適用対象

.NET 9 およびその他のバージョン
製品 バージョン (廃止)
.NET Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1 (5, 6, 7, 8, 9)
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1

Create(String)

ソース:
AsymmetricAlgorithm.cs
ソース:
AsymmetricAlgorithm.cs
ソース:
AsymmetricAlgorithm.cs

注意事項

Cryptographic factory methods accepting an algorithm name are obsolete. Use the parameterless Create factory method on the algorithm type instead.

非対称アルゴリズムの指定した実装のインスタンスを作成します。

C#
public static System.Security.Cryptography.AsymmetricAlgorithm? Create (string algName);
C#
[System.Obsolete("Cryptographic factory methods accepting an algorithm name are obsolete. Use the parameterless Create factory method on the algorithm type instead.", DiagnosticId="SYSLIB0045", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
public static System.Security.Cryptography.AsymmetricAlgorithm? Create (string algName);
C#
public static System.Security.Cryptography.AsymmetricAlgorithm Create (string algName);

パラメーター

algName
String

使用する非対称アルゴリズムの実装。 algName パラメーターの有効値、およびそれらの割り当て先のアルゴリズムを次の表に示します。

パラメーター値
System.Security.Cryptography.AsymmetricAlgorithmAsymmetricAlgorithm
RSARSA
System.Security.Cryptography.RSARSA
DSADSA
System.Security.Cryptography.DSADSA
ECDsaECDsa
ECDsaCngECDsaCng
System.Security.Cryptography.ECDsaCngECDsaCng
ECDHECDiffieHellman
ECDiffieHellmanECDiffieHellman
ECDiffieHellmanCngECDiffieHellmanCng
System.Security.Cryptography.ECDiffieHellmanCngECDiffieHellmanCng

戻り値

指定した非対称アルゴリズムの実装の新しいインスタンス。

属性

次のコード例では、拡張クラスに メソッドを Create 実装する方法を示します。 このコード例は、AsymmetricAlgorithm クラスのために提供されている大規模な例の一部です。

C#
// The create function attempts to create a CustomCrypto object using
// the assembly name. This functionality requires modification of the
// machine.config file. Add the following section to the configuration
// element and modify the values of the cryptoClass to reflect what is
// installed in your machines GAC.
//       <cryptoClass CustomCrypto="Contoso.CustomCrypto, 
//         CustomCrypto, 
//         Culture=neutral, 
//         PublicKeyToken=fdb9f9c4851028bf, 
//         Version=1.0.1448.27640" />
//     <nameEntry name="Contoso.CustomCrypto" class="CustomCrypto" />
//     <nameEntry name="CustomCrypto" class="CustomCrypto" />
new static public CustomCrypto Create(String algorithmName) 
{
    return (CustomCrypto) CryptoConfig.CreateFromName(algorithmName);
}

こちらもご覧ください

適用対象

.NET 9 およびその他のバージョン
製品 バージョン (廃止)
.NET Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6 (7, 8, 9)
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1