4 Protocol Examples
To illustrate the operation of the Group Key Distribution Protocol, consider the example of a program designed to send encrypted email to users within an Active Directory forest from a domain-joined machine.
Given an email message and a set of recipients, the program would first construct a security descriptor with one access control entry (ACE) per recipient that grants access mask 0x3, and a final ACE that grants access mask 0x2 to the calling user. It would then use the Group Key Distribution Protocol client functionality described in section 18.104.22.168 to request the latest key for this security descriptor. To do this, it would make a request to the GetKey method described in section 22.214.171.124, with the pbTargetSD parameter set to the security descriptor constructed herein and the pRootKeyID parameter set to NULL.
As a result of the GetKey method call, the protocol client will either return a public key or a seed key. If a seed key is returned, this example program would execute a key derivation function (section 2.2.1) on this seed key to derive a key for a symmetric encryption algorithm such as the Advanced Encryption Standard (AES) [FIPS197].
Next the example program would encrypt the email message by using the Cryptographic Message Syntax (CMS) [RFC3852] with the public key or the above derived AES key, respectively. The domain name, forest name, security descriptor, root key identifier, and group key identifier would be stored in the CMS BLOB as a key identifier attribute. The encrypted email message would then be sent by using standard methods.
The example program, running on behalf of the recipient, would then extract the domain name, security descriptor, root key identifier, and group key identifier from the CMS BLOB, and would use them to make a request for this group key, as specified in section 3.2.4. If the recipient is authorized, the protocol client will return an L2 seed key. The program would then proceed as follows:
If the email message was encrypted with an AES key, use the seed key to derive the AES key by executing a key derivation function, and decrypt the email message by using standard CMS processing rules.
If the email message was encrypted with a public key, use the seed key to derive the group private key by using the method described in section 126.96.36.199.2, and decrypt the email message by using standard CMS processing rules [RFC3852].
The email message would then be displayed to the user.