using System;
using System.Collections;
+using System.Globalization;
using System.IO;
using System.Reflection;
using System.Security;
namespace Mono.Security {
- /*
- * StrongNameManager.Verify
- * |
- * | yes
- * Assembly.GlobalAssemblyCache -----------\
- * | |
- * | no |
+ /* RUNTIME
+ * yes
+ * in_gac ---------------------------------\
* | |
- * \/ not found |
- * Token --------------------------|
+ * | no \/
+ * | return true
+ * CLASS LIBRARY|
+ * |
+ * |
+ * |
+ * bool StrongNameManager.MustVerify
+ * |
+ * |
+ * \/ not found
+ * Token --------------------------\
* | |
* | present ? |
* | |
* | |
* | present ? |
* | or "*" |
- * \/ |
- * SKIP VERIFICATION VERIFY ASSEMBLY
- * | |
- * | |
* \/ \/
- * return true return StrongName.Verify()
+ * return false return true
+ * SKIP VERIFICATION VERIFY ASSEMBLY
*/
internal class StrongNameManager {
sp.LoadXml (xml);
}
SecurityElement root = sp.ToXml ();
- if ((root != null) && (root.Tag == "strongNames")) {
- SecurityElement mapping = root.SearchForChildByTag ("pubTokenMapping");
- if ((mapping != null) && (mapping.Children.Count > 0)) {
- LoadMapping (mapping);
- }
-
- SecurityElement settings = root.SearchForChildByTag ("verificationSettings");
- if ((settings != null) && (settings.Children.Count > 0)) {
- LoadVerificationSettings (settings);
+ if ((root != null) && (root.Tag == "configuration")) {
+ SecurityElement strongnames = root.SearchForChildByTag ("strongNames");
+ if ((strongnames != null) && (strongnames.Children.Count > 0)) {
+ SecurityElement mapping = strongnames.SearchForChildByTag ("pubTokenMapping");
+ if ((mapping != null) && (mapping.Children.Count > 0)) {
+ LoadMapping (mapping);
+ }
+
+ SecurityElement settings = strongnames.SearchForChildByTag ("verificationSettings");
+ if ((settings != null) && (settings.Children.Count > 0)) {
+ LoadVerificationSettings (settings);
+ }
}
}
}
string token = item.Attribute ("Token");
if ((token == null) || (token.Length != 16))
continue; // invalid entry
+ token = token.ToUpper (CultureInfo.InvariantCulture);
string publicKey = item.Attribute ("PublicKey");
if (publicKey == null)
string token = item.Attribute ("Token");
if (token == null)
continue; // bad entry
+ token = token.ToUpper (CultureInfo.InvariantCulture);
string assembly = item.Attribute ("Assembly");
if (assembly == null)
return true;
string token = CryptoConvert.ToHex (an.GetPublicKeyToken ());
-
Element el = (Element) tokens [token];
if (el != null) {
- // lokok for this specific assembly first
+ // look for this specific assembly first
string users = el.GetUsers (an.Name);
if (users == null) {
// nothing for the specific assembly
StringBuilder sb = new StringBuilder ();
sb.Append ("Public Key Token\tAssemblies\t\tUsers");
sb.Append (Environment.NewLine);
+ if (tokens == null) {
+ sb.Append ("none");
+ return sb.ToString ();
+ }
+
foreach (DictionaryEntry token in tokens) {
sb.Append ((string)token.Key);
Element t = (Element) token.Value;