}
return new JAXBEncryptedData(edt,attachData,key,soapVersion);
}
public EncryptedHeader createEncryptedHeader(String ehId, String edId,Data data,String dataAlgo,KeyInfoType keyInfo,Key key,boolean contentOnly){
EncryptedHeaderType eht = new EncryptedHeaderType();
EncryptedDataType edt = new EncryptedDataType();
if(contentOnly){
// TODO: not valid, need to throw exception here
edt.setType(MessageConstants.ENCRYPT_ELEMENT_CONTENT);
}else{
edt.setType(MessageConstants.ENCRYPT_ELEMENT);
}
EncryptionMethodType emt = new EncryptionMethodType();
emt.setAlgorithm(dataAlgo);
edt.setEncryptionMethod(emt);
CipherDataType ct = new CipherDataType();
ct.setCipherValue("ed".getBytes());
edt.setCipherData(ct);
edt.setId(edId);
if(keyInfo != null){
edt.setKeyInfo(keyInfo);
}
eht.setEncryptedData(edt);
eht.setId(ehId);
if(soapVersion == SOAPVersion.SOAP_11) {
eht.setMustUnderstand(true);
}else if(soapVersion == SOAPVersion.SOAP_12){
eht.setMustUnderstand12(true);
}
EncryptedHeader eh = new EncryptedHeader(eht, data, key, soapVersion);
return eh;
}