If the ODS file has an encryption-data element, then try to decrypt.
 If successful, the temporary content.xml will be overwritten with
 decrypted contents.
335369
def decrypt_if_necessary(
      zip_file,
      content_entry,
      roo_content_xml_path, options
    )
      # Check if content.xml is encrypted by extracting manifest.xml
      # and searching for a manifest:encryption-data element

      if (manifest_entry = zip_file.glob('META-INF/manifest.xml').first)
        roo_manifest_xml_path = File.join(@tmpdir, 'roo_manifest.xml')
        manifest_entry.extract(roo_manifest_xml_path)
        manifest        = ::Roo::Utils.load_xml(roo_manifest_xml_path)

        # XPath search for manifest:encryption-data only for the content.xml
        # file

        encryption_data = manifest.xpath(
          "//manifest:file-entry[@manifest:full-path='content.xml']"\
        "/manifest:encryption-data"
        ).first

        # If XPath returns a node, then we know content.xml is encrypted

        unless encryption_data.nil?

          # Since we know it's encrypted, we check for the password option
          # and if it doesn't exist, raise an argument error

          password = options[:password]
          if !password.nil?
            perform_decryption(
              encryption_data,
              password,
              content_entry,
              roo_content_xml_path
            )
          else
            fail ArgumentError, 'file is encrypted but password was not supplied'
          end
        end
      else
        fail ArgumentError, 'file missing required META-INF/manifest.xml'
      end
    end
670988
void decrypt(PdfReader reader) {
        PdfEncryption decrypt = reader.getDecrypt();
        if (decrypt != null) {
            originalValue = value;
            decrypt.setHashKey(objNum, objGen);
            bytes = PdfEncodings.convertToBytes(value, null);
            bytes = decrypt.decryptByteArray(bytes);
            value = PdfEncodings.convertToString(bytes, null);
        }
    }
1012656
def dec(self, byts):
        '''
        
        '''
        envl = s_msgpack.un(byts)
        iv = envl.get('iv', b'')
        asscd = envl.get('asscd', b'')
        data = envl.get('data', b'')

        decryptor = AESGCM(self.ekey)

        try:
            data = decryptor.decrypt(iv, data, asscd)
        except Exception:
            logger.exception('Error decrypting data')
            return None
        return data
1364407
def decode(data):
    
    dom = None
    try:
        dom = dhtmlparser.parseString(data)
    except Exception, e:
        raise MetaParsingException("Can't parse your XML data: %s" % e.message)

    root = dom.find("root")

    # check whether there is <root>s
    if not root:
        raise MetaParsingException("All elements have to be inside <root>.")

    # and make sure, that there is not too many <root>s
    if len(root) > 1:
        raise MetaParsingException("Too many <root> elements in your XML!")

    items = root[0].find("item")

    # check for items
    if not items:
        raise MetaParsingException("There are no <items> in your XML <root>!")

    decoded = []
    for item in items:
        if "key" not in item.params:
            raise MetaParsingException(
                "There is no 'key' parameter in %s." % str(item)
            )

        decoded.append([
            item.params["key"],
            item.getContent().strip()
        ])

    decoded = validator.check_structure(decoded)

    return decoded
1249225
def _cbc_decrypt(self, final_key, crypted_content):
        """"""

        # Just decrypt the content with the created key
        aes = AES.new(final_key, AES.MODE_CBC, self._enc_iv)
        decrypted_content = aes.decrypt(crypted_content)
        padding = decrypted_content[-1]
        if sys.version > '3':
            padding = decrypted_content[-1]
        else:
            padding = ord(decrypted_content[-1])
        decrypted_content = decrypted_content[:len(decrypted_content)-padding]
        
        return decrypted_content
776910
def decrypt(encrypted)
      fail ArgumentError, 'No cipher text supplied.' if encrypted.nil? || encrypted.empty?

      matches = CIPHER_PATTERN.match(encrypted)

      fail ArgumentError, 'Cipher text has an unsupported format.' if matches.nil?

      cipher = self.class.cipher
      cipher.decrypt
      cipher.key = Base64.decode64(@key)
      cipher.iv = Base64.decode64(matches[1])
      decrypted = cipher.update(Base64.decode64(matches[2]))

      decrypted << cipher.final
    end
