コード例 #1
0
ファイル: test.py プロジェクト: Karkanius/Security-Project
    def test_name_id(self):
        citizen_card = CitizenCard(self.pin)

        name = citizen_card.get_name()
        num = citizen_card.get_number()

        print("Name {:s}, Number {:s}".format(name, str(num)))
        citizen_card.signOut()
        self.assertTrue(True, msg="")  # dummy test
コード例 #2
0
ファイル: client.py プロジェクト: Karkanius/Security-Project
                        '--ip-address',
                        type=str,
                        help='Server IP address',
                        required=True)
    parser.add_argument('-p',
                        '--port',
                        type=int,
                        help='Server port',
                        required=True)
    args = parser.parse_args()
    verbose = args.verbose

    # Create Citizen Card instance
    try:
        citizen_card = CitizenCard("PIN - NOT USED")
        name = citizen_card.get_name()
        logger.log(
            'Client', 'Using Citizen Card with name {} and id {}'.format(
                name, citizen_card.get_number()), 'green')
    except Exception as e:
        logger.log('Client', e, 'red')
        logger.log(
            'Client',
            'Not using Citizen Card - no available cards. Using name on arguments',
            'red')
        name = args.username
        exception_happened = True

    # Create RSA and AES ciphers
    asym_cipher = AsymCipher(name)
    sym_cipher = SymCipher(name)