Java Code Examples for java.security.Provider#getProperty()
The following examples show how to use
java.security.Provider#getProperty() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: X509CRLObject.java From TorrentEngine with GNU General Public License v3.0 | 6 votes |
public String getSigAlgName() { Provider prov = Security.getProvider(BouncyCastleProvider.PROVIDER_NAME); String algName = prov.getProperty("Alg.Alias.Signature." + this.getSigAlgOID()); if ( algName != null ) { return algName; } Provider[] provs = Security.getProviders(); // // search every provider looking for a real algorithm // for (int i = 0; i != provs.length; i++) { algName = provs[i].getProperty("Alg.Alias.Signature." + this.getSigAlgOID()); if ( algName != null ) { return algName; } } return this.getSigAlgOID(); }
Example 2
Source File: DProviderInfo.java From keystore-explorer with GNU General Public License v3.0 | 6 votes |
private String getAlgorithmClass(String algorithm, String serviceType, Provider provider) { /* * Looking for the property name that matches * "<service type>.<algorithm>". The value of the property is the class * name */ String match = serviceType + "." + algorithm; for (Enumeration<?> names = provider.propertyNames(); names.hasMoreElements();) { String key = (String) names.nextElement(); if (key.equals(match)) { return provider.getProperty(key); } } return null; }
Example 3
Source File: ProviderList.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
/** * Helper routine that uses a preferences entry to obtain an * implementation of a MechanismFactory from it. * @param e the preferences entry that contains the provider and * either a null of an explicit oid that matched the oid of the * desired mechanism. * @param mechOid the oid of the desired mechanism * @throws GSSException If the application explicitly requested * this entry's provider to be used for the desired mechanism but * some problem is encountered */ private MechanismFactory getMechFactory(PreferencesEntry e, Oid mechOid) throws GSSException { Provider p = e.getProvider(); /* * See if a MechanismFactory was previously instantiated for * this provider and mechanism combination. */ PreferencesEntry searchEntry = new PreferencesEntry(p, mechOid); MechanismFactory retVal = factories.get(searchEntry); if (retVal == null) { /* * Apparently not. Now try to instantiate this class from * the provider. */ String prop = PROV_PROP_PREFIX + mechOid.toString(); String className = p.getProperty(prop); if (className != null) { retVal = getMechFactoryImpl(p, className, mechOid, caller); factories.put(searchEntry, retVal); } else { /* * This provider does not support this mechanism. * If the application explicitly requested that * this provider be used for this mechanism, then * throw an exception */ if (e.getOid() != null) { throw new GSSExceptionImpl(GSSException.BAD_MECH, "Provider " + p.getName() + " does not support mechanism " + mechOid); } } } return retVal; }
Example 4
Source File: DProviderInfo.java From portecle with GNU General Public License v2.0 | 5 votes |
/** * Create tree node with information on all loaded providers. * * @return The tree node */ private DefaultMutableTreeNode createProviderNodes() { // Top node DefaultMutableTreeNode topNode = new DefaultMutableTreeNode(RB.getString("DProviderInfo.TopNodeName")); // For each provider... for (Provider provider : Security.getProviders()) { // Create a node with the provider name and add it as a child of the top node DefaultMutableTreeNode providerNode = new DefaultMutableTreeNode(provider.getName()); topNode.add(providerNode); // Add child nodes to the provider node for provider description and version providerNode.add(new DefaultMutableTreeNode(provider.getInfo())); providerNode.add(new DefaultMutableTreeNode("" + provider.getVersion())); // Create another child node called properties and... DefaultMutableTreeNode providerPropertiesNode = new DefaultMutableTreeNode(RB.getString("DProviderInfo.ProviderProperties")); providerNode.add(providerPropertiesNode); // ...add property child nodes to it. Use a TreeSet for sorting the properties. for (Object o : new TreeSet<>(provider.keySet())) { String sKey = String.valueOf(o); String sValue = provider.getProperty(sKey); providerPropertiesNode.add(new DefaultMutableTreeNode( MessageFormat.format(RB.getString("DProviderInfo.ProviderProperty"), sKey, sValue))); } } return topNode; }
Example 5
Source File: ProviderList.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
synchronized public void addProviderAtEnd(Provider p, Oid mechOid) throws GSSException { PreferencesEntry newEntry = new PreferencesEntry(p, mechOid); PreferencesEntry oldEntry; boolean foundSomeMech; Iterator<PreferencesEntry> list = preferences.iterator(); while (list.hasNext()) { oldEntry = list.next(); if (oldEntry.implies(newEntry)) return; } // System.out.println("addProviderAtEnd: No it is not redundant"); if (mechOid == null) foundSomeMech = addAllMechsFromProvider(p); else { String oidStr = mechOid.toString(); if (p.getProperty(PROV_PROP_PREFIX + oidStr) == null) throw new GSSExceptionImpl(GSSException.BAD_MECH, "Provider " + p.getName() + " does not support " + oidStr); mechs.add(mechOid); foundSomeMech = true; } if (foundSomeMech) { preferences.add(newEntry); } }
Example 6
Source File: ProviderList.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
/** * Helper routine that uses a preferences entry to obtain an * implementation of a MechanismFactory from it. * @param e the preferences entry that contains the provider and * either a null of an explicit oid that matched the oid of the * desired mechanism. * @param mechOid the oid of the desired mechanism * @throws GSSException If the application explicitly requested * this entry's provider to be used for the desired mechanism but * some problem is encountered */ private MechanismFactory getMechFactory(PreferencesEntry e, Oid mechOid) throws GSSException { Provider p = e.getProvider(); /* * See if a MechanismFactory was previously instantiated for * this provider and mechanism combination. */ PreferencesEntry searchEntry = new PreferencesEntry(p, mechOid); MechanismFactory retVal = factories.get(searchEntry); if (retVal == null) { /* * Apparently not. Now try to instantiate this class from * the provider. */ String prop = PROV_PROP_PREFIX + mechOid.toString(); String className = p.getProperty(prop); if (className != null) { retVal = getMechFactoryImpl(p, className, mechOid, caller); factories.put(searchEntry, retVal); } else { /* * This provider does not support this mechanism. * If the application explicitly requested that * this provider be used for this mechanism, then * throw an exception */ if (e.getOid() != null) { throw new GSSExceptionImpl(GSSException.BAD_MECH, "Provider " + p.getName() + " does not support mechanism " + mechOid); } } } return retVal; }
Example 7
Source File: ProviderList.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
synchronized public void addProviderAtEnd(Provider p, Oid mechOid) throws GSSException { PreferencesEntry newEntry = new PreferencesEntry(p, mechOid); PreferencesEntry oldEntry; boolean foundSomeMech; Iterator<PreferencesEntry> list = preferences.iterator(); while (list.hasNext()) { oldEntry = list.next(); if (oldEntry.implies(newEntry)) return; } // System.out.println("addProviderAtEnd: No it is not redundant"); if (mechOid == null) foundSomeMech = addAllMechsFromProvider(p); else { String oidStr = mechOid.toString(); if (p.getProperty(PROV_PROP_PREFIX + oidStr) == null) throw new GSSExceptionImpl(GSSException.BAD_MECH, "Provider " + p.getName() + " does not support " + oidStr); mechs.add(mechOid); foundSomeMech = true; } if (foundSomeMech) { preferences.add(newEntry); } }
Example 8
Source File: ProviderList.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
synchronized public void addProviderAtFront(Provider p, Oid mechOid) throws GSSException { PreferencesEntry newEntry = new PreferencesEntry(p, mechOid); PreferencesEntry oldEntry; boolean foundSomeMech; Iterator<PreferencesEntry> list = preferences.iterator(); while (list.hasNext()) { oldEntry = list.next(); if (newEntry.implies(oldEntry)) list.remove(); } if (mechOid == null) { foundSomeMech = addAllMechsFromProvider(p); } else { String oidStr = mechOid.toString(); if (p.getProperty(PROV_PROP_PREFIX + oidStr) == null) throw new GSSExceptionImpl(GSSException.BAD_MECH, "Provider " + p.getName() + " does not support " + oidStr); mechs.add(mechOid); foundSomeMech = true; } if (foundSomeMech) { preferences.add(0, newEntry); } }
Example 9
Source File: ProviderList.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
synchronized public void addProviderAtFront(Provider p, Oid mechOid) throws GSSException { PreferencesEntry newEntry = new PreferencesEntry(p, mechOid); PreferencesEntry oldEntry; boolean foundSomeMech; Iterator<PreferencesEntry> list = preferences.iterator(); while (list.hasNext()) { oldEntry = list.next(); if (newEntry.implies(oldEntry)) list.remove(); } if (mechOid == null) { foundSomeMech = addAllMechsFromProvider(p); } else { String oidStr = mechOid.toString(); if (p.getProperty(PROV_PROP_PREFIX + oidStr) == null) throw new GSSExceptionImpl(GSSException.BAD_MECH, "Provider " + p.getName() + " does not support " + oidStr); mechs.add(mechOid); foundSomeMech = true; } if (foundSomeMech) { preferences.add(0, newEntry); } }
Example 10
Source File: ProviderList.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
/** * Helper routine that uses a preferences entry to obtain an * implementation of a MechanismFactory from it. * @param e the preferences entry that contains the provider and * either a null of an explicit oid that matched the oid of the * desired mechanism. * @param mechOid the oid of the desired mechanism * @throws GSSException If the application explicitly requested * this entry's provider to be used for the desired mechanism but * some problem is encountered */ private MechanismFactory getMechFactory(PreferencesEntry e, Oid mechOid) throws GSSException { Provider p = e.getProvider(); /* * See if a MechanismFactory was previously instantiated for * this provider and mechanism combination. */ PreferencesEntry searchEntry = new PreferencesEntry(p, mechOid); MechanismFactory retVal = factories.get(searchEntry); if (retVal == null) { /* * Apparently not. Now try to instantiate this class from * the provider. */ String prop = PROV_PROP_PREFIX + mechOid.toString(); String className = p.getProperty(prop); if (className != null) { retVal = getMechFactoryImpl(p, className, mechOid, caller); factories.put(searchEntry, retVal); } else { /* * This provider does not support this mechanism. * If the application explicitly requested that * this provider be used for this mechanism, then * throw an exception */ if (e.getOid() != null) { throw new GSSExceptionImpl(GSSException.BAD_MECH, "Provider " + p.getName() + " does not support mechanism " + mechOid); } } } return retVal; }
Example 11
Source File: ProviderList.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
synchronized public void addProviderAtEnd(Provider p, Oid mechOid) throws GSSException { PreferencesEntry newEntry = new PreferencesEntry(p, mechOid); PreferencesEntry oldEntry; boolean foundSomeMech; Iterator<PreferencesEntry> list = preferences.iterator(); while (list.hasNext()) { oldEntry = list.next(); if (oldEntry.implies(newEntry)) return; } // System.out.println("addProviderAtEnd: No it is not redundant"); if (mechOid == null) foundSomeMech = addAllMechsFromProvider(p); else { String oidStr = mechOid.toString(); if (p.getProperty(PROV_PROP_PREFIX + oidStr) == null) throw new GSSExceptionImpl(GSSException.BAD_MECH, "Provider " + p.getName() + " does not support " + oidStr); mechs.add(mechOid); foundSomeMech = true; } if (foundSomeMech) { preferences.add(newEntry); } }
Example 12
Source File: ProviderList.java From hottub with GNU General Public License v2.0 | 5 votes |
synchronized public void addProviderAtEnd(Provider p, Oid mechOid) throws GSSException { PreferencesEntry newEntry = new PreferencesEntry(p, mechOid); PreferencesEntry oldEntry; boolean foundSomeMech; Iterator<PreferencesEntry> list = preferences.iterator(); while (list.hasNext()) { oldEntry = list.next(); if (oldEntry.implies(newEntry)) return; } // System.out.println("addProviderAtEnd: No it is not redundant"); if (mechOid == null) foundSomeMech = addAllMechsFromProvider(p); else { String oidStr = mechOid.toString(); if (p.getProperty(PROV_PROP_PREFIX + oidStr) == null) throw new GSSExceptionImpl(GSSException.BAD_MECH, "Provider " + p.getName() + " does not support " + oidStr); mechs.add(mechOid); foundSomeMech = true; } if (foundSomeMech) { preferences.add(newEntry); } }
Example 13
Source File: ProviderList.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
synchronized public void addProviderAtFront(Provider p, Oid mechOid) throws GSSException { PreferencesEntry newEntry = new PreferencesEntry(p, mechOid); PreferencesEntry oldEntry; boolean foundSomeMech; Iterator<PreferencesEntry> list = preferences.iterator(); while (list.hasNext()) { oldEntry = list.next(); if (newEntry.implies(oldEntry)) list.remove(); } if (mechOid == null) { foundSomeMech = addAllMechsFromProvider(p); } else { String oidStr = mechOid.toString(); if (p.getProperty(PROV_PROP_PREFIX + oidStr) == null) throw new GSSExceptionImpl(GSSException.BAD_MECH, "Provider " + p.getName() + " does not support " + oidStr); mechs.add(mechOid); foundSomeMech = true; } if (foundSomeMech) { preferences.add(0, newEntry); } }
Example 14
Source File: ProviderList.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
synchronized public void addProviderAtFront(Provider p, Oid mechOid) throws GSSException { PreferencesEntry newEntry = new PreferencesEntry(p, mechOid); PreferencesEntry oldEntry; boolean foundSomeMech; Iterator<PreferencesEntry> list = preferences.iterator(); while (list.hasNext()) { oldEntry = list.next(); if (newEntry.implies(oldEntry)) list.remove(); } if (mechOid == null) { foundSomeMech = addAllMechsFromProvider(p); } else { String oidStr = mechOid.toString(); if (p.getProperty(PROV_PROP_PREFIX + oidStr) == null) throw new GSSExceptionImpl(GSSException.BAD_MECH, "Provider " + p.getName() + " does not support " + oidStr); mechs.add(mechOid); foundSomeMech = true; } if (foundSomeMech) { preferences.add(0, newEntry); } }
Example 15
Source File: ProviderList.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
synchronized public void addProviderAtEnd(Provider p, Oid mechOid) throws GSSException { PreferencesEntry newEntry = new PreferencesEntry(p, mechOid); PreferencesEntry oldEntry; boolean foundSomeMech; Iterator<PreferencesEntry> list = preferences.iterator(); while (list.hasNext()) { oldEntry = list.next(); if (oldEntry.implies(newEntry)) return; } // System.out.println("addProviderAtEnd: No it is not redundant"); if (mechOid == null) foundSomeMech = addAllMechsFromProvider(p); else { String oidStr = mechOid.toString(); if (p.getProperty(PROV_PROP_PREFIX + oidStr) == null) throw new GSSExceptionImpl(GSSException.BAD_MECH, "Provider " + p.getName() + " does not support " + oidStr); mechs.add(mechOid); foundSomeMech = true; } if (foundSomeMech) { preferences.add(newEntry); } }
Example 16
Source File: ProviderList.java From hottub with GNU General Public License v2.0 | 5 votes |
/** * Helper routine that uses a preferences entry to obtain an * implementation of a MechanismFactory from it. * @param e the preferences entry that contains the provider and * either a null of an explicit oid that matched the oid of the * desired mechanism. * @param mechOid the oid of the desired mechanism * @throws GSSException If the application explicitly requested * this entry's provider to be used for the desired mechanism but * some problem is encountered */ private MechanismFactory getMechFactory(PreferencesEntry e, Oid mechOid) throws GSSException { Provider p = e.getProvider(); /* * See if a MechanismFactory was previously instantiated for * this provider and mechanism combination. */ PreferencesEntry searchEntry = new PreferencesEntry(p, mechOid); MechanismFactory retVal = factories.get(searchEntry); if (retVal == null) { /* * Apparently not. Now try to instantiate this class from * the provider. */ String prop = PROV_PROP_PREFIX + mechOid.toString(); String className = p.getProperty(prop); if (className != null) { retVal = getMechFactoryImpl(p, className, mechOid, caller); factories.put(searchEntry, retVal); } else { /* * This provider does not support this mechanism. * If the application explicitly requested that * this provider be used for this mechanism, then * throw an exception */ if (e.getOid() != null) { throw new GSSExceptionImpl(GSSException.BAD_MECH, "Provider " + p.getName() + " does not support mechanism " + mechOid); } } } return retVal; }
Example 17
Source File: ProviderList.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
synchronized public void addProviderAtEnd(Provider p, Oid mechOid) throws GSSException { PreferencesEntry newEntry = new PreferencesEntry(p, mechOid); PreferencesEntry oldEntry; boolean foundSomeMech; Iterator<PreferencesEntry> list = preferences.iterator(); while (list.hasNext()) { oldEntry = list.next(); if (oldEntry.implies(newEntry)) return; } // System.out.println("addProviderAtEnd: No it is not redundant"); if (mechOid == null) foundSomeMech = addAllMechsFromProvider(p); else { String oidStr = mechOid.toString(); if (p.getProperty(PROV_PROP_PREFIX + oidStr) == null) throw new GSSExceptionImpl(GSSException.BAD_MECH, "Provider " + p.getName() + " does not support " + oidStr); mechs.add(mechOid); foundSomeMech = true; } if (foundSomeMech) { preferences.add(newEntry); } }
Example 18
Source File: ProviderList.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
synchronized public void addProviderAtEnd(Provider p, Oid mechOid) throws GSSException { PreferencesEntry newEntry = new PreferencesEntry(p, mechOid); PreferencesEntry oldEntry; boolean foundSomeMech; Iterator<PreferencesEntry> list = preferences.iterator(); while (list.hasNext()) { oldEntry = list.next(); if (oldEntry.implies(newEntry)) return; } // System.out.println("addProviderAtEnd: No it is not redundant"); if (mechOid == null) foundSomeMech = addAllMechsFromProvider(p); else { String oidStr = mechOid.toString(); if (p.getProperty(PROV_PROP_PREFIX + oidStr) == null) throw new GSSExceptionImpl(GSSException.BAD_MECH, "Provider " + p.getName() + " does not support " + oidStr); mechs.add(mechOid); foundSomeMech = true; } if (foundSomeMech) { preferences.add(newEntry); } }
Example 19
Source File: ProviderList.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
/** * Helper routine that uses a preferences entry to obtain an * implementation of a MechanismFactory from it. * @param e the preferences entry that contains the provider and * either a null of an explicit oid that matched the oid of the * desired mechanism. * @param mechOid the oid of the desired mechanism * @throws GSSException If the application explicitly requested * this entry's provider to be used for the desired mechanism but * some problem is encountered */ private MechanismFactory getMechFactory(PreferencesEntry e, Oid mechOid) throws GSSException { Provider p = e.getProvider(); /* * See if a MechanismFactory was previously instantiated for * this provider and mechanism combination. */ PreferencesEntry searchEntry = new PreferencesEntry(p, mechOid); MechanismFactory retVal = factories.get(searchEntry); if (retVal == null) { /* * Apparently not. Now try to instantiate this class from * the provider. */ String prop = PROV_PROP_PREFIX + mechOid.toString(); String className = p.getProperty(prop); if (className != null) { retVal = getMechFactoryImpl(p, className, mechOid, caller); factories.put(searchEntry, retVal); } else { /* * This provider does not support this mechanism. * If the application explicitly requested that * this provider be used for this mechanism, then * throw an exception */ if (e.getOid() != null) { throw new GSSExceptionImpl(GSSException.BAD_MECH, "Provider " + p.getName() + " does not support mechanism " + mechOid); } } } return retVal; }
Example 20
Source File: DProviderInfo.java From portecle with GNU General Public License v2.0 | 4 votes |
/** * Copy button pressed - copy provider information to clipboard. */ private void copyPressed() { // Put provider information in here StringBuilder strBuff = new StringBuilder(); // For each provider... for (Provider provider : Security.getProviders()) { if (strBuff.length() != 0) { strBuff.append('\n'); } // ...write out the provider name, description and version... strBuff.append(MessageFormat.format(RB.getString("DProviderInfo.Copy.ProviderName"), provider.getName())); strBuff.append('\n'); strBuff.append( MessageFormat.format(RB.getString("DProviderInfo.Copy.ProviderVersion"), provider.getVersion())); strBuff.append('\n'); strBuff.append( MessageFormat.format(RB.getString("DProviderInfo.Copy.ProviderDescription"), provider.getInfo())); strBuff.append('\n'); strBuff.append(RB.getString("DProviderInfo.Copy.ProviderProperties")); strBuff.append('\n'); // ...and it's properties. Use a TreeSet for sorting the properties. for (Object o : new TreeSet<>(provider.keySet())) { String sKey = String.valueOf(o); String sValue = provider.getProperty(sKey); strBuff.append('\t'); strBuff.append(sKey); strBuff.append('='); strBuff.append(sValue); strBuff.append('\n'); } } // Copy to clipboard Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); StringSelection copy = new StringSelection(strBuff.toString()); clipboard.setContents(copy, copy); }