667761
public static String decrypt(String key, String hexStr)
    {
        try
        {
            return new String(createAesDecryptionCipher(key).doFinal(ByteUtilities.decode(hexStr)));
        }
        catch (Exception e)
        {
            throw new IllegalStateException("Error occurred decrypting data", e);
        }
    }
998045
public static byte[] decryptBase64DES(byte[] data, byte[] key) {
        try {
            return decryptDES(Base64.getDecoder().decode(data), key);
        } catch (Exception e) {
            return null;
        }
    }
831293
function(data) {
      if (!data) {
        data = this.getContent();
      }
      return this.encoder.encryptAes(JSON.stringify(data), this.getSecret());
    }
860937
def Decrypt(self, encrypted_data):
    
    index_split = -(len(encrypted_data) % DES3.block_size)
    if index_split:
      remaining_encrypted_data = encrypted_data[index_split:]
      encrypted_data = encrypted_data[:index_split]
    else:
      remaining_encrypted_data = b''

    decrypted_data = self._des3_cipher.decrypt(encrypted_data)

    return decrypted_data, remaining_encrypted_data
125050
def _decrypt_and_extract(self, fname):
        '''
        
        '''
        with open(fname, "r") as fp_in:
            encrypted_data = fp_in.read()

            decrypted_data = self._hilink_decrypt(encrypted_data)

            with open(binwalk.core.common.unique_file_name(fname[:-4], "dec"), "w") as fp_out:
                fp_out.write(decrypted_data)
1314878
def decrypt(data)
      raise NoPrivateKeyError, "Private key file: #{private_key_file}" unless private?
      
      decrypted_data = data.unpack('m')[0]
      private_rsa.private_decrypt(decrypted_data)
    end
229167
def decrypt(self, data):
        
        if False in six.itervalues(self.ready):
            raise CipherError(data)
        decryptor = self._cipher.decryptor()
        tmp = decryptor.update(data) + decryptor.finalize()
        self.iv = data[-self.block_size:]
        return tmp
69627
def decrypt(aes_key, text, corpid)
      status = 200
      text        = Base64.decode64(text)
      text        = handle_cipher(:decrypt, aes_key, text)
      result      = PKCS7Encoder.decode(text)
      content     = result[16...result.length]
      len_list    = content[0...4].unpack("N")
      xml_len     = len_list[0]
      xml_content = content[4...4 + xml_len]
      from_corpid = content[xml_len+4...content.size]
      # TODO: refactor
      if corpid != from_corpid
        Rails.logger.debug("#{__FILE__}:#{__LINE__} Failure because #{corpid} != #{from_corpid}")
        status = 401
      end
      [xml_content, status]
    end
1285110
public String decrypt(String toDecrypt) {
        byte[] encryptedBytes = base64Decoder.decode(toDecrypt);
        return decryptInternal(dataEncryptionSecretKeySpec, encryptedBytes);
    }
877173
def decrypt(self, key, flags=0):
        
        bio = Membio()
        if libcrypto.CMS_EncryptedData_decrypt(self.ptr, key, len(key), None,
                                               bio.bio, flags) <= 0:
            raise CMSError("decrypt data")
        return str(bio)
213759
def decrypt_filedata(data, keys):
    ''''''
    # The last 16 bytes / 128 bits of data is the GCM tag
    # https://www.w3.org/TR/WebCryptoAPI/#aes-gcm-operations :-
    # 7. Let ciphertext be equal to C | T, where '|' denotes concatenation.
    data.seek(-16, 2)
    tag = data.read()

    # now truncate the file to only contain encrypted data
    data.seek(-16, 2)
    data.truncate()
    data.seek(0)

    plain = tempfile.NamedTemporaryFile(mode='w+b', delete=False)

    pbar = progbar(fileSize(data))

    obj = Cryptodome.Cipher.AES.new(keys.encryptKey, Cryptodome.Cipher.AES.MODE_GCM, keys.encryptIV)
    prev_chunk = b''
    for chunk in iter(lambda: data.read(CHUNK_SIZE), b''):
        plain.write(obj.decrypt(prev_chunk))
        pbar.update(len(chunk))
        prev_chunk = chunk

    plain.write(obj.decrypt_and_verify(prev_chunk, tag))
    data.close()
    pbar.close()

    plain.seek(0)
    return plain