Search in sources :

Example 1 with JweJsonEncryptionEntry

use of org.apache.cxf.rs.security.jose.jwe.JweJsonEncryptionEntry in project cxf by apache.

the class AbstractJweJsonDecryptingFilter method decrypt.

protected JweDecryptionOutput decrypt(InputStream is) throws IOException {
    JweJsonConsumer c = new JweJsonConsumer(new String(IOUtils.readBytesFromStream(is), StandardCharsets.UTF_8));
    JweDecryptionProvider theProvider = getInitializedDecryptionProvider(c.getProtectedHeader());
    JweJsonEncryptionEntry entry = c.getJweDecryptionEntry(theProvider, recipientProperties);
    if (entry == null) {
        throw new JweException(JweException.Error.INVALID_JSON_JWE);
    }
    JweDecryptionOutput out = c.decryptWith(theProvider, entry);
    JAXRSUtils.getCurrentMessage().put(JweJsonConsumer.class, c);
    JAXRSUtils.getCurrentMessage().put(JweJsonEncryptionEntry.class, entry);
    return out;
}
Also used : JweDecryptionOutput(org.apache.cxf.rs.security.jose.jwe.JweDecryptionOutput) JweException(org.apache.cxf.rs.security.jose.jwe.JweException) JweJsonConsumer(org.apache.cxf.rs.security.jose.jwe.JweJsonConsumer) JweDecryptionProvider(org.apache.cxf.rs.security.jose.jwe.JweDecryptionProvider) JweJsonEncryptionEntry(org.apache.cxf.rs.security.jose.jwe.JweJsonEncryptionEntry)

Aggregations

JweDecryptionOutput (org.apache.cxf.rs.security.jose.jwe.JweDecryptionOutput)1 JweDecryptionProvider (org.apache.cxf.rs.security.jose.jwe.JweDecryptionProvider)1 JweException (org.apache.cxf.rs.security.jose.jwe.JweException)1 JweJsonConsumer (org.apache.cxf.rs.security.jose.jwe.JweJsonConsumer)1 JweJsonEncryptionEntry (org.apache.cxf.rs.security.jose.jwe.JweJsonEncryptionEntry)1