use of org.apache.cxf.rs.security.xml.EncryptionProperties in project cxf by apache.
the class JAXRSXmlSecTest method testPostEncryptedSignedBookInvalid.
@Test
public void testPostEncryptedSignedBookInvalid() throws Exception {
String address = "https://localhost:" + test.port + "/xmlsec-validate/bookstore/books";
Map<String, Object> properties = new HashMap<>();
properties.put(SecurityConstants.CALLBACK_HANDLER, "org.apache.cxf.systest.jaxrs.security.saml.KeystorePasswordCallback");
properties.put(SecurityConstants.ENCRYPT_USERNAME, "bob");
properties.put(SecurityConstants.ENCRYPT_PROPERTIES, "org/apache/cxf/systest/jaxrs/security/bob.properties");
properties.put(SecurityConstants.SIGNATURE_USERNAME, "alice");
properties.put(SecurityConstants.SIGNATURE_PROPERTIES, "org/apache/cxf/systest/jaxrs/security/alice.properties");
EncryptionProperties encryptionProperties = new EncryptionProperties();
encryptionProperties.setEncryptionSymmetricKeyAlgo("http://www.w3.org/2009/xmlenc11#aes128-gcm");
encryptionProperties.setEncryptionKeyIdType(RSSecurityUtils.X509_CERT);
try {
doTestPostEncryptedBook(address, true, properties, encryptionProperties, true, test.streaming);
} catch (BadRequestException ex) {
assertEquals(400, ex.getResponse().getStatus());
}
}
use of org.apache.cxf.rs.security.xml.EncryptionProperties in project cxf by apache.
the class JAXRSXmlSecTest method doTestPostEncryptedBook.
public void doTestPostEncryptedBook(String address, boolean sign, Map<String, Object> properties, boolean streaming) throws Exception {
EncryptionProperties encryptionProperties = new EncryptionProperties();
encryptionProperties.setEncryptionSymmetricKeyAlgo(XMLCipher.AES_128);
encryptionProperties.setEncryptionKeyIdType(RSSecurityUtils.X509_CERT);
doTestPostEncryptedBook(address, sign, properties, encryptionProperties, false, test.streaming);
}
use of org.apache.cxf.rs.security.xml.EncryptionProperties in project cxf by apache.
the class JAXRSXmlSecTest method testPostEncryptedBookSHA256.
@Test
public void testPostEncryptedBookSHA256() throws Exception {
String address = "https://localhost:" + test.port + "/xmlenc/bookstore/books";
Map<String, Object> properties = new HashMap<>();
properties.put(SecurityConstants.CALLBACK_HANDLER, "org.apache.cxf.systest.jaxrs.security.saml.KeystorePasswordCallback");
properties.put(SecurityConstants.ENCRYPT_USERNAME, "bob");
properties.put(SecurityConstants.ENCRYPT_PROPERTIES, "org/apache/cxf/systest/jaxrs/security/bob.properties");
EncryptionProperties encryptionProperties = new EncryptionProperties();
encryptionProperties.setEncryptionSymmetricKeyAlgo(XMLCipher.AES_128);
encryptionProperties.setEncryptionKeyIdType(RSSecurityUtils.X509_CERT);
encryptionProperties.setEncryptionDigestAlgo(XMLCipher.SHA256);
doTestPostEncryptedBook(address, false, properties, encryptionProperties, false, test.streaming);
}
use of org.apache.cxf.rs.security.xml.EncryptionProperties in project cxf by apache.
the class JAXRSXmlSecTest method testPostEncryptedBookIssuerSerial.
@Test
public void testPostEncryptedBookIssuerSerial() throws Exception {
String address = "https://localhost:" + test.port + "/xmlenc/bookstore/books";
Map<String, Object> properties = new HashMap<>();
properties.put(SecurityConstants.CALLBACK_HANDLER, "org.apache.cxf.systest.jaxrs.security.saml.KeystorePasswordCallback");
properties.put(SecurityConstants.ENCRYPT_USERNAME, "bob");
properties.put(SecurityConstants.ENCRYPT_PROPERTIES, "org/apache/cxf/systest/jaxrs/security/bob.properties");
EncryptionProperties encryptionProperties = new EncryptionProperties();
encryptionProperties.setEncryptionSymmetricKeyAlgo(XMLCipher.AES_128);
encryptionProperties.setEncryptionKeyIdType(RSSecurityUtils.X509_ISSUER_SERIAL);
doTestPostEncryptedBook(address, false, properties, encryptionProperties, false, test.streaming);
}
use of org.apache.cxf.rs.security.xml.EncryptionProperties in project cxf by apache.
the class JAXRSXmlSecTest method testPostEncryptedBookGCM.
@Test
public void testPostEncryptedBookGCM() throws Exception {
String address = "https://localhost:" + test.port + "/xmlenc/bookstore/books";
Map<String, Object> properties = new HashMap<>();
properties.put(SecurityConstants.CALLBACK_HANDLER, "org.apache.cxf.systest.jaxrs.security.saml.KeystorePasswordCallback");
properties.put(SecurityConstants.ENCRYPT_USERNAME, "bob");
properties.put(SecurityConstants.ENCRYPT_PROPERTIES, "org/apache/cxf/systest/jaxrs/security/bob.properties");
EncryptionProperties encryptionProperties = new EncryptionProperties();
String aes128GCM = "http://www.w3.org/2009/xmlenc11#aes128-gcm";
encryptionProperties.setEncryptionSymmetricKeyAlgo(aes128GCM);
encryptionProperties.setEncryptionKeyIdType(RSSecurityUtils.X509_CERT);
doTestPostEncryptedBook(address, false, properties, encryptionProperties, false, test.streaming);
}
Aggregations