X509CertificateRecipientClientCredential.SetScopedCertificate メソッド

定義

ストアの証明書を設定し、スコープを設定する URL でインデックスが作成されたコレクションに格納します。

オーバーロード

名前 説明
SetScopedCertificate(String, StoreLocation, StoreName, Uri)

サブジェクト名、証明書ストアの場所、証明書ストア名で証明書を設定し、スコープを設定する URL に使用するコレクションに格納します。

SetScopedCertificate(StoreLocation, StoreName, X509FindType, Object, Uri)

証明書ストアの場所、証明書ストア名、X.509 検索の種類、検索する値によって証明書を設定し、スコープを設定する URL に使用するコレクションに格納します。

SetScopedCertificate(String, StoreLocation, StoreName, Uri)

ソース:
X509CertificateRecipientClientCredential.cs
ソース:
X509CertificateRecipientClientCredential.cs
ソース:
X509CertificateRecipientClientCredential.cs

サブジェクト名、証明書ストアの場所、証明書ストア名で証明書を設定し、スコープを設定する URL に使用するコレクションに格納します。

public:
 void SetScopedCertificate(System::String ^ subjectName, System::Security::Cryptography::X509Certificates::StoreLocation storeLocation, System::Security::Cryptography::X509Certificates::StoreName storeName, Uri ^ targetService);
public void SetScopedCertificate(string subjectName, System.Security.Cryptography.X509Certificates.StoreLocation storeLocation, System.Security.Cryptography.X509Certificates.StoreName storeName, Uri targetService);
member this.SetScopedCertificate : string * System.Security.Cryptography.X509Certificates.StoreLocation * System.Security.Cryptography.X509Certificates.StoreName * Uri -> unit
Public Sub SetScopedCertificate (subjectName As String, storeLocation As StoreLocation, storeName As StoreName, targetService As Uri)

パラメーター

subjectName
String

完全修飾サブジェクト名。

storeLocation
StoreLocation

サービス証明書を取得するためにサービスが使用する証明書ストアの場所。

storeName
StoreName

開く X.509 証明書ストアの名前。

targetService
Uri

スコープを設定する URL。

例外

subjectName または targetServicenull

資格情報が読み取り専用のときに設定しようとしました。

このコードは、このメソッドを呼び出す方法を示しています。

public void snippet25(CalculatorClient cc)
{
    X509CertificateRecipientClientCredential rcc = cc.ClientCredentials.ServiceCertificate;
    rcc.SetScopedCertificate("http://fabrikam.com/sts",
                             StoreLocation.CurrentUser,
                             StoreName.TrustedPeople,
                             new Uri("http://fabrikam.com"));
}

注釈

storeLocationの値は、StoreLocation列挙型に含まれます。

  • LocalMachine: ローカル コンピューターに割り当てられた証明書ストア。

  • CurrentUser: 現在のユーザーによって使用される証明書ストア (既定値)。

アプリケーションがシステム アカウントで実行されている場合、証明書は通常 LocalMachine。 アプリケーションがユーザー アカウントで実行されている場合、証明書は通常 CurrentUser

storeNameの値は、StoreName列挙型に含まれます。

適用対象

SetScopedCertificate(StoreLocation, StoreName, X509FindType, Object, Uri)

ソース:
X509CertificateRecipientClientCredential.cs
ソース:
X509CertificateRecipientClientCredential.cs
ソース:
X509CertificateRecipientClientCredential.cs

証明書ストアの場所、証明書ストア名、X.509 検索の種類、検索する値によって証明書を設定し、スコープを設定する URL に使用するコレクションに格納します。

public:
 void SetScopedCertificate(System::Security::Cryptography::X509Certificates::StoreLocation storeLocation, System::Security::Cryptography::X509Certificates::StoreName storeName, System::Security::Cryptography::X509Certificates::X509FindType findType, System::Object ^ findValue, Uri ^ targetService);
public void SetScopedCertificate(System.Security.Cryptography.X509Certificates.StoreLocation storeLocation, System.Security.Cryptography.X509Certificates.StoreName storeName, System.Security.Cryptography.X509Certificates.X509FindType findType, object findValue, Uri targetService);
member this.SetScopedCertificate : System.Security.Cryptography.X509Certificates.StoreLocation * System.Security.Cryptography.X509Certificates.StoreName * System.Security.Cryptography.X509Certificates.X509FindType * obj * Uri -> unit
Public Sub SetScopedCertificate (storeLocation As StoreLocation, storeName As StoreName, findType As X509FindType, findValue As Object, targetService As Uri)

パラメーター

storeLocation
StoreLocation

サービス証明書を取得するためにサービスが使用する証明書ストアの場所。

storeName
StoreName

開く X.509 証明書ストアの名前。

findType
X509FindType

実行する X.509 検索の種類。

findValue
Object

X.509 証明書ストアで検索する値。

targetService
Uri

スコープを設定する URL。

例外

findValue または targetServicenull

資格情報が読み取り専用のときに設定しようとしました。

このコードは、このメソッドを呼び出す方法を示しています。

public void snippet20(CalculatorClient client)
{
    X509CertificateRecipientClientCredential rcc = client.ClientCredentials.ServiceCertificate;
    rcc.SetScopedCertificate(StoreLocation.CurrentUser,
                             StoreName.TrustedPeople,
                             X509FindType.FindBySubjectName,
                             "FabrikamSTS",
                             new Uri("http://fabrikam.com/sts"));
}
rcc.SetScopedCertificate(StoreLocation.CurrentUser, _
            StoreName.TrustedPeople, _
            X509FindType.FindBySubjectName, _
            "FabrikamSTS", _
            New Uri("http://fabrikam.com/sts"))

注釈

storeLocationの値は、StoreLocation列挙型に含まれます。

  • LocalMachine: ローカル コンピューターに割り当てられた証明書ストア。

  • CurrentUser: 現在のユーザーによって使用される証明書ストア (既定値)。

アプリケーションがシステム アカウントで実行されている場合、証明書は通常 LocalMachine。 アプリケーションがユーザー アカウントで実行されている場合、証明書は通常 CurrentUser

storeNameの値は、StoreName列挙型に含まれます。

findTypeの値は、X509FindType列挙型に含まれます。

最も一般的に使用される列挙体は FindBySubjectNameであり、指定したストア内の証明書のサブジェクト名に対して大文字と小文字を区別しない検索を行います。 これは不正確な検索である可能性があります。 条件に一致する証明書または複数の証明書が見つからない場合は、 InvalidOperationException がスローされます。

適用対象