本文整理汇总了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");
}