encrypted-secret-keypair.js 1.2 KB

12345678910111213141516171819202122232425262728293031
  1. /*
  2. * Copyright 2018 Scytl Secure Electronic Voting SA
  3. *
  4. * All rights reserved
  5. *
  6. * See our extended copyright notice in *file 'Copyright.txt' which is part of this source code package
  7. */
  8. /* jshint node:true */
  9. 'use strict';
  10. module.exports = EncryptedSecretKeyPair;
  11. /**
  12. * @class EncryptedSecretKeyPair
  13. * @classdesc Encapsulates the asymmetric encryption of the pair of secret keys
  14. * used to generate and open a digital envelope. The key pair
  15. * consists of an encryption key to symmetrically encrypt the
  16. * envelope's data and a MAC key to verify the envelope's integrity.
  17. * The keys are bitwise concatenated before encrypting. This object
  18. * is instantiated internally by the methods {@link
  19. * DigitalEnvelopeGenerator.generate} and
  20. * {@link DigitalEnvelopeOpener.open}.
  21. * @property {Uint8Array} encryptedKeyPair The asymmetrically encrypted secret
  22. * key pair.
  23. * @property {string} publicKey The public key used to asymmetrically encrypt
  24. * the secret key pair, in PEM format.
  25. */
  26. function EncryptedSecretKeyPair(encryptedKeyPair, publicKey) {
  27. return Object.freeze(
  28. {encryptedKeyPair: encryptedKeyPair, publicKey: publicKey});
  29. }