1
Vote

Template name inconsistent with Windows Vista and later

description

The filename of the template cached is inconsistent with that of Windows Vista and later.
 
The AD-RMS Template Download Client creates/updates filename with the following format:
 
TMP-<hash>-<guid>.xml
where <hash> represents the hash returned by the web service, and <guid> represents the guid of the template.
 
The task that runs on Windows Vista and later uses the following format:
 
TMP-<id>-<hash>-<guid>.xml
where <id> represents a string common to all the templates in the folder.
 
This id likely represents a hash of some description of the AD-RMS server/cluster, used to track the origination of the template. Further, the client would likely be generating this from data returned from the AcquireTemplateInformation() call, as the only other material available to identify the cluster is the connection URI (which would not be unique across internal/external access URIs)
 
The web service returns a much longer 'ServerPublicKey' value from the AcquireTemplateInformation() function, but as yet the relationship (if any) between this value and the filename <id> value is unknown, therefore the application is unable to generate a filename consistent with that of Windows Vista and later.
 
However, the two clients are mutually exclusive, and the templates are stored in a local (non-roaming) location of the user profile, thus the impact of this should be minimal to non-existant. The only time that this may cause conflict is after an in-place upgrade from Windows XP or earlier to Windows Vista or later, where the two clients may run concurrently. For this reason, the client checks if it is running on Windows Vista and later, and if any existing templates of its creation are remaining it will delete them and take no further action.
 
This issue is retained in the event that this can be reverse engineered to maintain consistency.

comments

Jeonghwa wrote Oct 15, 2012 at 1:40 PM

here is the code.

string id = string.Empty;
ServicePointManager.ServerCertificateValidationCallback += new RemoteCertificateValidationCallback((sender, certificate, chain, policyErrors) => { return true; });

TemplateDistributionWebService ws = new TemplateDistributionWebService();
ws.Url = "https://[RMS_SERVER]/_wmcs/licensing/TemplateDistribution.asmx";
ws.UseDefaultCredentials = false;
ws.Credentials = new System.Net.NetworkCredential("[UserName]", "[Password]", "[Domain]");
ws.VersionDataValue = new VersionData();
ws.VersionDataValue.MinimumVersion = "1.1.0.0";
ws.VersionDataValue.MaximumVersion = "1.1.0.0";
TemplateInformation templateInfo = ws.AcquireTemplateInformation();

using (SHA1Managed sha1 = new SHA1Managed())
{
List<byte> bTemp = new List<byte>(new UnicodeEncoding().GetBytes(templateInfo.ServerPublicKey));
bTemp.Add(0x00);
bTemp.Add(0x00);
id = Convert.ToBase64String(sha1.ComputeHash(bTemp.ToArray()));

}

wrote Feb 13, 2013 at 2:23 AM