cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject cxf git commit: [CXF-6085] Prottoyping JWE JSON filters, tests to be added later
Date Mon, 29 Feb 2016 16:46:31 GMT
Repository: cxf
Updated Branches:
  refs/heads/3.0.x-fixes 7a05f5001 -> 5922df4e4


[CXF-6085] Prottoyping JWE JSON filters, tests to be added later


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/5922df4e
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/5922df4e
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/5922df4e

Branch: refs/heads/3.0.x-fixes
Commit: 5922df4e41c29e98d903cc72a7837c50ec6443bc
Parents: 7a05f50
Author: Sergey Beryozkin <sberyozkin@gmail.com>
Authored: Mon Feb 29 16:44:17 2016 +0000
Committer: Sergey Beryozkin <sberyozkin@gmail.com>
Committed: Mon Feb 29 16:45:52 2016 +0000

----------------------------------------------------------------------
 .../jaxrs/AbstractJweJsonDecryptingFilter.java  | 61 ++++++++++++
 .../jaxrs/AbstractJweJsonWriterProvider.java    | 86 +++++++++++++++++
 .../jose/jaxrs/JweJsonClientResponseFilter.java | 46 ++++++++++
 .../jaxrs/JweJsonContainerRequestFilter.java    | 50 ++++++++++
 .../jose/jaxrs/JweJsonWriterInterceptor.java    | 97 ++++++++++++++++++++
 .../cxf/rs/security/jose/jwe/JweUtils.java      | 53 +++++++++++
 6 files changed, 393 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/5922df4e/rt/rs/security/jose-parent/jose-jaxrs/src/main/java/org/apache/cxf/rs/security/jose/jaxrs/AbstractJweJsonDecryptingFilter.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/jose-parent/jose-jaxrs/src/main/java/org/apache/cxf/rs/security/jose/jaxrs/AbstractJweJsonDecryptingFilter.java
