public static void Main(String[] args) { Properties properties = new Properties(); properties.Load(new FileStream("c:/home/blowagie/key.properties", FileMode.Open)); String path = properties["PRIVATE"]; char[] pass = properties["PASSWORD"].ToCharArray(); Pkcs12Store ks = new Pkcs12Store(); ks.Load(new FileStream(path, FileMode.Open), pass); String alias = ""; foreach (string al in ks.Aliases) { if (ks.IsKeyEntry(al) && ks.GetKey(al).Key.IsPrivate) { alias = al; break; } } AsymmetricKeyParameter pk = ks.GetKey(alias).Key; ICollection<X509Certificate> chain = new List<X509Certificate>(); foreach (X509CertificateEntry entry in ks.GetCertificateChain(alias)) { chain.Add(entry.Certificate); } IOcspClient ocspClient = new OcspClientBouncyCastle(); C3_01_SignWithCAcert.Sign(DEST, chain, pk, DigestAlgorithms.SHA256, CryptoStandard.CMS, "Test", "Ghent", null, ocspClient, null, 0); }
internal static Dictionary<String, Object> ReadFontProperties(String name) { name += ".properties"; Stream isp = GetResourceStream(RESOURCE_PATH_CMAP + name); Properties p = new Properties(); p.Load(isp); isp.Close(); IntHashtable W = CreateMetric(p["W"]); p.Remove("W"); IntHashtable W2 = CreateMetric(p["W2"]); p.Remove("W2"); Dictionary<String, Object> map = new Dictionary<string,object>(); foreach (string key in p.Keys) { map[key] = p[key]; } map["W"] = W; map["W2"] = W2; return map; }
private static void LoadRegistry() { Stream isp = GetResourceStream(RESOURCE_PATH_CMAP + "cjk_registry.properties"); Properties p = new Properties(); p.Load(isp); isp.Close(); foreach (string key in p.Keys) { String value = p[key]; String[] sp = value.Split(cspace, StringSplitOptions.RemoveEmptyEntries); Dictionary<String,object> hs = new Dictionary<string,object>(); foreach (String s in sp) { hs[s] = null; } registryNames[key] = hs; } }
internal static Hashtable ReadFontProperties(String name) { try { name += ".properties"; Stream isp = GetResourceStream(RESOURCE_PATH + name); Properties p = new Properties(); p.Load(isp); isp.Close(); IntHashtable W = CreateMetric(p["W"]); p.Remove("W"); IntHashtable W2 = CreateMetric(p["W2"]); p.Remove("W2"); Hashtable map = new Hashtable(); foreach (string key in p.Keys) { map[key] = p[key]; } map["W"] = W; map["W2"] = W2; return map; } catch { // empty on purpose } return null; }