CspParameters コンストラクタとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > CspParameters コンストラクタの意味・解説 

CspParameters コンストラクタ (Int32)

指定したプロバイダ種類コードコードを使用して、CspParameters クラス新しインスタンス初期化します。

名前空間: System.Security.Cryptography
アセンブリ: mscorlib (mscorlib.dll 内)
構文構文

Public Sub New ( _
    dwTypeIn As Integer _
)
Dim dwTypeIn As Integer

Dim instance As New CspParameters(dwTypeIn)
public CspParameters (
    int dwTypeIn
)
public:
CspParameters (
    int dwTypeIn
)
public CspParameters (
    int dwTypeIn
)
public function CspParameters (
    dwTypeIn : int
)

パラメータ

dwTypeIn

作成するプロバイダ種類を示すプロバイダ種類コード

解説解説
使用例使用例

CspParameters クラス使用してキー コンテナ作成し、そのコンテナキー保存するコード例次に示します

Imports System
Imports System.IO
Imports System.Security.Cryptography



Public Class StoreKey
    
    Public Shared Sub Main()
        ' creates the CspParameters object and sets the key container
 name used to store the RSA key pair
        Dim cp As New CspParameters()
        cp.KeyContainerName = "MyKeyContainerName"
        
        ' instantiates the rsa instance accessing the key container
 MyKeyContainerName
        Dim rsa As New RSACryptoServiceProvider(cp)
        ' add the below line to delete the key entry in MyKeyContainerName
        ' rsa.PersistKeyInCsp = false;
        'writes out the current key pair used in the rsa instance
        Console.WriteLine("Key is : "  & rsa.ToXmlString(True))
    End Sub 'Main
End Class 'StoreKey
using System;
using System.IO;
using System.Security.Cryptography;

public class StoreKey
{
    public static void Main()
    {
        // creates the CspParameters object and sets the key container
 name used to store the RSA key pair
        CspParameters cp = new CspParameters();
        cp.KeyContainerName = "MyKeyContainerName";

        // instantiates the rsa instance accessing the key container
 MyKeyContainerName
        RSACryptoServiceProvider rsa = new RSACryptoServiceProvider(cp);
        // add the below line to delete the key entry in MyKeyContainerName
        // rsa.PersistKeyInCsp = false;

        //writes out the current key pair used in the rsa instance
        Console.WriteLine("Key is : \n" + rsa.ToXmlString(true));
    }
}
using namespace System;
using namespace System::IO;
using namespace System::Security::Cryptography;
int main()
{
   
   // creates the CspParameters object and sets the key container name
 used to store the RSA key pair
   CspParameters^ cp = gcnew CspParameters;
   cp->KeyContainerName = "MyKeyContainerName";
   
   // instantiates the rsa instance accessing the key container MyKeyContainerName
   RSACryptoServiceProvider^ rsa = gcnew RSACryptoServiceProvider( cp );
   
   // add the below line to delete the key entry in MyKeyContainerName
   // rsa.PersistKeyInCsp = false;
   //writes out the current key pair used in the rsa instance
   Console::WriteLine( "Key is : \n{0}", rsa->ToXmlString( true
 ) );
}

import System.*;
import System.IO.*;
import System.Security.Cryptography.*;

public class StoreKey
{
    public static void main(String[]
 args)
    {
        // creates the CspParameters object and sets the key container
 name 
        // used to store the RSA key pair
        CspParameters cp = new CspParameters();
        cp.KeyContainerName = "MyKeyContainerName";

        // instantiates the rsa instance accessing the key container
 
        // MyKeyContainerName
        RSACryptoServiceProvider rsa = new RSACryptoServiceProvider(cp);

        // add the below line to delete the key entry in MyKeyContainerName
        // rsa.PersistKeyInCsp = false;
        //writes out the current key pair used in the rsa instance
        Console.WriteLine("Key is : \n" + rsa.ToXmlString(true));
    } //main
} //StoreKey
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
CspParameters クラス
CspParameters メンバ
System.Security.Cryptography 名前空間
その他の技術情報
暗号サービス

CspParameters コンストラクタ (Int32, String)

指定したプロバイダ種類コードと名前を使用して、CspParameters クラス新しインスタンス初期化します。

名前空間: System.Security.Cryptography
アセンブリ: mscorlib (mscorlib.dll 内)
構文構文

Public Sub New ( _
    dwTypeIn As Integer, _
    strProviderNameIn As String _
)
Dim dwTypeIn As Integer
Dim strProviderNameIn As String