b/rt/rs/security/jose-parent/jose-jaxrs/src/main/java/org/apache/cxf/rs/security/jose/jaxrs/AbstractJweJsonDecryptingFilter.java
new file mode 100644
index 0000000..c63e39d
--- /dev/null
+++ b/rt/rs/security/jose-parent/jose-jaxrs/src/main/java/org/apache/cxf/rs/security/jose/jaxrs/AbstractJweJsonDecryptingFilter.java
@@ -0,0 +1,61 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.rs.security.jose.jaxrs;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.nio.charset.StandardCharsets;
+
+import org.apache.cxf.helpers.IOUtils;
+import org.apache.cxf.rs.security.jose.jwe.JweDecryptionOutput;
+import org.apache.cxf.rs.security.jose.jwe.JweDecryptionProvider;
+import org.apache.cxf.rs.security.jose.jwe.JweHeaders;
+import org.apache.cxf.rs.security.jose.jwe.JweJsonConsumer;
+import org.apache.cxf.rs.security.jose.jwe.JweUtils;
+
+public class AbstractJweJsonDecryptingFilter {
+    private JweDecryptionProvider decryption;
+    private String defaultMediaType;
+    protected JweDecryptionOutput decrypt(InputStream is) throws IOException {
+        JweJsonConsumer jwe = new JweJsonConsumer(new String(IOUtils.readBytesFromStream(is),

+                                                                   StandardCharsets.UTF_8));
+        return jwe.decryptWith(getInitializedDecryptionProvider(jwe.getProtectedHeader()));
+    }
+
+    protected void validateHeaders(JweHeaders headers) {
+        // complete
+    }
+    public void setDecryptionProvider(JweDecryptionProvider decryptor) {
+        this.decryption = decryptor;
+    }
+    protected JweDecryptionProvider getInitializedDecryptionProvider(JweHeaders headers)
{
+        if (decryption != null) {
+            return decryption;    
+        } 
+        return JweUtils.loadDecryptionProvider(headers, true);
+    }
+    public String getDefaultMediaType() {
+        return defaultMediaType;
+    }
+
+    public void setDefaultMediaType(String defaultMediaType) {
+        this.defaultMediaType = defaultMediaType;
+    } 
+    
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/5922df4e/rt/rs/security/jose-parent/jose-jaxrs/src/main/java/org/apache/cxf/rs/security/jose/jaxrs/AbstractJweJsonWriterProvider.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/jose-parent/jose-jaxrs/src/main/java/org/apache/cxf/rs/security/jose/jaxrs/AbstractJweJsonWriterProvider.java
b/rt/rs/security/jose-parent/jose-jaxrs/src/main/java/org/apache/cxf/rs/security/jose/jaxrs/AbstractJweJsonWriterProvider.java
new file mode 100644
index 0000000..ce9d2cb
--- /dev/null
+++ b/rt/rs/security/jose-parent/jose-jaxrs/src/main/java/org/apache/cxf/rs/security/jose/jaxrs/AbstractJweJsonWriterProvider.java
@@ -0,0 +1,86 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.rs.security.jose.jaxrs;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.logging.Logger;
+
+import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.common.util.StringUtils;
+import org.apache.cxf.helpers.CastUtils;
+import org.apache.cxf.helpers.IOUtils;
+import org.apache.cxf.jaxrs.utils.JAXRSUtils;
+import org.apache.cxf.message.Message;
+import org.apache.cxf.message.MessageUtils;
+import org.apache.cxf.rs.security.jose.common.JoseConstants;
+import org.apache.cxf.rs.security.jose.jwe.JweEncryptionProvider;
+import org.apache.cxf.rs.security.jose.jwe.JweUtils;
+import org.apache.cxf.rs.security.jose.jws.JwsException;
+import org.apache.cxf.rs.security.jose.jws.JwsJsonProducer;
+
+public class AbstractJweJsonWriterProvider {
+    protected static final Logger LOG = LogUtils.getL7dLogger(AbstractJweJsonWriterProvider.class);
+    
+    private List<JweEncryptionProvider> encProviders;
+    
+    public void setEncryptionProvider(JweEncryptionProvider provider) {
+        setEncryptionProviders(Collections.singletonList(provider));
+    }
+    public void setEncryptionProviders(List<JweEncryptionProvider> providers) {
+        this.encProviders = providers;
+    }
+    
+    protected List<JweEncryptionProvider> getInitializedEncryptionProviders() {
+        if (encProviders != null) {
+            return encProviders;    
+        } 
+        Message m = JAXRSUtils.getCurrentMessage();
+        Object propLocsProp = 
+            MessageUtils.getContextualProperty(m, JoseConstants.RSSEC_ENCRYPTION_OUT_PROPS,

+                                               JoseConstants.RSSEC_ENCRYPTION_PROPS);
+        if (propLocsProp == null) {
+            LOG.warning("JWE JSON init properties resource is not identified");
+            throw new JwsException(JwsException.Error.NO_INIT_PROPERTIES);
+        }
+        List<String> propLocs = null;
+        if (propLocsProp instanceof String) {
+            String[] props = ((String)propLocsProp).split(",");
+            propLocs = Arrays.asList(props);
+        } else {
+            propLocs = CastUtils.cast((List<?>)propLocsProp);
+        }
+        List<JweEncryptionProvider> theEncProviders = new LinkedList<JweEncryptionProvider>();
+        for (String propLoc : propLocs) {
+            theEncProviders.addAll(JweUtils.loadJweEncryptionProviders(propLoc, m));
+        }
+        return theEncProviders;
+    }
+    protected void writeJws(JwsJsonProducer p, OutputStream os) 
+        throws IOException {
+        byte[] bytes = StringUtils.toBytesUTF8(p.getJwsJsonSignedDocument());
+        IOUtils.copy(new ByteArrayInputStream(bytes), os);
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/5922df4e/rt/rs/security/jose-parent/jose-jaxrs/src/main/java/org/apache/cxf/rs/security/jose/jaxrs/JweJsonClientResponseFilter.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/jose-parent/jose-jaxrs/src/main/java/org/apache/cxf/rs/security/jose/jaxrs/JweJsonClientResponseFilter.java
b/rt/rs/security/jose-parent/jose-jaxrs/src/main/java/org/apache/cxf/rs/security/jose/jaxrs/JweJsonClientResponseFilter.java
new file mode 100644
index 0000000..cb48b95
--- /dev/null
+++ b/rt/rs/security/jose-parent/jose-jaxrs/src/main/java/org/apache/cxf/rs/security/jose/jaxrs/JweJsonClientResponseFilter.java
@@ -0,0 +1,46 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.rs.security.jose.jaxrs;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+
+import javax.annotation.Priority;
+import javax.ws.rs.client.ClientRequestContext;
+import javax.ws.rs.client.ClientResponseContext;
+import javax.ws.rs.client.ClientResponseFilter;
+
+import org.apache.cxf.rs.security.jose.common.JoseUtils;
+import org.apache.cxf.rs.security.jose.jwe.JweDecryptionOutput;
+
+@Priority(Priorities.JWE_CLIENT_READ_PRIORITY)
+public class JweJsonClientResponseFilter extends AbstractJweJsonDecryptingFilter implements
ClientResponseFilter {
+    @Override
+    public void filter(ClientRequestContext req, ClientResponseContext res) throws IOException
{
+        JweDecryptionOutput out = decrypt(res.getEntityStream());
+        byte[] bytes = out.getContent();
+        res.setEntityStream(new ByteArrayInputStream(bytes));
+        res.getHeaders().putSingle("Content-Length", Integer.toString(bytes.length));
+        String ct = JoseUtils.checkContentType(out.getHeaders().getContentType(), getDefaultMediaType());
+        if (ct != null) {
+            res.getHeaders().putSingle("Content-Type", ct);
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/5922df4e/rt/rs/security/jose-parent/jose-jaxrs/src/main/java/org/apache/cxf/rs/security/jose/jaxrs/JweJsonContainerRequestFilter.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/jose-parent/jose-jaxrs/src/main/java/org/apache/cxf/rs/security/jose/jaxrs/JweJsonContainerRequestFilter.java
b/rt/rs/security/jose-parent/jose-jaxrs/src/main/java/org/apache/cxf/rs/security/jose/jaxrs/JweJsonContainerRequestFilter.java
new file mode 100644
index 0000000..1b6ab90
--- /dev/null
+++ b/rt/rs/security/jose-parent/jose-jaxrs/src/main/java/org/apache/cxf/rs/security/jose/jaxrs/JweJsonContainerRequestFilter.java
@@ -0,0 +1,50 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.rs.security.jose.jaxrs;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+
+import javax.annotation.Priority;
+import javax.ws.rs.HttpMethod;
+import javax.ws.rs.container.ContainerRequestContext;
+import javax.ws.rs.container.ContainerRequestFilter;
+import javax.ws.rs.container.PreMatching;
+
+import org.apache.cxf.rs.security.jose.common.JoseUtils;
+import org.apache.cxf.rs.security.jose.jwe.JweDecryptionOutput;
+
+@PreMatching
+@Priority(Priorities.JWE_SERVER_READ_PRIORITY)
+public class JweJsonContainerRequestFilter extends AbstractJweJsonDecryptingFilter implements
ContainerRequestFilter {
+    @Override
+    public void filter(ContainerRequestContext context) throws IOException {
+        if (HttpMethod.GET.equals(context.getMethod())) {
+            return;
+        }
+        JweDecryptionOutput out = decrypt(context.getEntityStream());
+        byte[] bytes = out.getContent();
+        context.setEntityStream(new ByteArrayInputStream(bytes));
+        context.getHeaders().putSingle("Content-Length", Integer.toString(bytes.length));
+        String ct = JoseUtils.checkContentType(out.getHeaders().getContentType(), getDefaultMediaType());
+        if (ct != null) {
+            context.getHeaders().putSingle("Content-Type", ct);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/5922df4e/rt/rs/security/jose-parent/jose-jaxrs/src/main/java/org/apache/cxf/rs/security/jose/jaxrs/JweJsonWriterInterceptor.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/jose-parent/jose-jaxrs/src/main/java/org/apache/cxf/rs/security/jose/jaxrs/JweJsonWriterInterceptor.java
b/rt/rs/security/jose-parent/jose-jaxrs/src/main/java/org/apache/cxf/rs/security/jose/jaxrs/JweJsonWriterInterceptor.java
new file mode 100644
index 0000000..4568806
--- /dev/null
+++ b/rt/rs/security/jose-parent/jose-jaxrs/src/main/java/org/apache/cxf/rs/security/jose/jaxrs/JweJsonWriterInterceptor.java
@@ -0,0 +1,97 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.rs.security.jose.jaxrs;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.List;
+
+import javax.annotation.Priority;
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.ext.WriterInterceptor;
+import javax.ws.rs.ext.WriterInterceptorContext;
+
+import org.apache.cxf.common.util.StringUtils;
+import org.apache.cxf.helpers.IOUtils;
+import org.apache.cxf.io.CachedOutputStream;
+import org.apache.cxf.jaxrs.utils.JAXRSUtils;
+import org.apache.cxf.rs.security.jose.common.JoseConstants;
+import org.apache.cxf.rs.security.jose.jwa.ContentAlgorithm;
+import org.apache.cxf.rs.security.jose.jwe.JweEncryptionProvider;
+import org.apache.cxf.rs.security.jose.jwe.JweHeaders;
+import org.apache.cxf.rs.security.jose.jwe.JweJsonProducer;
+
+@Priority(Priorities.JWE_WRITE_PRIORITY)
+public class JweJsonWriterInterceptor extends AbstractJweJsonWriterProvider implements WriterInterceptor
{
+    private boolean contentTypeRequired = true;
+    private boolean useJweOutputStream;
+    @Override
+    public void aroundWriteTo(WriterInterceptorContext ctx) throws IOException, WebApplicationException
{
+        if (ctx.getEntity() == null) {
+            ctx.proceed();
+            return;
+        }
+        OutputStream actualOs = ctx.getOutputStream();
+        List<JweEncryptionProvider> providers = getInitializedEncryptionProviders();
+        
+        String ctString = null;
+        MediaType contentMediaType = ctx.getMediaType();
+        if (contentTypeRequired && contentMediaType != null) {
+            if ("application".equals(contentMediaType.getType())) {
+                ctString = contentMediaType.getSubtype();
+            } else {
+                ctString = JAXRSUtils.mediaTypeToString(contentMediaType);
+            }
+        }
+        JweHeaders protectedHeaders = new JweHeaders(ContentAlgorithm.A128GCM);
+        if (ctString != null) {
+            protectedHeaders.setContentType(ctString);
+        }
+        
+        if (useJweOutputStream) {
+            //TODO
+        } else {
+            CachedOutputStream cos = new CachedOutputStream(); 
+            ctx.setOutputStream(cos);
+            ctx.proceed();
+            
+            JweJsonProducer producer = new JweJsonProducer(protectedHeaders, cos.getBytes());
+            String jweContent = producer.encryptWith(providers);
+            
+            setJoseMediaType(ctx);
+            IOUtils.copy(new ByteArrayInputStream(StringUtils.toBytesUTF8(jweContent)), 
+                         actualOs);
+            actualOs.flush();
+        }
+    }
+    
+    private void setJoseMediaType(WriterInterceptorContext ctx) {
+        MediaType joseMediaType = JAXRSUtils.toMediaType(JoseConstants.MEDIA_TYPE_JOSE_JSON);
+        ctx.setMediaType(joseMediaType);
+    }
+    
+    public void setUseJweOutputStream(boolean useJweOutputStream) {
+        this.useJweOutputStream = useJweOutputStream;
+    }
+
+    
+    
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/5922df4e/rt/rs/security/jose-parent/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/JweUtils.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/jose-parent/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/JweUtils.java
b/rt/rs/security/jose-parent/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/JweUtils.java
index 365c312..ccfbfdc 100644
--- a/rt/rs/security/jose-parent/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/JweUtils.java
+++ b/rt/rs/security/jose-parent/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/JweUtils.java
@@ -28,6 +28,7 @@ import java.security.interfaces.ECPublicKey;
 import java.security.interfaces.RSAKey;
 import java.security.interfaces.RSAPrivateKey;
 import java.security.interfaces.RSAPublicKey;
+import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.List;
@@ -436,6 +437,50 @@ public final class JweUtils {
         return createJweDecryptionProvider(keyDecryptionProvider, ctDecryptionKey, 
                                            getContentAlgo(contentEncryptionAlgo));
     }
+    public static List<JweEncryptionProvider> loadJweEncryptionProviders(String propLoc,
Message m) {
+        Properties props = loadJweProperties(m, propLoc);
+        JweEncryptionProvider theEncProvider = loadEncryptionProvider(props, null, false);
+        if (theEncProvider != null) {
+            return Collections.singletonList(theEncProvider);
+        }
+        List<JweEncryptionProvider> theEncProviders = null; 
+        if (JoseConstants.HEADER_JSON_WEB_KEY.equals(props.get(JoseConstants.RSSEC_KEY_STORE_TYPE)))
{
+            List<JsonWebKey> jwks = JwkUtils.loadJsonWebKeys(m, props, KeyOperation.ENCRYPT);
+            if (jwks != null) {
+                theEncProviders = new ArrayList<JweEncryptionProvider>(jwks.size());
+                for (JsonWebKey jwk : jwks) {
+                    theEncProviders.add(getDirectKeyJweEncryption(jwk));
+                }
+            }
+        }
+        if (theEncProviders == null) {
+            LOG.warning("Providers are not available");
+            throw new JweException(JweException.Error.NO_ENCRYPTOR);
+        }
+        return theEncProviders;
+    }
+    public static List<JweDecryptionProvider> loadJweDecryptionProviders(String propLoc,
Message m) {
+        Properties props = loadJweProperties(m, propLoc);
+        JweDecryptionProvider theDecProvider = loadDecryptionProvider(props, null, false);
+        if (theDecProvider != null) {
+            return Collections.singletonList(theDecProvider);
+        }
+        List<JweDecryptionProvider> theDecProviders = null; 
+        if (JoseConstants.HEADER_JSON_WEB_KEY.equals(props.get(JoseConstants.RSSEC_KEY_STORE_TYPE)))
{
+            List<JsonWebKey> jwks = JwkUtils.loadJsonWebKeys(m, props, KeyOperation.DECRYPT);
+            if (jwks != null) {
+                theDecProviders = new ArrayList<JweDecryptionProvider>(jwks.size());
+                for (JsonWebKey jwk : jwks) {
+                    theDecProviders.add(getDirectKeyJweDecryption(jwk));
+                }
+            }
+        }
+        if (theDecProviders == null) {
+            LOG.warning("Providers are not available");
+            throw new JweException(JweException.Error.NO_ENCRYPTOR);
+        }
+        return theDecProviders;
+    }
     public static JweEncryptionProvider createJweEncryptionProvider(PublicKey key,
                                                                     KeyAlgorithm keyAlgo,
                                                                     ContentAlgorithm contentEncryptionAlgo,
@@ -739,4 +784,12 @@ public final class JweUtils {
             return new JsonWebKeys(jwk);
         }
     }
+    private static Properties loadJweProperties(Message m, String propLoc) {
+        try {
+            return JoseUtils.loadProperties(propLoc, m.getExchange().getBus());
+        } catch (Exception ex) {
+            LOG.warning("JWS init properties are not available");
+            throw new JweException(JweException.Error.NO_INIT_PROPERTIES);
+        }
+    }
 }


Mime
View raw message