コード例 #1
0
  protected Key extractSecretKey(
      AlgorithmIdentifier keyEncryptionAlgorithm,
      AlgorithmIdentifier encryptedKeyAlgorithm,
      byte[] encryptedEncryptionKey)
      throws CMSException {
    AsymmetricKeyUnwrapper unwrapper =
        helper.createAsymmetricUnwrapper(keyEncryptionAlgorithm, recipientKey);

    try {
      return CMSUtils.getJceKey(
          unwrapper.generateUnwrappedKey(encryptedKeyAlgorithm, encryptedEncryptionKey));
    } catch (OperatorException e) {
      throw new CMSException("exception unwrapping key: " + e.getMessage(), e);
    }
  }