winforms - C# Windows Application (not wpf) mask credit card number in text box as being entered followed by validation and processing of credit card number -


i supporting c# windows applications accepts , processes credit card. due new rules, need mask credit card number it's being entered. if first number 4, visible until next number entered (e.g. 9), text box shows *9.

i thought of using maskedtextbox characters "*" need show last character typed .

are there best practices doing this? keep in mind need numbers , run validations before credit card processed , process credit card , store in database. have cc field in database encrypted.

any suggestions/help highly appreciated.

simple way have 2 text boxes. 1 user enters number into, shows masked version of input. put masked control on entry control.

use textchanged or keyup events track changes , update.

eg

if (textboxentry.text.length <= 1) {     textboxmasked.text = textboxentry.text; } else {     string lastchar = textboxentry.text.substring(textboxentry.text.length-1, 1);     textboxmasked.text = lastchar.padleft(textboxentry.text.length, '*'); } 

beyond have issues pci compliance. isn't enough encrypt these values database, need key management policies, key rotation schedules, , heaps more. know already, mentioning should not aware.


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -