Iterator childIter = apacheEncryptedKey.getEncryptionMethod().getEncryptionMethodInformation(); while (childIter.hasNext()) { Element child = (Element) childIter.next(); digestMethodElem.setAttributeNS(null, DigestMethod.ALGORITHM_ATTRIB_NAME, SignatureConstants.ALGO_ID_DIGEST_SHA1); apacheEncryptedKey.getEncryptionMethod().addEncryptionMethodInformation(digestMethodElem);
result.setId(element.getAttributeNS(null, EncryptionConstants._ATT_ID)); result.setType(element.getAttributeNS(null, EncryptionConstants._ATT_TYPE)); result.setMimeType(element.getAttributeNS(null, EncryptionConstants._ATT_MIMETYPE)); result.setEncoding(element.getAttributeNS(null, Constants._ATT_ENCODING)); result.setRecipient(element.getAttributeNS(null, EncryptionConstants._ATT_RECIPIENT)); EncryptionConstants._TAG_ENCRYPTIONMETHOD).item(0); if (null != encryptionMethodElement) { result.setEncryptionMethod(newEncryptionMethod(encryptionMethodElement)); if (null != keyInfoElement) { KeyInfo ki = newKeyInfo(keyInfoElement); result.setKeyInfo(ki); EncryptionConstants._TAG_ENCRYPTIONPROPERTIES).item(0); if (null != encryptionPropertiesElement) { result.setEncryptionProperties( newEncryptionProperties(encryptionPropertiesElement) ); EncryptionConstants._TAG_REFERENCELIST).item(0); if (null != referenceListElement) { result.setReferenceList(newReferenceList(referenceListElement)); EncryptionConstants._TAG_CARRIEDKEYNAME).item(0); if (null != carriedNameElement) { result.setCarriedName(carriedNameElement.getFirstChild().getNodeValue());
LOG.debug("Trying to find a KEK via key resolvers"); KeyInfo ki = encryptedKey.getKeyInfo(); if (ki != null) { ki.setSecureValidation(secureValidation); try { String keyWrapAlg = encryptedKey.getEncryptionMethod().getAlgorithm(); String keyType = JCEMapper.getJCEKeyAlgorithmFromURI(keyWrapAlg); if ("RSA".equals(keyType) || "EC".equals(keyType)) { encryptedKey.getEncryptionMethod().getAlgorithm(), encryptedKey.getEncryptionMethod().getDigestAlgorithm() ); } else { EncryptionMethod encMethod = encryptedKey.getEncryptionMethod(); OAEPParameterSpec oaepParameters = constructOAEPParameters(
xData.addIssuerSerial(cer.getIssuerDN().getName(), cer.getSerialNumber()); kiEnc.add(xData); key.setKeyInfo(kiEnc);
LOG.debug("Encrypted key octets length = {}", base64EncodedEncryptedOctets.length()); CipherValue cv = ek.getCipherData().getCipherValue(); cv.setValue(base64EncodedEncryptedOctets); method.setMGFAlgorithm(mgfAlgorithm); method.setOAEPparams(oaepParams); ek.setEncryptionMethod(method); } catch (URISyntaxException ex) { throw new XMLEncryptionException(ex);
xData.addIssuerSerial(cer.getIssuerDN().getName(), cer.getSerialNumber()); kiEnc.add(xData); key.setKeyInfo(kiEnc);
Iterator childIter = apacheEncryptedKey.getEncryptionMethod().getEncryptionMethodInformation(); while (childIter.hasNext()) { Element child = (Element) childIter.next(); digestMethodElem.setAttributeNS(null, DigestMethod.ALGORITHM_ATTRIB_NAME, SignatureConstants.ALGO_ID_DIGEST_SHA1); apacheEncryptedKey.getEncryptionMethod().addEncryptionMethodInformation(digestMethodElem);
xData.addIssuerSerial(cer.getIssuerDN().getName(), cer.getSerialNumber()); kiEnc.add(xData); key.setKeyInfo(kiEnc);