Exemplo n.º 1
0
 def setUp(self):
     server_key_generator = skeygen.themis_gen_key_pair("EC")
     self.server_priv = server_key_generator.export_private_key()
     self.server_pub = server_key_generator.export_public_key()
     client_key_generator = skeygen.themis_gen_key_pair("EC")
     self.client_priv = client_key_generator.export_private_key()
     self.client_pub = client_key_generator.export_public_key()
     
     self.pub_ids = {b"server": self.server_pub, b"client": self.client_pub}
     self.message = b"This is test message"
Exemplo n.º 2
0
    def setUp(self):
        server_key_generator = skeygen.themis_gen_key_pair("EC")
        self.server_priv = server_key_generator.export_private_key()
        self.server_pub = server_key_generator.export_public_key()
        client_key_generator = skeygen.themis_gen_key_pair("EC")
        self.client_priv = client_key_generator.export_private_key()
        self.client_pub = client_key_generator.export_public_key()

        self.pub_ids = {b"server": self.server_pub, b"client": self.client_pub}
        self.message = b"This is test message"
Exemplo n.º 3
0
def reset(request):
    global history
    global server_private_key
    global server_public_key
    global pub_keys
    global sessions

    print("reset")
    key_pair = skeygen.themis_gen_key_pair('EC')
    server_private_key = key_pair.export_private_key()
    server_public_key = key_pair.export_public_key()

    pub_keys = {}
    sessions = {}
    history = []
    return web.Response(
        text=base64.b64encode(server_public_key).decode("UTF-8"))
Exemplo n.º 4
0
                        '--port',
                        type=int,
                        help='Port number',
                        default=5103)
    parser.add_argument('-v',
                        '--verbose',
                        action='store_true',
                        help='Output verbosity')
    args = parser.parse_args()
    port = args.port

    logging.basicConfig(
        level=logging.INFO if args.verbose else logging.WARNING)
    logger = logging.getLogger(__name__)

    key_pair = skeygen.themis_gen_key_pair('EC')
    server_private_key = key_pair.export_private_key()
    server_public_key = key_pair.export_public_key()

    rooms = {}
    pub_keys = {}
    online = {}
    history = {}
    rooms_history = {}

    loop = asyncio.get_event_loop()
    handler, app, srv = loop.run_until_complete(init(port, loop))
    try:
        loop.run_forever()
    except KeyboardInterrupt:
        loop.run_until_complete(finish(app, srv, handler))
Exemplo n.º 5
0
if __name__ == '__main__':
    parser = argparse.ArgumentParser(
        description='Run server')

    parser.add_argument('-p', '--port', type=int, help='Port number',
                        default=5103)
    parser.add_argument('-v', '--verbose', action='store_true',
                        help='Output verbosity')
    args = parser.parse_args()
    port = args.port

    logging.basicConfig(level=logging.INFO if args.verbose else logging.WARNING)
    logger = logging.getLogger(__name__)

    key_pair=skeygen.themis_gen_key_pair('EC')
    server_private_key=key_pair.export_private_key()
    server_public_key=key_pair.export_public_key()
    
    rooms = {}
    pub_keys = {}
    online = {}
    history = {}
    rooms_history = {}

    loop = asyncio.get_event_loop()
    handler, app, srv = loop.run_until_complete(init(port, loop))
    try:
        loop.run_forever()
    except KeyboardInterrupt:
        loop.run_until_complete(finish(app, srv, handler))
Exemplo n.º 6
0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

#key generation example
import sys
from pythemis import skeygen

alg="EC";

obj = skeygen.themis_gen_key_pair(alg);
private_key = obj.export_private_key();
public_key = obj.export_public_key();

private_key_file = open(sys.argv[1],"w");
private_key_file.write(private_key);
private_key_file.close();
public_key_file = open(sys.argv[2],"w");
public_key_file.write(public_key);
public_key_file.close();
Exemplo n.º 7
0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

#key generation example
import sys
from pythemis import skeygen

alg = "EC"

obj = skeygen.themis_gen_key_pair(alg)
private_key = obj.export_private_key()
public_key = obj.export_public_key()

private_key_file = open(sys.argv[1], "wb")
private_key_file.write(private_key)
private_key_file.close()
public_key_file = open(sys.argv[2], "wb")
public_key_file.write(public_key)
public_key_file.close()