cardtool


Namecardtool JSON
Version 0.0.6 PyPI version JSON
download
home_page
SummaryAn encrypted card generator tool
upload_time2023-10-26 22:55:17
maintainer
docs_urlNone
author
requires_python>=3.9
license
keywords dukpt credit card tool
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Cardtool
[![PyPI version](https://badge.fury.io/py/cardtool.svg)](https://badge.fury.io/py/cardtool)
[![codecov](https://codecov.io/gh/d4n13l-4lf4/cardtool/branch/master/graph/badge.svg?token=1CUDZLNZ9S)](https://codecov.io/gh/d4n13l-4lf4/cardtool)
[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit)](https://github.com/pre-commit/pre-commit)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)

A card data generation tool with DUKPT key derivation.

### Installation

---
You should have python 3.9 or later to run this tool. So, please be sure you have the python interpreter installed before trying this setup guide.

Create a virtual environment:
```bash
python3 -m venv .env
```
Activate the virtual environment:
```bash
source .env/bin/activate
```
For testing purposes with alpha or beta versions, install this tool from [TestPyPI](https://test.pypi.org/):
```bash
pip3 install -U --extra-index-url https://test.pypi.org/simple/ cardtool==x.y.z[ab]N
```
Otherwise, install this tool from [PyPI](https://pypi.org/):
```bash
pip3 install cardtool
```

Finally, use it:
```bash
cardtool --help
```

### Commands reference

---
#### Key decryption
A command to decrypt a TR-31 key block.
```bash
cardtool decrypt-key -kbpk <your_key_block_protection_key> -kcv <key_check_value> YOUR_KEY_BLOCK

```

#### Card data generation
A command to generate a file with encrypted card data using DUKPT key derivation.
```bash 
cardtool gen-card -cfg <path_to_config_yaml> -fmt json|yaml path_to_dump_card_data.[json|yaml]
```

### Card data generation configuration file

---
The following is a reference configuration file for the gen-card command.
```yaml
!CardConfig
# current version of command
version: "0.1" 
# terminal information
terminal:
  !Terminal
  # terminal country
  country: MEX
# encryption keys
key:
  # keys used to encrypt data
  data:
    !Key
    # base derivation key
    bdk: 0123456789ABCDEFFEDCBA9876543210
    # key serial number
    ksn: FFFF4545450000100002
  # keys used to encrypt pin
  pin:
    !Key
    # base derivation key
    bdk: 0123456789ABCDEFFEDCBA9876543210
    # key serial number
    ksn: FFFF4545450000100002
# transaction information
transaction:
  !Transaction
  # type of transaction
  type: charge
  # transaction amount
  amount: 10.2
  # another transaction amount, e.g., cashback amount
  other_amount: 10.23
  # transaction currency
  currency: USD
  # date of transaction with DDMMYY format
  date: "220125"
# array of cards to generate
cards:
  - !Card
    # card label, useful as an identifier for this card
    label: "Test"
    # primary account number 16-19 digits
    pan: "5477820000001234"
    # card pin 4-6 digits
    pin: "1234"
    # card brand (Visa, Mastercard, Carnet)
    brand: "Mastercard"
    # cardholder name
    cardholder_name: Test 1
    # card expiry month
    expiry_month: "12"
    # card expiry year
    expiry_year: "24"
    # card service code
    service_code: "201"
    # card sequence number
    sequence_number: 1

```

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "cardtool",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": "",
    "keywords": "DUKPT,credit,card,tool",
    "author": "",
    "author_email": "Daniel Aucatoma <d4n13l.4lf4@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/0c/0c/2c709bc1bcb7b036264b6756bc075ab1ea60800e621335d371bea2c705c8/cardtool-0.0.6.tar.gz",
    "platform": null,
    "description": "# Cardtool\n[![PyPI version](https://badge.fury.io/py/cardtool.svg)](https://badge.fury.io/py/cardtool)\n[![codecov](https://codecov.io/gh/d4n13l-4lf4/cardtool/branch/master/graph/badge.svg?token=1CUDZLNZ9S)](https://codecov.io/gh/d4n13l-4lf4/cardtool)\n[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit)](https://github.com/pre-commit/pre-commit)\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n\nA card data generation tool with DUKPT key derivation.\n\n### Installation\n\n---\nYou should have python 3.9 or later to run this tool. So, please be sure you have the python interpreter installed before trying this setup guide.\n\nCreate a virtual environment:\n```bash\npython3 -m venv .env\n```\nActivate the virtual environment:\n```bash\nsource .env/bin/activate\n```\nFor testing purposes with alpha or beta versions, install this tool from [TestPyPI](https://test.pypi.org/):\n```bash\npip3 install -U --extra-index-url https://test.pypi.org/simple/ cardtool==x.y.z[ab]N\n```\nOtherwise, install this tool from [PyPI](https://pypi.org/):\n```bash\npip3 install cardtool\n```\n\nFinally, use it:\n```bash\ncardtool --help\n```\n\n### Commands reference\n\n---\n#### Key decryption\nA command to decrypt a TR-31 key block.\n```bash\ncardtool decrypt-key -kbpk <your_key_block_protection_key> -kcv <key_check_value> YOUR_KEY_BLOCK\n\n```\n\n#### Card data generation\nA command to generate a file with encrypted card data using DUKPT key derivation.\n```bash \ncardtool gen-card -cfg <path_to_config_yaml> -fmt json|yaml path_to_dump_card_data.[json|yaml]\n```\n\n### Card data generation configuration file\n\n---\nThe following is a reference configuration file for the gen-card command.\n```yaml\n!CardConfig\n# current version of command\nversion: \"0.1\" \n# terminal information\nterminal:\n  !Terminal\n  # terminal country\n  country: MEX\n# encryption keys\nkey:\n  # keys used to encrypt data\n  data:\n    !Key\n    # base derivation key\n    bdk: 0123456789ABCDEFFEDCBA9876543210\n    # key serial number\n    ksn: FFFF4545450000100002\n  # keys used to encrypt pin\n  pin:\n    !Key\n    # base derivation key\n    bdk: 0123456789ABCDEFFEDCBA9876543210\n    # key serial number\n    ksn: FFFF4545450000100002\n# transaction information\ntransaction:\n  !Transaction\n  # type of transaction\n  type: charge\n  # transaction amount\n  amount: 10.2\n  # another transaction amount, e.g., cashback amount\n  other_amount: 10.23\n  # transaction currency\n  currency: USD\n  # date of transaction with DDMMYY format\n  date: \"220125\"\n# array of cards to generate\ncards:\n  - !Card\n    # card label, useful as an identifier for this card\n    label: \"Test\"\n    # primary account number 16-19 digits\n    pan: \"5477820000001234\"\n    # card pin 4-6 digits\n    pin: \"1234\"\n    # card brand (Visa, Mastercard, Carnet)\n    brand: \"Mastercard\"\n    # cardholder name\n    cardholder_name: Test 1\n    # card expiry month\n    expiry_month: \"12\"\n    # card expiry year\n    expiry_year: \"24\"\n    # card service code\n    service_code: \"201\"\n    # card sequence number\n    sequence_number: 1\n\n```\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "An encrypted card generator tool",
    "version": "0.0.6",
    "project_urls": null,
    "split_keywords": [
        "dukpt",
        "credit",
        "card",
        "tool"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "85f6f227979088a4f185fc479f5283d80b0121ce60da738d7ba18158a9bf3471",
                "md5": "c2ab8f521a14b740009dc3829d10a603",
                "sha256": "96638494f4d3046de3fdd9815199d0c411a67c34a588c42c47b829c097b899fe"
            },
            "downloads": -1,
            "filename": "cardtool-0.0.6-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "c2ab8f521a14b740009dc3829d10a603",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 21146,
            "upload_time": "2023-10-26T22:55:16",
            "upload_time_iso_8601": "2023-10-26T22:55:16.226511Z",
            "url": "https://files.pythonhosted.org/packages/85/f6/f227979088a4f185fc479f5283d80b0121ce60da738d7ba18158a9bf3471/cardtool-0.0.6-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0c0c2c709bc1bcb7b036264b6756bc075ab1ea60800e621335d371bea2c705c8",
                "md5": "5007fd4316f162e7431586c6386da6ac",
                "sha256": "7a878ec7f3bda53c82703db36a1e0f30b9077aad326028ccfd6b618690b446d9"
            },
            "downloads": -1,
            "filename": "cardtool-0.0.6.tar.gz",
            "has_sig": false,
            "md5_digest": "5007fd4316f162e7431586c6386da6ac",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 32693,
            "upload_time": "2023-10-26T22:55:17",
            "upload_time_iso_8601": "2023-10-26T22:55:17.632837Z",
            "url": "https://files.pythonhosted.org/packages/0c/0c/2c709bc1bcb7b036264b6756bc075ab1ea60800e621335d371bea2c705c8/cardtool-0.0.6.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-10-26 22:55:17",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "cardtool"
}
        
Elapsed time: 0.13960s