As a preface, you will have a nightmare of time developing this and passing through PCI compatibility. Of course, it’s worth considering alternatives, such as using a payment service provider that can store the data of this card for you, and perform ad-hoc authorization / calculation using Token identifiers (instead of entering them through a “credit card dialing machine” which you described)
If you decide to ignore this advice and go the PCI path, then at least be sure to take part in the PCI Qualified Security Assesor (QSA) as early as possible to approve any projects you have come up with. PCI is not something that you should "try to comply with as much as possible", it is all or nothing, unfortunately!
However, one way to solve this problem would be to have a key service application that works in Box A. This application requires you to enter two key management keys, which, when combined, form a master key. The master key is stored only in RAM; it has never been saved to disk.
The application generates Key Encrypting Keys, which are stored in block A, encrypted with the master key. KEK is generated automatically (this is not what the user types). KEK can be stored on disk in Box A, encrypted with the master key.
Card data is stored in field B. This field also stores the data encryption key, which is used to perform symmetric encryption of card data. DEK itself is stored in an encrypted format, encrypted with the encryption key of the key from block A.
An application that performs encryption / decryption must be in field B and authenticated in field A before the KEK request. Then KEK is used to decrypt the DEK, and then encryption / decryption can be performed.
Paulg source share