PublicKey クラス
アセンブリ: System (system.dll 内)



証明書ファイルを引数として受け取り、その証明書の各種プロパティをコンソールに出力するコマンド ライン形式の実行可能ファイルを作成するコード例を次に示します。
#using <System.dll> using namespace System; using namespace System::Security::Cryptography; using namespace System::Security::Permissions; using namespace System::IO; using namespace System::Security::Cryptography::X509Certificates; //Reads a file. array<Byte>^ ReadFile( String^ fileName ) { FileStream^ f = gcnew FileStream( fileName,FileMode::Open,FileAccess::Read ); int size = (int)f->Length; array<Byte>^data = gcnew array<Byte>(size); size = f->Read( data, 0, size ); f->Close(); return data; } int main() { array<String^>^args = Environment::GetCommandLineArgs(); //Test for correct number of arguments. if ( args->Length < 2 ) { Console::WriteLine( "Usage: CertInfo <filename>" ); return -1; } try { System::Security::Cryptography::X509Certificates::X509Certificate2 ^ x509 = gcnew System::Security::Cryptography::X509Certificates::X509Certificate2; //Create X509Certificate2 object from .cer file. array<Byte>^rawData = ReadFile( args[ 1 ] ); x509->Import(rawData); //Print to console information contained in the certificate. Console::WriteLine( "{0}Subject: {1}{0}", Environment::NewLine, x509->Subject ); Console::WriteLine( "{0}Issuer: {1}{0}", Environment::NewLine, x509->Issuer ); Console::WriteLine( "{0}Version: {1}{0}", Environment::NewLine, x509->Version ); Console::WriteLine( "{0}Valid Date: {1}{0}", Environment::NewLine, x509->NotBefore ); Console::WriteLine( "{0}Expiry Date: {1}{0}", Environment::NewLine, x509->NotAfter ); Console::WriteLine( "{0}Thumbprint: {1}{0}", Environment::NewLine, x509->Thumbprint ); Console::WriteLine( "{0}Serial Number: {1}{0}", Environment::NewLine, x509->SerialNumber ); Console::WriteLine( "{0}Friendly Name: {1}{0}", Environment::NewLine, x509->PublicKey->Oid->FriendlyName ); Console::WriteLine( "{0}Public Key Format: {1}{0}", Environment::NewLine, x509->PublicKey->EncodedKeyValue->Format(true) ); Console::WriteLine( "{0}Raw Data Length: {1}{0}", Environment::NewLine, x509->RawData->Length ); Console::WriteLine( "{0}Certificate to string: {1}{0}", Environment::NewLine, x509->ToString( true ) ); Console::WriteLine( "{0}Certificate to XML String: {1}{0}", Environment::NewLine, x509->PublicKey->Key->ToXmlString( false ) ); //Add the certificate to a X509Store. X509Store ^ store = gcnew X509Store; store->Open( OpenFlags::MaxAllowed ); store->Add( x509 ); store->Close(); } catch ( DirectoryNotFoundException^ ) { Console::WriteLine( "Error: The directory specified could not be found." ); } catch ( IOException^ ) { Console::WriteLine( "Error: A file in the directory could not be accessed." ); } catch ( NullReferenceException^ ) { Console::WriteLine( "File must be a .cer file. Program does not have access to that type of file." ); } }

System.Security.Cryptography.X509Certificates.PublicKey


Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


PublicKey コンストラクタ
アセンブリ: System (system.dll 内)

Dim oid As Oid Dim parameters As AsnEncodedData Dim keyValue As AsnEncodedData Dim instance As New PublicKey(oid, parameters, keyValue)

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


PublicKey プロパティ

名前 | 説明 | |
---|---|---|
![]() | EncodedKeyValue | 公開キー値の ASN.1 エンコードされた表現を取得します。 |
![]() | EncodedParameters | 公開キー パラメータの ASN.1 エンコードされた表現を取得します。 |
![]() | Key | 公開キーを表す RSACryptoServiceProvider オブジェクトまたは DSACryptoServiceProvider オブジェクトを取得します。 |
![]() | Oid | 公開キーのオブジェクト識別子 (OID: Object Identifier) オブジェクトを取得します。 |

PublicKey メソッド

名前 | 説明 | |
---|---|---|
![]() | Equals | オーバーロードされます。 2 つの Object インスタンスが等しいかどうかを判断します。 ( Object から継承されます。) |
![]() | GetHashCode | 特定の型のハッシュ関数として機能します。GetHashCode は、ハッシュ アルゴリズムや、ハッシュ テーブルのようなデータ構造での使用に適しています。 ( Object から継承されます。) |
![]() | GetType | 現在のインスタンスの Type を取得します。 ( Object から継承されます。) |
![]() | ReferenceEquals | 指定した複数の Object インスタンスが同一かどうかを判断します。 ( Object から継承されます。) |
![]() | ToString | 現在の Object を表す String を返します。 ( Object から継承されます。) |

名前 | 説明 | |
---|---|---|
![]() | Finalize | Object がガベージ コレクションにより収集される前に、その Object がリソースを解放し、その他のクリーンアップ操作を実行できるようにします。 ( Object から継承されます。) |
![]() | MemberwiseClone | 現在の Object の簡易コピーを作成します。 ( Object から継承されます。) |

PublicKey メンバ
証明書の公開キー情報を表します。このクラスは継承できません。
PublicKey データ型で公開されるメンバを以下の表に示します。

名前 | 説明 | |
---|---|---|
![]() | PublicKey | 公開キー、公開キー パラメータの ASN.1 エンコードされた表現、および公開キー値の ASN.1 エンコードされた表現のオブジェクト識別子 (OID) を使用して、PublicKey クラスの新しいインスタンスを初期化します。 |

名前 | 説明 | |
---|---|---|
![]() | EncodedKeyValue | 公開キー値の ASN.1 エンコードされた表現を取得します。 |
![]() | EncodedParameters | 公開キー パラメータの ASN.1 エンコードされた表現を取得します。 |
![]() | Key | 公開キーを表す RSACryptoServiceProvider オブジェクトまたは DSACryptoServiceProvider オブジェクトを取得します。 |
![]() | Oid | 公開キーのオブジェクト識別子 (OID: Object Identifier) オブジェクトを取得します。 |

名前 | 説明 | |
---|---|---|
![]() | Equals | オーバーロードされます。 2 つの Object インスタンスが等しいかどうかを判断します。 (Object から継承されます。) |
![]() | GetHashCode | 特定の型のハッシュ関数として機能します。GetHashCode は、ハッシュ アルゴリズムや、ハッシュ テーブルのようなデータ構造での使用に適しています。 (Object から継承されます。) |
![]() | GetType | 現在のインスタンスの Type を取得します。 (Object から継承されます。) |
![]() | ReferenceEquals | 指定した複数の Object インスタンスが同一かどうかを判断します。 (Object から継承されます。) |
![]() | ToString | 現在の Object を表す String を返します。 (Object から継承されます。) |

名前 | 説明 | |
---|---|---|
![]() | Finalize | Object がガベージ コレクションにより収集される前に、その Object がリソースを解放し、その他のクリーンアップ操作を実行できるようにします。 (Object から継承されます。) |
![]() | MemberwiseClone | 現在の Object の簡易コピーを作成します。 (Object から継承されます。) |

Weblioに収録されているすべての辞書からPublicKeyを検索する場合は、下記のリンクをクリックしてください。

- PublicKeyのページへのリンク