Dim instance As New CspParameters(dwTypeIn,
 strProviderNameIn)
public CspParameters (
    int dwTypeIn,
    string strProviderNameIn
)
public:
CspParameters (
    int dwTypeIn, 
    String^ strProviderNameIn
)
public CspParameters (
    int dwTypeIn, 
    String strProviderNameIn
)
public function CspParameters (
    dwTypeIn : int, 
    strProviderNameIn : String
)

パラメータ

dwTypeIn

作成するプロバイダ種類を示すプロバイダ種類コード

strProviderNameIn

プロバイダ名。

解説解説
使用例使用例

CspParameters クラス使用してスマート カード暗号化サービス プロバイダ選択するコード例次に示しますその後で、スマート カード使用してデータ署名し、そのデータ検証します。

Imports System
Imports System.Security.Cryptography



Module SCSign

    Sub Main(ByVal args() As
 String)
        ' To idendify the Smart Card CryptoGraphic Providers on your
        ' computer, use the Microsoft Registry Editor (Regedit.exe).
        ' The available Smart Card CryptoGraphic Providers are listed
        ' in HKEY_LOCAL_MACHINE\Software\Microsoft\Cryptography\Defaults\Provider.

        ' Create a new CspParameters object that identifies a 
        ' Smart Card CryptoGraphic Provider.
        ' The 1st parameter comes from HKEY_LOCAL_MACHINE\Software\Microsoft\Cryptography\Defaults\Provider
 Types.
        ' The 2nd parameter comes from HKEY_LOCAL_MACHINE\Software\Microsoft\Cryptography\Defaults\Provider.
        Dim csp As New CspParameters(1,
 "Schlumberger Cryptographic Service Provider")
        csp.Flags = CspProviderFlags.UseDefaultKeyContainer

        ' Initialize an RSACryptoServiceProvider object using
        ' the CspParameters object.
        Dim rsa As New RSACryptoServiceProvider(csp)

        ' Create some data to sign.
        Dim data() As Byte
 = {0, 1, 2, 3, 4, 5, 6, 7}


        Console.WriteLine("Data   : " + BitConverter.ToString(data))

        ' Sign the data using the Smart Card CryptoGraphic Provider.
        Dim sig As Byte()
 = rsa.SignData(data, "SHA1")

        Console.WriteLine("Signature : " + BitConverter.ToString(sig))

        ' Verify the data using the Smart Card CryptoGraphic Provider.
        Dim verified As Boolean
 = rsa.VerifyData(data, "SHA1", sig)

        Console.WriteLine("Verified")

    End Sub

End Module
using System;
using System.Security.Cryptography;

