本文整理匯總了Java中org.apache.ws.security.components.crypto.Merlin類的典型用法代碼示例。如果您正苦於以下問題:Java Merlin類的具體用法?Java Merlin怎麽用?Java Merlin使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Merlin類屬於org.apache.ws.security.components.crypto包,在下文中一共展示了Merlin類的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: loadSignatureCrypto
import org.apache.ws.security.components.crypto.Merlin; //導入依賴的package包/類
@Override
public Crypto loadSignatureCrypto(RequestData reqData) {
try {
return new Merlin(getMerlinProperties(), ClassLoaderUtils.getDefaultClassLoader());
} catch (Exception e) {
throw new RiceRuntimeException(e);
}
}
示例2: addSecurityOptions
import org.apache.ws.security.components.crypto.Merlin; //導入依賴的package包/類
public void addSecurityOptions ( String policyPath, String keyStore,String userName, String password) throws AxisFault, FileNotFoundException, XMLStreamException {
ServiceClient client = stub._getServiceClient();
Policy policy = loadPolicy(policyPath);
Properties merlinProp = new Properties();
merlinProp.put("org.apache.ws.security.crypto.merlin.keystore.type", "JKS");
merlinProp.put("org.apache.ws.security.crypto.merlin.file",
keyStore);
merlinProp.put("org.apache.ws.security.crypto.merlin.keystore.password", "wso2carbon");
CryptoConfig sigCryptoConfig = new CryptoConfig();
sigCryptoConfig.setProvider(Merlin.class.getName());
sigCryptoConfig.setProp(merlinProp);
CryptoConfig encCryptoConfig = new CryptoConfig();
encCryptoConfig.setProvider(Merlin.class.getName());
encCryptoConfig.setProp(merlinProp);
RampartConfig rampartConfig = new RampartConfig();
rampartConfig.setEncryptionUser("wso2carbon");
rampartConfig.setUserCertAlias("wso2carbon");
rampartConfig.setPwCbClass(PWCBHandler.class.getName());
rampartConfig.setSigCryptoConfig(sigCryptoConfig);
rampartConfig.setEncrCryptoConfig(encCryptoConfig);
policy.addAssertion(rampartConfig);
Options options = client.getOptions();
options.setProperty(RampartMessageData.KEY_RAMPART_POLICY, policy);
options.setUserName(userName);
options.setPassword(password);
client.engageModule("rampart");
}