* Translate a list of CXF AlgorithmSuite objects into a single WSS4J AlgorithmSuite object
*/
private AlgorithmSuite translateAlgorithmSuites(
List<org.apache.cxf.ws.security.policy.model.AlgorithmSuite> algorithmSuites
) {
AlgorithmSuite algorithmSuite = null;
for (org.apache.cxf.ws.security.policy.model.AlgorithmSuite cxfAlgorithmSuite
: algorithmSuites) {
if (cxfAlgorithmSuite == null) {
continue;
}
// Translate into WSS4J's AlgorithmSuite class
if (algorithmSuite == null) {
algorithmSuite = new AlgorithmSuite();
}
// Set asymmetric key lengths
if (algorithmSuite.getMaximumAsymmetricKeyLength()
< cxfAlgorithmSuite.getMaximumAsymmetricKeyLength()) {
algorithmSuite.setMaximumAsymmetricKeyLength(
cxfAlgorithmSuite.getMaximumAsymmetricKeyLength());
}
if (algorithmSuite.getMinimumAsymmetricKeyLength()
> cxfAlgorithmSuite.getMinimumAsymmetricKeyLength()) {
algorithmSuite.setMinimumAsymmetricKeyLength(
cxfAlgorithmSuite.getMinimumAsymmetricKeyLength());
}
// Set symmetric key lengths
if (algorithmSuite.getMaximumSymmetricKeyLength()
< cxfAlgorithmSuite.getMaximumSymmetricKeyLength()) {
algorithmSuite.setMaximumSymmetricKeyLength(
cxfAlgorithmSuite.getMaximumSymmetricKeyLength());
}
if (algorithmSuite.getMinimumSymmetricKeyLength()
> cxfAlgorithmSuite.getMinimumSymmetricKeyLength()) {
algorithmSuite.setMinimumSymmetricKeyLength(
cxfAlgorithmSuite.getMinimumSymmetricKeyLength());
}
algorithmSuite.addEncryptionMethod(cxfAlgorithmSuite.getEncryption());
algorithmSuite.addKeyWrapAlgorithm(cxfAlgorithmSuite.getSymmetricKeyWrap());
algorithmSuite.addKeyWrapAlgorithm(cxfAlgorithmSuite.getAsymmetricKeyWrap());
algorithmSuite.addSignatureMethod(cxfAlgorithmSuite.getAsymmetricSignature());
algorithmSuite.addSignatureMethod(cxfAlgorithmSuite.getSymmetricSignature());
algorithmSuite.addDigestAlgorithm(cxfAlgorithmSuite.getDigest());
algorithmSuite.addC14nAlgorithm(cxfAlgorithmSuite.getInclusiveC14n());
algorithmSuite.addTransformAlgorithm(cxfAlgorithmSuite.getInclusiveC14n());
algorithmSuite.addTransformAlgorithm(SPConstants.STRT10);
algorithmSuite.addTransformAlgorithm(WSConstants.NS_XMLDSIG_ENVELOPED_SIGNATURE);
algorithmSuite.addDerivedKeyAlgorithm(SPConstants.P_SHA1);
algorithmSuite.addDerivedKeyAlgorithm(SPConstants.P_SHA1_L128);
}
return algorithmSuite;
}