X509CertificateRecipientClientCredential.SetScopedCertificate Méthode
Définition
Important
Certaines informations portent sur la préversion du produit qui est susceptible d’être en grande partie modifiée avant sa publication. Microsoft exclut toute garantie, expresse ou implicite, concernant les informations fournies ici.
Définit un certificat à partir d’un magasin et le stocke dans une collection indexée par l’URL qui définit l’étendue.
Surcharges
| Nom | Description |
|---|---|
| SetScopedCertificate(String, StoreLocation, StoreName, Uri) |
Définit un certificat par nom d’objet, emplacement du magasin de certificats et nom du magasin de certificats, et le stocke dans une collection à utiliser pour l’URL qui définit l’étendue. |
| SetScopedCertificate(StoreLocation, StoreName, X509FindType, Object, Uri) |
Définit un certificat par emplacement du magasin de certificats, le nom du magasin de certificats, le type de recherche X.509 et la valeur à rechercher, et le stocke dans une collection à utiliser pour l’URL qui définit l’étendue. |
SetScopedCertificate(String, StoreLocation, StoreName, Uri)
Définit un certificat par nom d’objet, emplacement du magasin de certificats et nom du magasin de certificats, et le stocke dans une collection à utiliser pour l’URL qui définit l’étendue.
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)
Paramètres
- subjectName
- String
Nom complet de l’objet.
- storeLocation
- StoreLocation
Emplacement du magasin de certificats que le service utilise pour obtenir le certificat de service.
- storeName
- StoreName
Nom du magasin de certificats X.509 à ouvrir.
- targetService
- Uri
URL qui définit l’étendue.
Exceptions
subjectName ou targetService est null.
Tentative de définition lorsque les informations d’identification sont en lecture seule.
Exemples
Ce code montre comment appeler cette méthode.
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"));
}
Remarques
Les valeurs pour storeLocation elles sont incluses dans l’énumération StoreLocation :
LocalMachine: magasin de certificats affecté à l’ordinateur local.
CurrentUser: magasin de certificats utilisé par l’utilisateur actuel (par défaut).
Si l’application s’exécute sous un compte système, le certificat est généralement dans LocalMachine. Si l’application s’exécute sous un compte d’utilisateur, le certificat est généralement dans CurrentUser.
Les valeurs pour storeName elles sont incluses dans l’énumération StoreName .
S’applique à
SetScopedCertificate(StoreLocation, StoreName, X509FindType, Object, Uri)
Définit un certificat par emplacement du magasin de certificats, le nom du magasin de certificats, le type de recherche X.509 et la valeur à rechercher, et le stocke dans une collection à utiliser pour l’URL qui définit l’étendue.
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)
Paramètres
- storeLocation
- StoreLocation
Emplacement du magasin de certificats que le service utilise pour obtenir le certificat de service.
- storeName
- StoreName
Nom du magasin de certificats X.509 à ouvrir.
- findType
- X509FindType
Type de recherche X.509 à exécuter.
- findValue
- Object
Valeur à rechercher dans le magasin de certificats X.509.
- targetService
- Uri
URL qui définit l’étendue.
Exceptions
findValue ou targetService est null.
Tentative de définition lorsque les informations d’identification sont en lecture seule.
Exemples
Ce code montre comment appeler cette méthode.
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"))
Remarques
Les valeurs pour storeLocation elles sont incluses dans l’énumération StoreLocation :
LocalMachine: magasin de certificats affecté à l’ordinateur local.
CurrentUser: magasin de certificats utilisé par l’utilisateur actuel (par défaut).
Si l’application s’exécute sous un compte système, le certificat est généralement dans LocalMachine. Si l’application s’exécute sous un compte d’utilisateur, le certificat est généralement dans CurrentUser.
Les valeurs pour storeName elles sont incluses dans l’énumération StoreName .
Les valeurs pour findType elles sont incluses dans l’énumération X509FindType .
L’énumération la plus couramment utilisée est FindBySubjectName, qui effectue une recherche sans respect de la casse sur le nom d’objet des certificats dans le magasin spécifié. Il peut s’agir d’une recherche imprécise. Si aucun certificat ou plusieurs certificats correspondant aux critères sont trouvés, un InvalidOperationException certificat est levée.