Use Card Number Conversion

Card conversion can be used for translating of card reader output (the data reader gets after user swipes a card) to card number stored in user database (LDAP, AD, YSoft SafeQ, etc.) if these two numbers are different.

Use Card manager editor only if you are unable to login with card and Terminal access page or log files lists different card numbers than your card has.

More card number pairs you enter, more exact result you get. You should enter at least three different pairs to get valid result.

Conversion Function

SafeQ Support conversions of card numbers as read by Card Reader at Terminal or by LDAP Replicator. If conversion function is defined, card numbers are automatically transformed prior matching with (or storing to) SafeQ Identity Database.
Typical conversion configuration looks as follows and is represented by conversion attribute in SafeQ configuration:

ASCII2Hex;Hex2Dec;Substring(-8)

Each rule is represented by its name (see description of rules) and separated by semicolon. Some rules have one or two parameters which are in parentheses and separated by comma.

Substring(2);Hex2Dec;LeftPadding(0,3) + Substring(2,6);Hex2Dec

Some conversions may contain two (or more) independent conversion rules that are connected by operator +.

The conversion is executed from the left, rule by rule. Each conversion rule takes the last converted number and executes. Where operator + appears it takes the output from a preceding rule, executes the rules in parallel and returns the result of both rules. The result in the case of operator + may look as follows: Conversion rule: LeftPadding(0,3) + Substring(2,6) INPUT: 1a2b3c4d OUTPUT: (1a2b3c4d) + (2b3c) = 1a2b3c4d2b3c

Description of Rules

Following rules are sorted alphabetically. images/s/-3eliqb/8502/404359a7d2ab19c9c7c58d12013124a386b28257/_/images/icons/emoticons/warning.svg Please note that rule names are CASE SENSITIVE.

ASCII2Hex

This rule converts string in ASCII format (typically from KM reader) into hex form. Other input is not changed. ASCII format is "^([34][0-9])+([fF]{2})*$"
Syntax:

  • ASCII2Hex – convert only string with length 32 signs

  • ASCII2Hex(length) – convert string until specific length
    Example:

  • ASCII2Hex(16)

  • 33303730314446383030FFFFFFFFFFFF => 30701DF800

  • 30701DF800 => 30701DF800

Bin2Dec

Converts number from binary format into decimal format.
Syntax:

  • Bin2Dec
    Example:

  • Bin2Dec

  • 101011 => 43

Const

Returns specified string. Could be used with operator +. Similar functionality provides LeftAppend and RightAppend.
Syntax:

  • Const(12345)
    Example:

  • LeftPadding(0,6) + Const(@ysoft.com)

  • 12345 => 012345@ysoft.com

  • 123 => 000123@ysoft.com

Dec2Bin

Converts number from decimal format into binary format.
Syntax:

  • Dec2Bin
    Example:

  • Dec2Bin

  • 43 => 101011

Dec2Hex

Converts number in decimal format into hexadecimal format
Syntax:

  • Dec2Hex
    Example:

  • Dex2Hex

  • 12345 => 3039

  • 123 => 7B

DecimalAdd

Adds value in decimal format to current value in decimal format
Syntax:

  • DecimalAdd(value)
    Example:

  • DecimalAdd(1)

  • 12345 => 12346

  • 123 => 124

DecimalAnd

Make binary AND. Mask is in decimal format.
Syntax:

  • DecimalAnd(mask)
    Example:

  • DecimalAnd(15)

  • 7 => 7

  • 467825 => 1

DecValue2Hex

Inversion function to Hex2DecValue. Converts each pair of decimal number to hexadecimal digit. (08 -> 8, 11 -> B). Input must have even length.

Example:

  • 09101112 => 9ABC

  • ODD => ODD

Hex2ASCII

This is inverse function to ASCII2Hex. Converts hexadecimal string into ASCII representation. Input string could have maximum length of 16 signs. Otherwise original input is returned.
Syntax:

  • Hex2ASCII
    Example:

  • Hex2ASCII

  • 12AB => 31324142

  • JEDNA => JEDNA

DESDecrypt

Decodes value encrypted by DES in Base64 format.

Example:

  • AzRapSymPps= => 1234

