WSSecEncrypt builder = new WSSecEncrypt();
builder.setKeyIdentifierType(WSConstants.THUMBPRINT_IDENTIFIER);
builder.setUserInfo("receiver");
Crypto crypto = CryptoFactory.getInstance("transmitter-crypto.properties");
builder.prepare(doc, crypto);
WSEncryptionPart encP = new WSEncryptionPart("definitions", "http://schemas.xmlsoap.org/wsdl/", "Element");
List<WSEncryptionPart> encryptionParts = new ArrayList<WSEncryptionPart>();
encryptionParts.add(encP);
Element ref = builder.encryptForRef(null, encryptionParts);