def encrypt_data(self, data): if not self.encrypt: return data try: return cryptotool.encrypt(self.crypto_algo, data, self.crypto_key) except: raise InvalidRequestError('Failed to encrypt data. Error:%s' % helper.exc_info())
def encrypt_data(self, data): try: crypto_algo = dict(name="des_ede3_cbc", key_size=24, iv_size=8) return cryptotool.encrypt(crypto_algo, data, self._crypto_key) except: raise rpc.InvalidRequestError('Failed to encrypt data. Error: %s' % (sys.exc_info()[1], ))
def _encrypt(self, server_id, crypto_key, data, headers=None): crypto_algo = dict(name="des_ede3_cbc", key_size=24, iv_size=8) data = cryptotool.encrypt(crypto_algo, data, binascii.a2b_base64(crypto_key)) headers = headers or {} headers["X-Signature"], headers["Date"] = cryptotool.sign_http_request(data, crypto_key) headers["X-Server-Id"] = server_id return data, headers
def _encrypt(self, server_id, key, data, headers=None): assert server_id assert key assert data crypto_algo = dict(name="des_ede3_cbc", key_size=24, iv_size=8) data = cryptotool.encrypt(crypto_algo, data, cryptotool.decrypt_key(key)) headers = headers or dict() headers['X-Signature'], headers['Date'] = cryptotool.sign(data, key) headers['X-Server-Id'] = server_id return data, headers
def _encrypt(server_id, crypto_key, data, headers=None): crypto_algo = dict(name="des_ede3_cbc", key_size=24, iv_size=8) data = cryptotool.encrypt(crypto_algo, data, binascii.a2b_base64(crypto_key)) headers = headers or {} headers['X-Signature'], headers['Date'] = \ cryptotool.sign_http_request(data, crypto_key) headers['X-Server-Id'] = server_id return data, headers
def _encrypt(self, server_id, crypto_key, data, headers=None): assert server_id, 'server_id' assert crypto_key, 'scalarizr.key' assert data, 'data to encrypt' crypto_algo = dict(name="des_ede3_cbc", key_size=24, iv_size=8) data = cryptotool.encrypt(crypto_algo, data, cryptotool.decrypt_key(crypto_key)) headers = headers or dict() headers['X-Signature'], headers['Date'] = cryptotool.sign(data, crypto_key) headers['X-Server-Id'] = server_id LOG.debug("Server: %s, key: %s ... %s" % (server_id, crypto_key[0:5], crypto_key[-5:])) return data, headers
def _encrypt(self, server_id, crypto_key, data, headers=None): assert server_id, 'server_id' assert crypto_key, 'scalarizr.key' assert data, 'data to encrypt' crypto_algo = dict(name="des_ede3_cbc", key_size=24, iv_size=8) data = cryptotool.encrypt(crypto_algo, data, cryptotool.decrypt_key(crypto_key)) headers = headers or dict() headers['X-Signature'], headers['Date'] = cryptotool.sign( data, crypto_key) headers['X-Server-Id'] = server_id msg = "Server: {0}, key: {1} ... {2}".format(server_id, crypto_key[0:5], crypto_key[-5:]) LOG.debug(msg) return data, headers