node_modules/node-forge/lib/pkcs7.js
/**
 * Decrypt the symmetrically encrypted content block of the PKCS#7 message.
 *
 * Decryption is skipped in case the PKCS#7 message object already has a
 * (decrypted) content attribute.  The algorithm, key and cipher parameters
 * (probably the iv) are taken from the encryptedContent attribute of the
 * message object.
 *
 * @param The PKCS#7 message object.
 */
Decrypt the symmetrically encrypted content block of the PKCS#7 message.
Decryption is skipped in case the PKCS#7 message object already has a
(decrypted) content attribute.  The algorithm, key and cipher parameters
(probably the iv) are taken from the encryptedContent attribute of the
message object.

@param The PKCS#7 message object.
Decrypt the symmetrically encrypted content block of the PKCS#7 message . Decryption is skipped in case the PKCS#7 message object already has a ( decrypted ) content attribute . The algorithm key and cipher parameters ( probably the iv ) are taken from the encryptedContent attribute of the message object . @param The PKCS#7 message object .
function _decryptContent(msg) {
  if(msg.encryptedContent.key === undefined) {
    throw new Error('Symmetric key not available.');
  }
  if(msg.content === undefined) {
    var ciph;
    switch(msg.encryptedContent.algorithm) {
      case forge.pki.oids['aes128-CBC']:
      case forge.pki.oids['aes192-CBC']:
      case forge.pki.oids['aes256-CBC']:
        ciph = forge.aes.createDecryptionCipher(msg.encryptedContent.key);
        break;
      case forge.pki.oids['desCBC']:
      case forge.pki.oids['des-EDE3-CBC']:
        ciph = forge.des.createDecryptionCipher(msg.encryptedContent.key);
        break;
      default:
        throw new Error('Unsupported symmetric cipher, OID ' +
          msg.encryptedContent.algorithm);
    }
    ciph.start(msg.encryptedContent.parameter);
    ciph.update(msg.encryptedContent.content);
    if(!ciph.finish()) {
      throw new Error('Symmetric decryption failed.');
    }
    msg.content = ciph.output;
  }
}
function _decryptContent ( msg ) { if ( msg . encryptedContent . key === undefined ) { throw new Error ( 'Symmetric key not available.' ) ; } if ( msg . content === undefined ) { var ciph ; switch ( msg . encryptedContent . algorithm ) { case forge . pki . oids [ 'aes128-CBC' ] : case forge . pki . oids [ 'aes192-CBC' ] : case forge . pki . oids [ 'aes256-CBC' ] : ciph = forge . aes . createDecryptionCipher ( msg . encryptedContent . key ) ; break ; case forge . pki . oids [ 'desCBC' ] : case forge . pki . oids [ 'des-EDE3-CBC' ] : ciph = forge . des . createDecryptionCipher ( msg . encryptedContent . key ) ; break ; default : throw new Error ( 'Unsupported symmetric cipher, OID ' + msg . encryptedContent . algorithm ) ; } ciph . start ( msg . encryptedContent . parameter ) ; ciph . update ( msg . encryptedContent . content ) ; if ( ! ciph . finish ( ) ) { throw new Error ( 'Symmetric decryption failed.' ) ; } msg . content = ciph . output ; } }
Decrypt the symmetrically encrypted content block of the PKCS#7 message.
Decrypt the symmetrically encrypted content block of the PKCS#7 message .