src/crypto/crypto.js
function(algo) {
    switch (algo) {
      //   Algorithm-Specific Fields for RSA encrypted session keys:
      //       - MPI of RSA encrypted value m**e mod n.
      case enums.publicKey.rsa_encrypt:
      case enums.publicKey.rsa_encrypt_sign:
        return [type_mpi];

      //   Algorithm-Specific Fields for Elgamal encrypted session keys:
      //       - MPI of Elgamal value g**k mod p
      //       - MPI of Elgamal value m * y**k mod p
      case enums.publicKey.elgamal:
        return [type_mpi, type_mpi];
      //   Algorithm-Specific Fields for ECDH encrypted session keys:
      //       - MPI containing the ephemeral key used to establish the shared secret
      //       - ECDH Symmetric Key
      case enums.publicKey.ecdh:
        return [type_mpi, type_ecdh_symkey];
      default:
        throw new Error('Invalid public key encryption algorithm.');
    }
  }
function(algo) {
    switch (algo) {
      //   Algorithm-Specific Fields for RSA encrypted session keys:
      //       - MPI of RSA encrypted value m**e mod n.
      case enums.publicKey.rsa_encrypt:
      case enums.publicKey.rsa_encrypt_sign:
        return [type_mpi];

      //   Algorithm-Specific Fields for Elgamal encrypted session keys:
      //       - MPI of Elgamal value g**k mod p
      //       - MPI of Elgamal value m * y**k mod p
      case enums.publicKey.elgamal:
        return [type_mpi, type_mpi];
      //   Algorithm-Specific Fields for ECDH encrypted session keys:
      //       - MPI containing the ephemeral key used to establish the shared secret
      //       - ECDH Symmetric Key
      case enums.publicKey.ecdh:
        return [type_mpi, type_ecdh_symkey];
      default:
        throw new Error('Invalid public key encryption algorithm.');
    }
  }
function ( algo ) { switch ( algo ) { //   Algorithm-Specific Fields for RSA encrypted session keys: //       - MPI of RSA encrypted value m**e mod n. case enums . publicKey . rsa_encrypt : case enums . publicKey . rsa_encrypt_sign : return [ type_mpi ] ; //   Algorithm-Specific Fields for Elgamal encrypted session keys: //       - MPI of Elgamal value g**k mod p //       - MPI of Elgamal value m * y**k mod p case enums . publicKey . elgamal : return [ type_mpi , type_mpi ] ; //   Algorithm-Specific Fields for ECDH encrypted session keys: //       - MPI containing the ephemeral key used to establish the shared secret //       - ECDH Symmetric Key case enums . publicKey . ecdh : return [ type_mpi , type_ecdh_symkey ] ; default : throw new Error ( 'Invalid public key encryption algorithm.' ) ; } }
Returns the types comprising the encrypted session key of an algorithm
@param {String} algo The public key algorithm
@returns {Array<String>} The array of types
Returns the types comprising the encrypted session key of an algorithm