コード例 #1
0
ファイル: chat.py プロジェクト: frankmorgner/openpace
    def __str__(self):
        ret = eac.EAC_CTX_print_private(self.ctx)

        if ret is None:
            raise OpenPACEException("Failed to print EAC_CTX")

        return ret
コード例 #2
0
ファイル: nPA.py プロジェクト: junaid124/vsmartcard
    def parse_SM_CAPDU(self, CAPDU, header_authentication):
        if hasattr(self.current_SE, "new_encryption_ctx"):
            if self.current_SE.new_encryption_ctx == eac.EAC_ID_PACE:
                protocol = "PACE"
            else:
                protocol = "CA"
            print "switching to new encryption context established in %s:" % protocol
            print eac.EAC_CTX_print_private(self.current_SE.eac_ctx, 4)

            eac.EAC_CTX_set_encryption_ctx(self.current_SE.eac_ctx,
                                           self.current_SE.new_encryption_ctx)

            delattr(self.current_SE, "new_encryption_ctx")

        eac.EAC_increment_ssc(self.current_SE.eac_ctx)
        return SAM.parse_SM_CAPDU(self, CAPDU, 1)
コード例 #3
0
 def __str__(self):
     ret_string = eac.EAC_CTX_print_private(self.ctx, 0)
     return ret_string
コード例 #4
0
ファイル: example.py プロジェクト: mouse07410/openpace
eac.PACE_STEP3B_compute_shared_secret(pcd_ctx, picc_ephemeral_pubkey)
eac.PACE_STEP3B_compute_shared_secret(picc_ctx, pcd_ephemeral_pubkey)

print("PACE step 3C")
eac.PACE_STEP3C_derive_keys(pcd_ctx)
eac.PACE_STEP3C_derive_keys(picc_ctx)

print("PACE step 3D")
pcd_token = eac.PACE_STEP3D_compute_authentication_token(
    pcd_ctx, picc_ephemeral_pubkey)
picc_token = eac.PACE_STEP3D_compute_authentication_token(
    picc_ctx, pcd_ephemeral_pubkey)

eac.PACE_STEP3D_verify_authentication_token(pcd_ctx, picc_token)
r = eac.PACE_STEP3D_verify_authentication_token(picc_ctx, pcd_token)

print("PICC's EAC_CTX:")
print(eac.EAC_CTX_print_private(picc_ctx, 4))
print("PCD's EAC_CTX:")
print(eac.EAC_CTX_print_private(pcd_ctx, 4))

eac.EAC_CTX_clear_free(pcd_ctx)
eac.EAC_CTX_clear_free(picc_ctx)
eac.PACE_SEC_clear_free(secret)

eac.EAC_cleanup()

if r != 1:
    sys.exit(1)