public byte[] generateWrappedKey(GenericKey encryptionKey) throws OperatorException { Cipher keyEncryptionCipher = helper.createAsymmetricWrapper(getAlgorithmIdentifier().getAlgorithm(), new HashMap()); try { DEROtherInfo otherInfo = new DEROtherInfo.Builder(JceSymmetricKeyWrapper.determineKeyEncAlg(symmetricWrappingAlg, keySizeInBits), partyUInfo, partyVInfo).build(); KTSParameterSpec ktsSpec = new KTSParameterSpec.Builder(symmetricWrappingAlg, keySizeInBits, otherInfo.getEncoded()).build(); keyEncryptionCipher.init(Cipher.WRAP_MODE, publicKey, ktsSpec, random); return keyEncryptionCipher.wrap(OperatorUtils.getJceKey(encryptionKey)); } catch (Exception e) { throw new OperatorException("Unable to wrap contents key: " + e.getMessage(), e); } } }
public byte[] generateWrappedKey(GenericKey encryptionKey) throws OperatorException { Cipher keyEncryptionCipher = helper.createAsymmetricWrapper(getAlgorithmIdentifier().getAlgorithm(), new HashMap()); try { DEROtherInfo otherInfo = new DEROtherInfo.Builder(JceSymmetricKeyWrapper.determineKeyEncAlg(symmetricWrappingAlg, keySizeInBits), partyUInfo, partyVInfo).build(); KTSParameterSpec ktsSpec = new KTSParameterSpec.Builder(symmetricWrappingAlg, keySizeInBits, otherInfo.getEncoded()).build(); keyEncryptionCipher.init(Cipher.WRAP_MODE, publicKey, ktsSpec, random); return keyEncryptionCipher.wrap(OperatorUtils.getJceKey(encryptionKey)); } catch (Exception e) { throw new OperatorException("Unable to wrap contents key: " + e.getMessage(), e); } } }
public byte[] generateWrappedKey(GenericKey encryptionKey) throws OperatorException Cipher keyEncryptionCipher = helper.createAsymmetricWrapper(getAlgorithmIdentifier().getAlgorithm(), extraMappings); AlgorithmParameters algParams = helper.createAlgorithmParameters(this.getAlgorithmIdentifier());
public byte[] generateWrappedKey(GenericKey encryptionKey) throws OperatorException Cipher keyEncryptionCipher = helper.createAsymmetricWrapper(getAlgorithmIdentifier().getAlgorithm(), extraMappings); AlgorithmParameters algParams = helper.createAlgorithmParameters(this.getAlgorithmIdentifier());
Cipher keyCipher = helper.createAsymmetricWrapper(this.getAlgorithmIdentifier().getAlgorithm(), extraMappings); AlgorithmParameters algParams = helper.createAlgorithmParameters(this.getAlgorithmIdentifier());
Cipher keyCipher = helper.createAsymmetricWrapper(this.getAlgorithmIdentifier().getAlgorithm(), extraMappings); AlgorithmParameters algParams = helper.createAlgorithmParameters(this.getAlgorithmIdentifier());
public GenericKey generateUnwrappedKey(AlgorithmIdentifier encryptedKeyAlgorithm, byte[] encryptedKey) throws OperatorException { GenericHybridParameters params = GenericHybridParameters.getInstance(this.getAlgorithmIdentifier().getParameters()); Cipher keyCipher = helper.createAsymmetricWrapper(this.getAlgorithmIdentifier().getAlgorithm(), extraMappings); String symmetricWrappingAlg = helper.getWrappingAlgorithmName(params.getDem().getAlgorithm()); RsaKemParameters kemParameters = RsaKemParameters.getInstance(params.getKem().getParameters()); int keySizeInBits = kemParameters.getKeyLength().intValue() * 8; Key sKey; try { DEROtherInfo otherInfo = new DEROtherInfo.Builder(params.getDem(), partyUInfo, partyVInfo).build(); KTSParameterSpec ktsSpec = new KTSParameterSpec.Builder(symmetricWrappingAlg, keySizeInBits, otherInfo.getEncoded()).withKdfAlgorithm(kemParameters.getKeyDerivationFunction()).build(); keyCipher.init(Cipher.UNWRAP_MODE, privKey, ktsSpec); sKey = keyCipher.unwrap(encryptedKey, helper.getKeyAlgorithmName(encryptedKeyAlgorithm.getAlgorithm()), Cipher.SECRET_KEY); } catch (Exception e) { throw new OperatorException("Unable to unwrap contents key: " + e.getMessage(), e); } return new JceGenericKey(encryptedKeyAlgorithm, sKey); } }
public GenericKey generateUnwrappedKey(AlgorithmIdentifier encryptedKeyAlgorithm, byte[] encryptedKey) throws OperatorException { GenericHybridParameters params = GenericHybridParameters.getInstance(this.getAlgorithmIdentifier().getParameters()); Cipher keyCipher = helper.createAsymmetricWrapper(this.getAlgorithmIdentifier().getAlgorithm(), extraMappings); String symmetricWrappingAlg = helper.getWrappingAlgorithmName(params.getDem().getAlgorithm()); RsaKemParameters kemParameters = RsaKemParameters.getInstance(params.getKem().getParameters()); int keySizeInBits = kemParameters.getKeyLength().intValue() * 8; Key sKey; try { DEROtherInfo otherInfo = new DEROtherInfo.Builder(params.getDem(), partyUInfo, partyVInfo).build(); KTSParameterSpec ktsSpec = new KTSParameterSpec.Builder(symmetricWrappingAlg, keySizeInBits, otherInfo.getEncoded()).withKdfAlgorithm(kemParameters.getKeyDerivationFunction()).build(); keyCipher.init(Cipher.UNWRAP_MODE, privKey, ktsSpec); sKey = keyCipher.unwrap(encryptedKey, helper.getKeyAlgorithmName(encryptedKeyAlgorithm.getAlgorithm()), Cipher.SECRET_KEY); } catch (Exception e) { throw new OperatorException("Unable to unwrap contents key: " + e.getMessage(), e); } return new JceGenericKey(encryptedKeyAlgorithm, sKey); } }