namespace SmartCardSign
{
    class SCSign
    {
        static void Main(string[]
 args)
        {
            // To idendify the Smart Card CryptoGraphic Providers on
 your
            // computer, use the Microsoft Registry Editor (Regedit.exe).
            // The available Smart Card CryptoGraphic Providers are
 listed
            // in HKEY_LOCAL_MACHINE\Software\Microsoft\Cryptography\Defaults\Provider.


            // Create a new CspParameters object that identifies a 
            // Smart Card CryptoGraphic Provider.
            // The 1st parameter comes from HKEY_LOCAL_MACHINE\Software\Microsoft\Cryptography\Defaults\Provider
 Types.
            // The 2nd parameter comes from HKEY_LOCAL_MACHINE\Software\Microsoft\Cryptography\Defaults\Provider.
            CspParameters csp = new CspParameters(1, "Schlumberger
 Cryptographic Service Provider");
            csp.Flags = CspProviderFlags.UseDefaultKeyContainer;

            // Initialize an RSACryptoServiceProvider object using
            // the CspParameters object.
            RSACryptoServiceProvider rsa = new RSACryptoServiceProvider(csp);

            // Create some data to sign.
            byte[] data = new byte[] { 0, 1, 2, 3, 4, 5, 6, 7
 };

            Console.WriteLine("Data            : " + BitConverter.ToString(data));

            // Sign the data using the Smart Card CryptoGraphic Provider.
            byte[] sig = rsa.SignData(data, "SHA1");

            Console.WriteLine("Signature    : " + BitConverter.ToString(sig));

            // Verify the data using the Smart Card CryptoGraphic Provider.
            bool verified = rsa.VerifyData(data, "SHA1",
 sig);

            Console.WriteLine("Verified        : " + verified);

        }
    }
}
using namespace System;
using namespace System::Security::Cryptography;
int main()
{
   
   // To idendify the Smart Card CryptoGraphic Providers on your
   // computer, use the Microsoft Registry Editor (Regedit.exe).
   // The available Smart Card CryptoGraphic Providers are listed
   // in HKEY_LOCAL_MACHINE\Software\Microsoft\Cryptography\Defaults\Provider.
   // Create a new CspParameters object that identifies a 
   // Smart Card CryptoGraphic Provider.
   // The 1st parameter comes from HKEY_LOCAL_MACHINE\Software\Microsoft\Cryptography\Defaults\Provider
 Types.
   // The 2nd parameter comes from HKEY_LOCAL_MACHINE\Software\Microsoft\Cryptography\Defaults\Provider.
   CspParameters^ csp = gcnew CspParameters( 1,L"Schlumberger Cryptographic
 Service Provider" );
   csp->Flags = CspProviderFlags::UseDefaultKeyContainer;
   
   // Initialize an RSACryptoServiceProvider object using
   // the CspParameters object.
   RSACryptoServiceProvider^ rsa = gcnew RSACryptoServiceProvider( csp );
   
   // Create some data to sign.
   array<Byte>^data = gcnew array<Byte>{
      0,1,2,3,4,5,6,7
   };
   Console::WriteLine( L"Data            : {0}", BitConverter::ToString(
 data ) );
   
   // Sign the data using the Smart Card CryptoGraphic Provider.
   array<Byte>^sig = rsa->SignData( data, L"SHA1" );
   Console::WriteLine( L"Signature    : {0}", BitConverter::ToString( sig
 ) );
   
   // Verify the data using the Smart Card CryptoGraphic Provider.
   bool verified = rsa->VerifyData( data, L"SHA1",
 sig );
   Console::WriteLine( L"Verified        : {0}", verified );
}

プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
CspParameters クラス
CspParameters メンバ
System.Security.Cryptography 名前空間
その他の技術情報
暗号サービス

CspParameters コンストラクタ (Int32, String, String, CryptoKeySecurity, IntPtr)

メモ : このコンストラクタは、.NET Framework version 2.0新しく追加されたものです。

プロバイダ種類プロバイダ名、コンテナ名、アクセス情報、およびアンマネージ スマート カード パスワード ダイアログ識別するハンドル使用して、CspParameters クラス新しインスタンス初期化します。

名前空間: System.Security.Cryptography
アセンブリ: mscorlib (mscorlib.dll 内)
構文構文

Public Sub New ( _
    providerType As Integer, _
    providerName As String, _
    keyContainerName As String, _
    cryptoKeySecurity As CryptoKeySecurity, _
    parentWindowHandle As IntPtr _
)
Dim providerType As Integer
Dim providerName As String
Dim keyContainerName As String
Dim cryptoKeySecurity As CryptoKeySecurity
Dim parentWindowHandle As IntPtr

Dim instance As New CspParameters(providerType,
 providerName, keyContainerName, cryptoKeySecurity, parentWindowHandle)
public CspParameters (
    int providerType,
    string providerName,
    string keyContainerName,
    CryptoKeySecurity cryptoKeySecurity,
    IntPtr parentWindowHandle
)
public:
CspParameters (
    int providerType, 
    String^ providerName, 
    String^ keyContainerName, 
    CryptoKeySecurity^ cryptoKeySecurity, 
    IntPtr parentWindowHandle
)
public CspParameters (
    int providerType, 
    String providerName, 
    String keyContainerName, 
    CryptoKeySecurity cryptoKeySecurity, 
    IntPtr parentWindowHandle
)
public function CspParameters (
    providerType : int, 
    providerName : String, 
    keyContainerName : String, 
    cryptoKeySecurity : CryptoKeySecurity, 
    parentWindowHandle : IntPtr
)

パラメータ

providerType

作成するプロバイダ種類を示すプロバイダ種類コード

providerName

プロバイダ名。

keyContainerName

コンテナ名。

cryptoKeySecurity

コンテナ対すアクセス権および監視規則を表す CryptoKeySecurity オブジェクト

parentWindowHandle

スマート カード パスワード ダイアログの親ウィンドウ識別するハンドル

解説解説
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
CspParameters クラス
CspParameters メンバ
System.Security.Cryptography 名前空間

CspParameters コンストラクタ (Int32, String, String, CryptoKeySecurity, SecureString)

メモ : このコンストラクタは、.NET Framework version 2.0新しく追加されたものです。

プロバイダ種類プロバイダ名、コンテナ名、アクセス情報、およびスマート カード キー関連付けられたパスワード使用して、CspParameters クラス新しインスタンス初期化します。

名前空間: System.Security.Cryptography
アセンブリ: mscorlib (mscorlib.dll 内)
構文構文

Public Sub New ( _
    providerType As Integer, _
    providerName As String, _
    keyContainerName As String, _
    cryptoKeySecurity As CryptoKeySecurity, _
    keyPassword As SecureString _
)
Dim providerType As Integer
Dim providerName As String
Dim keyContainerName As String
Dim cryptoKeySecurity As CryptoKeySecurity
Dim keyPassword As SecureString

Dim instance As New CspParameters(providerType,
 providerName, keyContainerName, cryptoKeySecurity, keyPassword)
public CspParameters (
    int providerType,
    string providerName,
    string keyContainerName,
    CryptoKeySecurity cryptoKeySecurity,
    SecureString keyPassword
)
public:
CspParameters (
    int providerType, 
    String^ providerName, 
    String^ keyContainerName, 
    CryptoKeySecurity^ cryptoKeySecurity, 
    SecureString^ keyPassword
)
public CspParameters (
    int providerType, 
    String providerName, 
    String keyContainerName, 
    CryptoKeySecurity cryptoKeySecurity, 
    SecureString keyPassword
)
public function CspParameters (
    providerType : int, 
    providerName : String, 
    keyContainerName : String, 
    cryptoKeySecurity : CryptoKeySecurity, 
    keyPassword : SecureString
)

パラメータ

providerType

作成するプロバイダ種類を示すプロバイダ種類コード

providerName

プロバイダ名。

keyContainerName

コンテナ名。

cryptoKeySecurity

コンテナ対すアクセス権および監視規則を表す CryptoKeySecurity オブジェクト

keyPassword

スマート カード キー関連付けられたパスワード

解説解説
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
CspParameters クラス
CspParameters メンバ
System.Security.Cryptography 名前空間

CspParameters コンストラクタ

CspParameters クラス新しインスタンス初期化します。
オーバーロードの一覧オーバーロードの一覧

名前 説明
CspParameters () CspParameters クラス新しインスタンス初期化します。

.NET Compact Framework によってサポートされています。

CspParameters (Int32) 指定したプロバイダ種類コードコードを使用してCspParameters クラス新しインスタンス初期化します。

.NET Compact Framework によってサポートされています。

CspParameters (Int32, String) 指定したプロバイダ種類コードと名前を使用してCspParameters クラス新しインスタンス初期化します。

.NET Compact Framework によってサポートされています。

CspParameters (Int32, String, String) 指定したプロバイダ種類コードと名前、および指定したコンテナ名を使用してCspParameters クラス新しインスタンス初期化します。

.NET Compact Framework によってサポートされています。

CspParameters (Int32, String, String, CryptoKeySecurity, IntPtr) プロバイダ種類プロバイダ名、コンテナ名、アクセス情報、およびアンマネージ スマート カード パスワード ダイアログ識別するハンドル使用してCspParameters クラス新しインスタンス初期化します。
CspParameters (Int32, String, String, CryptoKeySecurity, SecureString) プロバイダ種類プロバイダ名、コンテナ名、アクセス情報、およびスマート カード キー関連付けられたパスワード使用してCspParameters クラス新しインスタンス初期化します。
参照参照

関連項目

CspParameters クラス
CspParameters メンバ
System.Security.Cryptography 名前空間

その他の技術情報

暗号サービス

CspParameters コンストラクタ (Int32, String, String)

指定したプロバイダ種類コードと名前、および指定したコンテナ名を使用して、CspParameters クラス新しインスタンス初期化します。

名前空間: System.Security.Cryptography
アセンブリ: mscorlib (mscorlib.dll 内)
構文構文

Public Sub New ( _
    dwTypeIn As Integer, _
    strProviderNameIn As String, _
    strContainerNameIn As String _
)
Dim dwTypeIn As Integer
Dim strProviderNameIn As String
Dim strContainerNameIn As String

Dim instance As New CspParameters(dwTypeIn,
 strProviderNameIn, strContainerNameIn)
public CspParameters (
    int dwTypeIn,
    string strProviderNameIn,
    string strContainerNameIn
)
public:
CspParameters (
    int dwTypeIn, 
    String^ strProviderNameIn, 
    String^ strContainerNameIn
)
public CspParameters (
    int dwTypeIn, 
    String strProviderNameIn, 
    String strContainerNameIn
)
public function CspParameters (
    dwTypeIn : int, 
    strProviderNameIn : String, 
    strContainerNameIn : String
)

パラメータ

dwTypeIn

作成するプロバイダ種類を示すプロバイダ種類コード

strProviderNameIn

プロバイダ名。

strContainerNameIn

コンテナ名。

解説解説
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
CspParameters クラス
CspParameters メンバ
System.Security.Cryptography 名前空間
その他の技術情報
暗号サービス

CspParameters コンストラクタ ()

CspParameters クラス新しインスタンス初期化します。

名前空間: System.Security.Cryptography
アセンブリ: mscorlib (mscorlib.dll 内)
構文構文

public CspParameters ()
public:
CspParameters ()
public CspParameters ()
public function CspParameters ()

CspParameters新しく作成したインスタンス

解説解説

この形式CspParameters は、ProviderType フィールドを値 1初期化します。この値は、PROV_RSA_FULL プロバイダ示します。この既定プロバイダは、RSA アルゴリズム互換性あります

他のプロバイダ種類については、ProviderType フィールド参照してください

使用例使用例

CspParameters クラス使用してキー コンテナ作成し、そのコンテナキー保存するコード例次に示します

Imports System
Imports System.IO
Imports System.Security.Cryptography



Public Class StoreKey
    
    Public Shared Sub Main()
        ' creates the CspParameters object and sets the key container
 name used to store the RSA key pair
        Dim cp As New CspParameters()
        cp.KeyContainerName = "MyKeyContainerName"
        
        ' instantiates the rsa instance accessing the key container
 MyKeyContainerName
        Dim rsa As New RSACryptoServiceProvider(cp)
        ' add the below line to delete the key entry in MyKeyContainerName
        ' rsa.PersistKeyInCsp = false;
        'writes out the current key pair used in the rsa instance
        Console.WriteLine("Key is : "  & rsa.ToXmlString(True))
    End Sub 'Main
End Class 'StoreKey
using System;
using System.IO;
using System.Security.Cryptography;

public class StoreKey
{
    public static void Main()
    {
        // creates the CspParameters object and sets the key container
 name used to store the RSA key pair
        CspParameters cp = new CspParameters();
        cp.KeyContainerName = "MyKeyContainerName";

        // instantiates the rsa instance accessing the key container
 MyKeyContainerName
        RSACryptoServiceProvider rsa = new RSACryptoServiceProvider(cp);
        // add the below line to delete the key entry in MyKeyContainerName
        // rsa.PersistKeyInCsp = false;

        //writes out the current key pair used in the rsa instance
        Console.WriteLine("Key is : \n" + rsa.ToXmlString(true));
    }
}
using namespace System;
using namespace System::IO;
using namespace System::Security::Cryptography;
int main()
{
   
   // creates the CspParameters object and sets the key container name
 used to store the RSA key pair
   CspParameters^ cp = gcnew CspParameters;
   cp->KeyContainerName = "MyKeyContainerName";
   
   // instantiates the rsa instance accessing the key container MyKeyContainerName
   RSACryptoServiceProvider^ rsa = gcnew RSACryptoServiceProvider( cp );
   
   // add the below line to delete the key entry in MyKeyContainerName
   // rsa.PersistKeyInCsp = false;
   //writes out the current key pair used in the rsa instance
   Console::WriteLine( "Key is : \n{0}", rsa->ToXmlString( true
 ) );
}

import System.*;
import System.IO.*;
import System.Security.Cryptography.*;

public class StoreKey
{
    public static void main(String[]
 args)
    {
        // creates the CspParameters object and sets the key container
 name 
        // used to store the RSA key pair
        CspParameters cp = new CspParameters();
        cp.KeyContainerName = "MyKeyContainerName";

        // instantiates the rsa instance accessing the key container
 
        // MyKeyContainerName
        RSACryptoServiceProvider rsa = new RSACryptoServiceProvider(cp);

        // add the below line to delete the key entry in MyKeyContainerName
        // rsa.PersistKeyInCsp = false;
        //writes out the current key pair used in the rsa instance
        Console.WriteLine("Key is : \n" + rsa.ToXmlString(true));
    } //main
} //StoreKey
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
CspParameters クラス
CspParameters メンバ
System.Security.Cryptography 名前空間
その他の技術情報
暗号サービス



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「CspParameters コンストラクタ」の関連用語

CspParameters コンストラクタのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



CspParameters コンストラクタのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS