What should you do?

You are in the process of creating an application that will be used to forward confidential information to Domain.com’s business partners.
In a bid to improve the security of your production environment, you install digital certificates for publishing all assemblies in the application.
You need to confirm that every assembly belongs to the same publisher, based on that publisher’s digital certificate.
You are asked to confirm that the current assembly belongs to a certain publisher.
What should you do?

You are in the process of creating an application that will be used to forward confidential information to Domain.com’s business partners.
In a bid to improve the security of your production environment, you install digital certificates for publishing all assemblies in the application.
You need to confirm that every assembly belongs to the same publisher, based on that publisher’s digital certificate.
You are asked to confirm that the current assembly belongs to a certain publisher.
What should you do?

A.
Use the following code:
public bool CheckPolicy (X509Certificate cert){
PublisherMembershipCondition policy = new PublisherMembershipCondition(cert);
return policy.Check(Assembly.GetCallAssembly().Evidence);
}

B.
Use the following code:
public bool CheckPolicy (X509Certificate cert){
Publisher pub = new Publisher(cert);
return pub.Verify(AppDomain.CurrentDomain.Evidence);
}

C.
Use the following code:
public bool CheckPolicy (X509Certificate cert){
Publisher pub = new Publisher(cert);
return pub.Check(appDomain.CurrentDomain.Evidence);
}

D.
Use the following code:
public bool CheckPolicy (X509Certificate cert){
PublisherMembershipCondition policy = new PublisherMembershipCondition (cert);
return policy.Verify(Assembly.GetCallAssembly().Evidence);
}

Explanation:
Incorrect Answers:
B, C: You should not use the code fragments that specify the AppDomain.CurrentDomain.Evidence property as an argument , because this property retrieves only the evidence available to the current application domain.
D: You should not use this code fragment that specifies the Verify method because this method does not exist in the PublisherMembershipCondition class

XXXMembershipCondition und Methode
xxxMembershipCondition.Check(assembly.Evidence)

PublisherMembershipCondition und Check

PublisherMembershipCondition policy = new PublisherMembershipCondition (cert);

return policy.Check (Assembly.GetCallAssembly().Evidence); �
ACHTUNG eine Anwendung kann mehrere AppDomain haben !!!



Leave a Reply 0

Your email address will not be published. Required fields are marked *