Integrations/MicrosoftGraphFiles/MicrosoftGraphFiles.py
def encrypt(string, enc_key):
        """
        Args:
            string: content to encrypt. For a request to Demistobot for a new access token, content should be
                the tenant id
            key encryption key from Demistobot

        Returns:
            encrypted timestamp:content
        """
        try:
            # String to bytes
            enc_key = base64.b64decode(enc_key)
        except binascii.Error:
            raise DemistoException(
                "It looks like 'Key' value is incorrect. please " "provide another one."
            )
        aes_gcm = AESGCM(enc_key)
        # Create nonce
        nonce = create_nonce()
        # Create ciphered data
        data = string.encode()
        ct_ = aes_gcm.encrypt(nonce, data, None)
        return base64.b64encode(nonce + ct_)

        Args:
            string: content to encrypt. For a request to Demistobot for a new access token, content should be
                the tenant id
            key encryption key from Demistobot

        Returns:
            encrypted timestamp:content
        
content to encrypt. For a request to Demistobot for a new access token, content should be
the tenant id
key encryption key from Demistobot

encrypted timestamp:content
content to encrypt . For a request to Demistobot for a new access token content should be the tenant id key encryption key from Demistobot encrypted timestamp : content
def encrypt(string, enc_key):
        try:
            enc_key = base64.b64decode(enc_key)
        except binascii.Error:
            raise DemistoException(
                "It looks like 'Key' value is incorrect. please " "provide another one."
            )
        aes_gcm = AESGCM(enc_key)
        nonce = create_nonce()
        data = string.encode()
        ct_ = aes_gcm.encrypt(nonce, data, None)
        return base64.b64encode(nonce + ct_)
def encrypt ( string , enc_key ) : try : enc_key = base64 . b64decode ( enc_key ) except binascii . Error : raise DemistoException ( "It looks like 'Key' value is incorrect. please " "provide another one." ) aes_gcm = AESGCM ( enc_key ) nonce = create_nonce ( ) data = string . encode ( ) ct_ = aes_gcm . encrypt ( nonce , data , None ) return base64 . b64encode ( nonce + ct_ )
Args:
string: content to encrypt.
Args : string : content to encrypt .
"""
        Args:
            string: content to encrypt. For a request to Demistobot for a new access token, content should be
                the tenant id
            key encryption key from Demistobot

        Returns:
            encrypted timestamp:content
        """ # String to bytes # Create nonce # Create ciphered data
string
enc_key