Exemplo n.º 1
0
Arquivo: rpc.py Projeto: afrank/scalr
 def encrypt_data(self, data):
     if not self.encrypt:
         return data
     try:
         return cryptotool.encrypt_scalarizr(self.crypto_algo, data, self.crypto_key)
     except:
         raise InvalidRequestError('Failed to encrypt data. Error:%s' % helper.exc_info())
Exemplo n.º 2
0
Arquivo: rpc.py Projeto: zeus911/scalr
 def encrypt_data(self, data):
     if not self.encrypt:
         return data
     try:
         return cryptotool.encrypt_scalarizr(self.crypto_algo, data,
                                             self.crypto_key)
     except:
         raise InvalidRequestError('Failed to encrypt data. Error:%s' %
                                   helper.exc_info())
Exemplo n.º 3
0
 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_scalarizr(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
     return data, headers
Exemplo n.º 4
0
 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_scalarizr(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
Exemplo n.º 5
0
 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_scalarizr(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