resolveKeyValue(secureMsg, keyInfo.getKeyValue(0), sig,context);
} else if (keyInfo.containsX509Data()) {
// resolve X509Data
returnKey = resolveX509Data(secureMsg, keyInfo.getX509Data(0), sig,context);
} else if(keyInfo.containsEncryptedKeyToken()){
EncryptedKeyToken token = keyInfo.getEncryptedKey(0);
KeyInfoHeaderBlock kiHB = token.getKeyInfo();
if(kiHB.containsSecurityTokenReference()){
SecurityTokenReference sectr = kiHB.getSecurityTokenReference(0);
} else {
log.log(Level.SEVERE, LogStringsMessages.WSS_0335_UNSUPPORTED_REFERENCETYPE());
throw new XWSSecurityException("Unsupported reference type under EncryptedKey");
}
//Default algo
//String dataEncAlgo = MessageConstants.AES_BLOCK_ENCRYPTION_128;
//restore backward compatibility
String dataEncAlgo = MessageConstants.DEFAULT_DATA_ENC_ALGO;
if (context.getAlgorithmSuite() != null) {
dataEncAlgo = context.getAlgorithmSuite().getEncryptionAlgorithm();
}else{
if (context.getDataEncryptionAlgorithm() != null){
dataEncAlgo = context.getDataEncryptionAlgorithm();
}
}
returnKey = token.getSecretKey(getKey(kiHB, false, context), dataEncAlgo);
} else if (keyInfo.containsBinarySecret()) {
BinarySecret bs = keyInfo.getBinarySecret(0);
// assuming the Binary Secret is of Type
if ((bs.getType() == null) || bs.getType().equals(BinarySecret.SYMMETRIC_KEY_TYPE)) {
String algo = "AES"; // hardcoding for now