DESEncrypt

Encodes value into DES and Base64 format.

Example:

  • 123 => AzRapSymPps=

Hex2ASCII

Converts hex number to its ASCII representation. It is inversion function to ASCII2Hex;

Example:

  • 30701DF800 => 33303730314446383030

Hex2Dec

Converts number from hexadecimal format into decimal format.
Syntax:

  • Hex2Dec
    Example:

  • Hex2Dec

  • 12AB => 4779

Hex2DecValue

Converts each hexadecimal digit into decimal representation (8 – 08, A – 10, B – 11, etc).
Syntax:

  • Hex2DecValue
    Example:

  • Hex2DecValue

  • 12AB => 01021011

Hex2Oct

Converts number from hexadecimal format into octal format.
Syntax:

  • Hex2Oct
    Example:

  • Hex2Oct

  • 12AB => 11253

HexAnd

Make binary AND. Mask is in hexadecimal format. Similar functionality contains DecimalAnd.
Syntax:

  • HexAnd(mask)
    Example:

  • HexAnd(FF)

  • 7 => 7

  • 7237B => 7B

IsEmbed

Allow next processing only if card number is from embedded reader.
Syntax:

  • IsEmbed
    Example:

  • IsEmbed;RightStrip(F)

  • 12345FFFFFFFFF (from embedded terminal) => 12345

  • 123F (from profi terminal) => 123F

IsEven

Allow next processing only if card number length is even.
Syntax:

  • IsEven
    Example:

  • IsEven;LeftAppend(0)

  • 12AB => 012AB

  • 12A => 12A

IsLength

Allow next processing only if card number length is equal to specified value.
Syntax:

  • IsLength(value)
    Example:

  • IsLength(10);SwapPair

  • 1234567890 => 2143658709

IsLengthGreater

Allow next processing only if card number length is greater than specified value.
Syntax:

  • IsLengthGreater(value)
    Example:

  • IsLengthGreater(5);Substring(5)

  • 12AB => 12AB

  • 12345678 => 12345

IsLengthNot

Allow next processing only if card number length is different from value.
Syntax:

  • IsLengthNot(value)
    Example:

  • IsLengthNot(9);LeftAppend(0)

  • 12456789 => 123456789

  • 12345 => 012345

IsNotStartWith

Allow next processing only if card number doesn't start with specified string.
Syntax:

  • IsNotStartWith(string)
    Example:

  • IsNotStartWith(~);LeftPadding(0,8)

  • ~1234 => ~1234

  • 1234 => 00001234

IsStartWith

Allow next processing only if card number starts with specified string.

Syntax:

  • IsStartWith(PIN)

Example:

  • IsStartWith(PIN);Substring(3,0)

  • PIN1234 => 1234

  • 12345 => 12345

LeftAppend

Append specified string from left side. Similar functionality has RightAppend.
Syntax:

  • LeftAppend(prefix)
    Example:

  • LeftAppend(YSOFT-)

  • 12AB => YSOFT-12AB

LeftCut

Cut specified prefix from left. If prefix doesn't match than do nothing.
Syntax:

  • LeftCut(prefix)
    Example:

  • LeftCut(~1)

  • ~12AB => 2AB

  • 12A => 12A

LeftHexShift

Unary bit operation LEFT SHIFT for specified count of bits. Input and output are in hexadecimal format. This operation is equivalent to multiplying by 2count
Syntax:

  • LeftHexShift(count)
    Example:

  • LeftHexShift(1)

  • 12AB => 2556

  • 254 => 4A8

LeftPadding

Pads with specified sign from left to specified length.
Syntax:

  • LeftPadding(sign,length)
    Example:

  • LeftPadding(0,10)

  • 1234ABCD => 001234ABCD

LeftShift

Unary bit operation LEFT SHIFT for specified count of bits. Input and output are in decimal format. Similar behavior has LeftHexShift. This operation is equivalent to multiplying by 2count
Syntax:

  • LeftShift(count)
    Example:

  • LeftShift(1)

  • 128 => 256

LeftStrip

Strips specified sign from left.
Syntax:

  • LeftStrip(sign)
    Example:

  • LeftStrip(0)

  • 000012AB => 12AB

  • 00000254 => 254

