Examples of KeyProperties


Examples of org.apache.cxf.rs.security.oauth2.utils.crypto.KeyProperties

    protected SecretKey key;
    private Set<String> tokens = Collections.synchronizedSet(new HashSet<String>());
    private ConcurrentHashMap<String, String> refreshTokens = new ConcurrentHashMap<String, String>();
    private ConcurrentHashMap<String, String> clientsMap = new ConcurrentHashMap<String, String>();
    public DefaultEncryptingOAuthDataProvider(String algo, int keySize) {
        this(new KeyProperties(algo, keySize));
    }
View Full Code Here

Examples of org.apache.cxf.rs.security.oauth2.utils.crypto.KeyProperties

            throw new SecurityException();
        }
        return theCek;
    }
    protected byte[] getEncryptedContentEncryptionKey(byte[] theCek) {
        KeyProperties secretKeyProperties = new KeyProperties(getContentEncryptionKeyEncryptionAlgo());
        if (!wrap) {
            return CryptoUtils.encryptBytes(theCek, cekEncryptionKey, secretKeyProperties);
        } else {
            return CryptoUtils.wrapSecretKey(theCek, getContentEncryptionAlgoJava(), cekEncryptionKey,
                                             secretKeyProperties.getKeyAlgo());
        }
    }
View Full Code Here

Examples of org.apache.cxf.rs.security.oauth2.utils.crypto.KeyProperties

    }
   
    protected JweDecryptionOutput doDecrypt(JweCompactConsumer consumer) {
        consumer.enforceJweCryptoProperties(props);
        byte[] cek = getContentEncryptionKey(consumer);
        KeyProperties keyProperties = new KeyProperties(getContentEncryptionAlgorithm(consumer));
        keyProperties.setAdditionalData(getContentEncryptionCipherAAD(consumer));
        AlgorithmParameterSpec spec = getContentEncryptionCipherSpec(consumer);
        keyProperties.setAlgoSpec(spec);
        boolean compressionSupported =
            JwtConstants.DEFLATE_ZIP_ALGORITHM.equals(consumer.getJweHeaders().getZipAlgorithm());
        keyProperties.setCompressionSupported(compressionSupported);
        Key secretKey = CryptoUtils.createSecretKeySpec(cek, keyProperties.getKeyAlgo());
        byte[] bytes =
            CryptoUtils.decryptBytes(getEncryptedContentWithAuthTag(consumer), secretKey, keyProperties);
        return new JweDecryptionOutput(consumer.getJweHeaders(), bytes);
    }
View Full Code Here

Examples of org.apache.cxf.rs.security.oauth2.utils.crypto.KeyProperties

        super(props, reader);
        this.cekDecryptionKey = cekDecryptionKey;
        this.unwrap = unwrap;
    }
    protected byte[] getContentEncryptionKey(JweCompactConsumer consumer) {
        KeyProperties keyProps = new KeyProperties(getKeyEncryptionAlgorithm(consumer));
        if (!unwrap) {
            keyProps.setBlockSize(getKeyCipherBlockSize());
            return CryptoUtils.decryptBytes(getEncryptedContentEncryptionKey(consumer),
                                            getCekDecryptionKey(), keyProps);
        } else {
            return CryptoUtils.unwrapSecretKey(getEncryptedContentEncryptionKey(consumer),
                                               getContentEncryptionAlgorithm(consumer),
View Full Code Here

Examples of org.apache.cxf.rs.security.oauth2.utils.crypto.KeyProperties

            theHeaders.setContentType(contentType);
        }
       
        byte[] theCek = getContentEncryptionKey();
        String contentEncryptionAlgoJavaName = Algorithm.toJavaName(theHeaders.getContentEncryptionAlgorithm());
        KeyProperties keyProps = new KeyProperties(contentEncryptionAlgoJavaName);
        keyProps.setCompressionSupported(compressionRequired(theHeaders));
        byte[] additionalEncryptionParam = theHeaders.toCipherAdditionalAuthData(writer);
        keyProps.setAdditionalData(additionalEncryptionParam);
       
        byte[] theIv = getContentEncryptionCipherInitVector();
        AlgorithmParameterSpec specParams = getContentEncryptionCipherSpec(theIv);
        keyProps.setAlgoSpec(specParams);
        byte[] jweContentEncryptionKey = getEncryptedContentEncryptionKey(theCek);
        JweEncryptionInternal state = new JweEncryptionInternal();
        state.theHeaders = theHeaders;
        state.jweContentEncryptionKey = jweContentEncryptionKey;
        state.keyProps = keyProps;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.