You are maintaining a Windows Communication Foundation (WCF) service that uses a custom username password class
to authenticate clients with. The service certificate is hosted in the deployment server store for trusted root certificate authorities
and has a Subject value of TaxServiceKey. Other service certificates hosted on the same server also use TaxServiceKey as a Subject value.
You need to ensure that the service identifies itself with a certificate whose subject name and distinguished names are TaxServiceKey.
Which code segment should you use?
A.
HostInstance Credentials.ServiceCertificate SetCertificate(
StoreLocation.LocalMachine, StoreName.My,
x509FindType.FindBySubjectName, “CN=”TaxServiceKey”);
B.
HostInstance Credentials.ServiceCertificate SetCertificate(
StoreLocation.LocalMachine, StoreName.AuthRoot,
x509FindType.FindBySubjectName, “CN=”TaxServiceKey”);
C.
HostInstance Credentials.ServiceCertificate SetCertificate(
StoreLocation.LocalMachine, StoreName.My,
x509FindType.FindByDistinguishedName, “CN=”TaxServiceKey”);
D.
HostInstance Credentials.ServiceCertificate SetCertificate(
StoreLocation.LocalMachine, StoreName.Root,
x509FindType.FindByDistinguishedName, “CN=”TaxServiceKey”);
Explanation:
StoreName Enumeration
Specifies the name of the X.509 certificate store to open.StoreName Enumeration
(http://msdn.microsoft.com/en-us/library/system.security.cryptography.x509certificates.storename.aspx)AddressBook The X.509 certificate store for other users.
AuthRoot The X.509 certificate store for third-party certificate authorities (CAs).
CertificateAuthority The X.509 certificate store for intermediate certificate authorities (CAs).
Disallowed The X.509 certificate store for revoked certificates.
My The X.509 certificate store for personal certificates.
Root The X.509 certificate store for trusted root certificate authorities (CAs).
TrustedPeople The X.509 certificate store for directly trusted people and resources.
TrustedPublisher The X.509 certificate store for directly trusted publishers.X509FindType Enumeration
(http://msdn.microsoft.com/en-us/library/system.security.cryptography.x509certificates.x509findtype(v=vs.85).aspx)FindBySubjectName The findValue parameter for the Find method must be a string representing the subject name of the certificate.
This is a less specific search than if you use the FindBySubjectDistinguishedName enumeration value.
Using the FindBySubjectName value, the Find method performs a case-insensitive string compare using the supplied value.
For example, if you pass “MyCert” to the Find method, it will find all certificates with the subject name containing that string,
regardless of other subject values. Searching by distinguished name is a more precise search.
FindBySubjectDistinguishedName The findValue parameter for the Find method must be a string representing the subject distinguished name of the certificate.
This is a more specific search than if you use the FindBySubjectName enumeration value.
Using the FindBySubjectDistinguishedName value, the Find method performs a case-insensitive string compare for the
entire distinguished name. Searching by subject name is a less precise search.
D