LowerCase

Convert alphabetical sign to its lowercase representation.
Syntax:

  • LowerCase
    Example:

  • LowerCase

  • CARD123 => card123

LRC

Computes Longitudinal Redundancy Check http://en.wikipedia.org/wiki/Longitudinal_redundancy_check and adds it to the end.

Example:

  • 01044F24CC => 01044F24CCA2

MD5

Computes MD5 hash of input.

Example:

  • 1234 => 81dc9bdb52d04dc20036dbd8313ed055

Replace

Replaces all occurrences of one sequence with another one.
Syntax:

  • Replace(source) – only removes specified source (replace with empty string)

  • Replace(source,dest) – replace specified source with dest
    Example:

  • Replace(~,0)

  • ~1234~ => 012340

  • 12~34 => 12034

Reverse2

Byte reverse - it is useful only for hexadecimal input because 2 signs represent one byte. Therefore this operation makes reverse string by pair. Even length is necessary.
Syntax:

  • Reverse2
    Example:

  • Reverse2

  • 12345678 => 78563412

Reverse

Reverse of string.
Syntax:

  • Reverse
    Example:

  • Reverse

  • 12345678 => 87654321

RightAppend

This function is similar to LeftAppend. Append specified string from right side.
Syntax:

  • RightAppend(suffix)
    Example:

  • RightAppend(-YSOFT)

  • 12AB => 12AB-YSOFT

RightHexShift

Unary bit operation RIGHT SHIFT for specified count of bits. Input and output are in hexadecimal format. This operation is equivalent to dividing by 2count
Syntax:

  • RightHexShift(count)
    Example:

  • RightHexShift(1)

  • 12AB => 955

  • 254 => 12A

RightPadding

Pads with specified sign from right to specified length.
Syntax:

  • RightPadding(sign,length)
    Example:

  • RightPadding(F,10)

  • 1234ABCD => 1234ABCDFF

RightShift

Unary bit operation RIGHT SHIFT for specified count of bits. Input and output are in decimal format. Similar behavior has RightHexShift. This operation is equivalent to dividing by 2count
Syntax:

  • RightShift(count)
    Example:

  • RightShift(1)

  • 256 => 128

RightStrip

Strips specified sign from right.
Syntax:

  • RightStrip(sign)
    Example:

  • RightStrip(F)

  • 30344142FFFFFFFFFFFFFFFFF => 30344142

SignReverse

This conversion takes every string in hexadecimal format and makes its binary reverse. For example (5 is represented in binary as 0101, reverse transfer it into 1010 that is A)
Syntax:

  • SignReverse
    Example:

  • SignReverse

  • 0123456789ABCDEF => 084C2A6E195D3B7F

Substring

Selects substring of input. If any argument is negative then it is used from right side (from end).
Syntax:

  • Substring( n)

  • Substring(start,end)
    Example:

  • Substring(5)

  • 1234567890 => 12345

  • Substring(-5)

  • 1234567890 => 67890

  • Substring(3,0)

  • 1234567890 => 4567890

  • 123ABCDE => ABCDE

  • Substring(2,-2)

  • 1234567890 => 345678

  • 123ABCDE => 3ABC

  • Substring(-7,-2)

  • 1234567890 => 45678

  • 123ABCDE => 23ABC

Swap12785634

Swap 4th byte with 2nd. It is useful only for hexadecimal format.
Syntax:

  • Swap12785634
    Example:

  • Swap12785634

  • 12345678 => 12785634

SwapPair

Swaps even and odd signs.
Syntax:

  • SwapPair
    Example:

  • SwapPair

  • 123456 => 214365

UpperCase

Convert alphabetical sign to its uppercase representation.
Syntax:

  • UpperCase
    Example:

  • UpperCase

  • card123 => CARD123

Example of use

  1. Importing PIN codes from a directory service - to be able to import PIN codes from a directory service such as Active Directory it possible to use a conversion while importing a plain text number (e.g. 1234). However, SafeQ by default expects to verify the PIN number in a hash format. Therefore the solution would be to configure "PIN code conversion" and use the following conversion:
    MD5;LeftAppend(PIN)