web_modules/forge.bundle.js
function(recipient, privKey) {
      if(msg.encryptedContent.key === undefined && recipient !== undefined &&
        privKey !== undefined) {
        switch(recipient.encryptedContent.algorithm) {
          case forge.pki.oids.rsaEncryption:
          case forge.pki.oids.desCBC:
            var key = privKey.decrypt(recipient.encryptedContent.content);
            msg.encryptedContent.key = forge.util.createBuffer(key);
            break;

          default:
            throw new Error('Unsupported asymmetric cipher, ' +
              'OID ' + recipient.encryptedContent.algorithm);
        }
      }

      _decryptContent(msg);
    }
function(recipient, privKey) {
      if(msg.encryptedContent.key === undefined && recipient !== undefined &&
        privKey !== undefined) {
        switch(recipient.encryptedContent.algorithm) {
          case forge.pki.oids.rsaEncryption:
          case forge.pki.oids.desCBC:
            var key = privKey.decrypt(recipient.encryptedContent.content);
            msg.encryptedContent.key = forge.util.createBuffer(key);
            break;

          default:
            throw new Error('Unsupported asymmetric cipher, ' +
              'OID ' + recipient.encryptedContent.algorithm);
        }
      }

      _decryptContent(msg);
    }
function ( recipient , privKey ) { if ( msg . encryptedContent . key === undefined && recipient !== undefined && privKey !== undefined ) { switch ( recipient . encryptedContent . algorithm ) { case forge . pki . oids . rsaEncryption : case forge . pki . oids . desCBC : var key = privKey . decrypt ( recipient . encryptedContent . content ) ; msg . encryptedContent . key = forge . util . createBuffer ( key ) ; break ; default : throw new Error ( 'Unsupported asymmetric cipher, ' + 'OID ' + recipient . encryptedContent . algorithm ) ; } } _decryptContent ( msg ) ; }
Decrypt enveloped content

@param recipient The recipient object related to the private key
@param privKey The (RSA) private key object
Decrypt enveloped content