/** * getInstance * <p/> * Returns an instance of Crypto. This method uses the file * <code>crypto.properties</code> to determine which implementation to * use. Thus the property <code>org.apache.ws.security.crypto.provider</code> * must define the classname of the Crypto implementation. The file * may contain other property definitions as well. These properties are * handed over to the Crypto implementation. The file * <code>crypto.properties</code> is loaded with the * <code>Loader.getResource()</code> method. * <p/> * * @return The crypto implementation was defined * @throws WSSecurityException if there is an error in loading the crypto properties */ public static Crypto getInstance() throws WSSecurityException { return getInstance("crypto.properties"); }
/** * getInstance * <p/> * Returns an instance of Crypto. This method uses the file * <code>crypto.properties</code> to determine which implementation to * use. Thus the property <code>org.apache.ws.security.crypto.provider</code> * must define the classname of the Crypto implementation. The file * may contain other property definitions as well. These properties are * handed over to the Crypto implementation. The file * <code>crypto.properties</code> is loaded with the * <code>Loader.getResource()</code> method. * <p/> * * @return The crypto implementation was defined * @throws WSSecurityException if there is an error in loading the crypto properties */ public static Crypto getInstance() throws WSSecurityException { return getInstance("crypto.properties"); }
public static Crypto getInstance( String propFilename, ClassLoader customClassLoader ) throws WSSecurityException { Properties properties = getProperties(propFilename, customClassLoader); return getInstance(properties, customClassLoader); }
public static Crypto getInstance( String propFilename, ClassLoader customClassLoader ) throws WSSecurityException { Properties properties = getProperties(propFilename, customClassLoader); return getInstance(properties, customClassLoader); }
private static Crypto createCrypto(Properties properties, ClassLoader classLoader) throws RampartException { try { return CryptoFactory.getInstance(properties, classLoader); } catch (WSSecurityException e) { log.error("Error loading crypto properties.", e); throw new RampartException("cannotCrateCryptoInstance", e); } }
/** * Constructs crypto configuration based on the given properties. Provider is instantiated using * given class loader. * @param properties Crypto configuration properties. * @param classLoader Class loader used to create provider. * @return A crypto object. * @throws TrustException If an error occurred while creating the Crypto object. */ public static Crypto getCrypto(Properties properties, ClassLoader classLoader) throws TrustException { try { return CryptoFactory.getInstance(properties, classLoader); } catch (WSSecurityException e) { log.error("An error occurred while loading crypto properties", e); throw new TrustException("errorLoadingCryptoProperties", e); } }
/** * Constructs crypto configuration based on the given properties. Provider is instantiated using * given class loader. * @param propertiesFile Crypto configuration properties file name. * @param classLoader Class loader used to create provider. * @return A crypto object. * @throws TrustException If an error occurred while creating the Crypto object. */ public static Crypto getCrypto(String propertiesFile, ClassLoader classLoader) throws TrustException { try { return CryptoFactory.getInstance(propertiesFile, classLoader); } catch (WSSecurityException e) { log.error("An error occurred while loading crypto properties with property file " + propertiesFile, e); throw new TrustException("errorLoadingCryptoProperties", new Object[]{propertiesFile}, e); } }
/** * This method will create a Crypto object based on property values defined in cryptoElement or * cryptoPropertiesFile. * @param classLoader A class loader to pass into CryptoFactory. * @return A Crypto object * @throws TrustException If an error occurred while creating the Crypto object. */ public Crypto getIssuerCrypto(ClassLoader classLoader) throws TrustException { try { if (this.cryptoElement != null) { // crypto props defined as elements return CryptoFactory.getInstance(TrustUtil .toProperties(this.cryptoElement), classLoader); } else { // crypto props defined in a properties file return CryptoFactory.getInstance(this.cryptoPropertiesFile, classLoader); } } catch (WSSecurityException e) { throw new TrustException("errorLoadingCryptoProperties", e); } }
properties.getProperty("org.apache.ws.security.saml.issuer.cryptoProp.file"); if (cryptoProp != null) { issuerCrypto = CryptoFactory.getInstance(cryptoProp); issuerKeyName = properties.getProperty("org.apache.ws.security.saml.issuer.key.name");
properties.getProperty("org.apache.ws.security.saml.issuer.cryptoProp.file"); if (cryptoProp != null) { issuerCrypto = CryptoFactory.getInstance(cryptoProp); issuerKeyName = properties.getProperty("org.apache.ws.security.saml.issuer.key.name");
/** * A hook to allow subclass to load Crypto instances from property files in a different * way. * @param propFilename The property file name * @param reqData The RequestData object * @return A Crypto instance that has been loaded */ protected Crypto loadCryptoFromPropertiesFile( String propFilename, RequestData reqData ) throws WSSecurityException { return CryptoFactory.getInstance( propFilename, this.getClassLoader(reqData.getMsgContext()) ); }
/** * getInstance * <p/> * Returns an instance of Crypto. The properties are handed over the the crypto * implementation. The properties must at least contain the Crypto implementation * class name as the value of the property : org.apache.ws.security.crypto.provider * <p/> * * @param properties The Properties that are forwarded to the crypto implementation * and the Crypto impl class name. * These properties are dependent on the crypto implementation * @return The cyrpto implementation or null if no cryptoClassName was defined * @throws WSSecurityException if there is an error in loading the crypto properties */ public static Crypto getInstance(Properties properties) throws WSSecurityException { if (properties == null) { if (LOG.isDebugEnabled()) { LOG.debug("Cannot load Crypto instance as properties object is null"); } throw new WSSecurityException("Cannot load Crypto instance as properties object is null"); } return getInstance(properties, Loader.getClassLoader(CryptoFactory.class)); }
/** * getInstance * <p/> * Returns an instance of Crypto. The properties are handed over the the crypto * implementation. The properties must at least contain the Crypto implementation * class name as the value of the property : org.apache.ws.security.crypto.provider * <p/> * * @param properties The Properties that are forwarded to the crypto implementation * and the Crypto impl class name. * These properties are dependent on the crypto implementation * @return The cyrpto implementation or null if no cryptoClassName was defined * @throws WSSecurityException if there is an error in loading the crypto properties */ public static Crypto getInstance(Properties properties) throws WSSecurityException { if (properties == null) { if (LOG.isDebugEnabled()) { LOG.debug("Cannot load Crypto instance as properties object is null"); } throw new WSSecurityException("Cannot load Crypto instance as properties object is null"); } return getInstance(properties, Loader.getClassLoader(CryptoFactory.class)); }
/** * A hook to allow subclass to load Crypto instances from property files in a different * way. * @param propFilename The property file name * @param reqData The RequestData object * @return A Crypto instance that has been loaded */ protected Crypto loadCryptoFromPropertiesFile( String propFilename, RequestData reqData ) throws WSSecurityException { return CryptoFactory.getInstance( propFilename, this.getClassLoader(reqData.getMsgContext()) ); }
Object obj = getProperty(mc, refId); if (obj instanceof Properties) { crypto = CryptoFactory.getInstance((Properties)obj); cryptos.put(refId, crypto); } else if (obj instanceof Crypto) {
Object obj = getProperty(mc, refId); if (obj instanceof Properties) { crypto = CryptoFactory.getInstance((Properties)obj); cryptos.put(refId, crypto); } else if (obj instanceof Crypto) {
crypto = CryptoFactory.getInstance(TrustUtil .toProperties(config.cryptoElement), inMsgCtx .getAxisService().getClassLoader()); } else { // crypto props defined in a properties file crypto = CryptoFactory.getInstance(config.cryptoPropertiesFile, inMsgCtx.getAxisService().getClassLoader());