/** {@inheritDoc} */ public String getKeyTransportEncryptionAlgorithmURI(Credential credential, String wrappedKeyAlgorithm) { Key key = SecurityHelper.extractEncryptionKey(credential); if (key == null) { log.debug("Could not extract key transport encryption key from credential, unable to map to algorithm URI"); return null; } else if (key.getAlgorithm() == null){ log.debug("Key transport encryption key algorithm value was not available, unable to map to algorithm URI"); return null; } Integer length = SecurityHelper.getKeyLength(key); return getKeyTransportEncryptionAlgorithmURI(key.getAlgorithm(), length, wrappedKeyAlgorithm); }
/** {@inheritDoc} */ public String getDataEncryptionAlgorithmURI(Credential credential) { Key key = SecurityHelper.extractEncryptionKey(credential); if (key == null) { log.debug("Could not extract data encryption key from credential, unable to map to algorithm URI"); return null; } else if (key.getAlgorithm() == null){ log.debug("Data encryption key algorithm value was not available, unable to map to algorithm URI"); return null; } Integer length = SecurityHelper.getKeyLength(key); return getDataEncryptionAlgorithmURI(key.getAlgorithm(), length); }
/** {@inheritDoc} */ public String getDataEncryptionAlgorithmURI(Credential credential) { Key key = SecurityHelper.extractEncryptionKey(credential); if (key == null) { log.debug("Could not extract data encryption key from credential, unable to map to algorithm URI"); return null; } else if (key.getAlgorithm() == null){ log.debug("Data encryption key algorithm value was not available, unable to map to algorithm URI"); return null; } Integer length = SecurityHelper.getKeyLength(key); return getDataEncryptionAlgorithmURI(key.getAlgorithm(), length); }
/** {@inheritDoc} */ public String getKeyTransportEncryptionAlgorithmURI(Credential credential, String wrappedKeyAlgorithm) { Key key = SecurityHelper.extractEncryptionKey(credential); if (key == null) { log.debug("Could not extract key transport encryption key from credential, unable to map to algorithm URI"); return null; } else if (key.getAlgorithm() == null){ log.debug("Key transport encryption key algorithm value was not available, unable to map to algorithm URI"); return null; } Integer length = SecurityHelper.getKeyLength(key); return getKeyTransportEncryptionAlgorithmURI(key.getAlgorithm(), length, wrappedKeyAlgorithm); }
/** * Check the encryption parameters and key encryption parameters for valid combinations of options. * * @param encParams the encryption parameters to use * @param kekParamsList the key encryption parameters to use * @throws EncryptionException exception thrown on encryption errors */ protected void checkParams(EncryptionParameters encParams, List<KeyEncryptionParameters> kekParamsList) throws EncryptionException { checkParams(encParams); checkParams(kekParamsList, true); if (SecurityHelper.extractEncryptionKey(encParams.getEncryptionCredential()) == null && (kekParamsList == null || kekParamsList.isEmpty())) { log.error("Using a generated encryption key requires a KeyEncryptionParameters " + "object and key encryption key"); throw new EncryptionException("Using a generated encryption key requires a KeyEncryptionParameters " + "object and key encryption key"); } }
/** * Check the encryption parameters and key encryption parameters for valid combinations of options. * * @param encParams the encryption parameters to use * @param kekParamsList the key encryption parameters to use * @throws EncryptionException exception thrown on encryption errors */ protected void checkParams(EncryptionParameters encParams, List<KeyEncryptionParameters> kekParamsList) throws EncryptionException { checkParams(encParams); checkParams(kekParamsList, true); if (SecurityHelper.extractEncryptionKey(encParams.getEncryptionCredential()) == null && (kekParamsList == null || kekParamsList.isEmpty())) { log.error("Using a generated encryption key requires a KeyEncryptionParameters " + "object and key encryption key"); throw new EncryptionException("Using a generated encryption key requires a KeyEncryptionParameters " + "object and key encryption key"); } }
Key key = SecurityHelper.extractEncryptionKey(kekParams.getEncryptionCredential()); if (key == null) { log.error("Key encryption credential and contained key are required");
Key key = SecurityHelper.extractEncryptionKey(kekParams.getEncryptionCredential()); if (key == null) { log.error("Key encryption credential and contained key are required");
Key encryptionKey = SecurityHelper.extractEncryptionKey(encParams.getEncryptionCredential()); if (encryptionKey == null) { encryptionKey = generateEncryptionKey(encryptionAlgorithmURI);
Key encryptionKey = SecurityHelper.extractEncryptionKey(kekParams.getEncryptionCredential()); String encryptionAlgorithmURI = kekParams.getAlgorithm();
Key encryptionKey = SecurityHelper.extractEncryptionKey(kekParams.getEncryptionCredential()); String encryptionAlgorithmURI = kekParams.getAlgorithm();
Key encryptionKey = SecurityHelper.extractEncryptionKey(encParams.getEncryptionCredential()); if (encryptionKey == null) { encryptionKey = generateEncryptionKey(encryptionAlgorithmURI);
Key encryptionKey = SecurityHelper.extractEncryptionKey(encParams.getEncryptionCredential()); if (encryptionKey == null) { encryptionKey = generateEncryptionKey(encryptionAlgorithmURI);