Giter Club home page Giter Club logo

Comments (8)

sgbj avatar sgbj commented on August 30, 2024

For better assistance, please provide a full stack trace of the error, and if at all possible the track that you're attempting to decrypt. Does this error always occur, even for other cards? If so, then this implementation of DUKPT may be incompatible with the swiper you're using.

from dukpt.net.

SaddamBInSyed avatar SaddamBInSyed commented on August 30, 2024

Hi sgbj,

Here the full description of what i am trying..

Decryption of a three track ABA card with the original encryption format.
SecureMag Reader with default settings
Original encryption format can be recognized because the high bit of the fourth byte
underlined (00) is 0.

027D01003F48236B252A343236362A2A2A2A2A2A2A2A393939395E42555348204A
522F47454F52474520572E4D525E2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2
A2A2A2A2A2A2A2A2A2A2A2A2A2A3F2A3B343236362A2A2A2A2A2A2A2A3939
39393D2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A3F2A3B3333333333333333333337
363736373630373037303737363736373633333333333333333333373637363736303730
373037373637363736333333333333333333333736373637363037303730373736373637
3633333333333333333333373637363736303730373F32863E9E3DA28E455B28F7736
B77E47A64EDDA3BF03A06E44F31D1818C0BCD7A353FB1AD70EFD30FFC3DA08
A4FBC9372E57E8B40848BAEAA3FE724B3550E2F4B223E6BF264BEAE9E39142B6
48CDB51FB8DAF8EA5B63913D29419B67582FCCCE9B372660F03668CC453216D9
449C6B67EF33418AC88F65E1DB7ED4D10973F99DFC8463FF6DF113B6226C4898A
9D355057ECAF11A5598F02CA3162994901190000000001399F03

STX, Length (LSB, MSB), card type, track status, length track 1, length track 2, length
track 3

02 7D01 00 3F 48 23 6B
The above broken down and interpreted
02—STX character
7D—low byte of total length
01—high byte of total length
00—card type byte (interpretation old format ABA card)
3F—3 tracks of data all good
48—track 1 clear/mask data length
23—track 2 clear/mask data length
6B— track 3 clear/mask data length

Track 1 data masked (length 0x48)
252A343236362A2A2A2A2A2A2A2A393939395E42555348204A522F47454F5247452
0572E4D525E2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2
A2A2A2A2A2A2A3F2A

Track 2 data in hex masked (length 0x23)
3B343236362A2A2A2A2A2A2A2A393939393D2A2A2A2A2A2A2A2A2A2A2A2A2
A2A2A3F2A

Track 3 data unencrypted (length 0x6B)
3B333333333333333333333736373637363037303730373736373637363333333333333
333333337363736373630373037303737363736373633333333333333333333373637363
73630373037303737363736373633333333333333333333373637363736303730373F32

Track 1 & 2 encrypted length 0x48+0x23 rounded up to 8 bytes =0x6B -> 0x70 (112
decimal)
863E9E3DA28E455B28F7736B77E47A64EDDA3BF03A06E44F31D1818C0BCD7A3
53FB1AD70EFD30FFC3DA08A4FBC9372E57E8B40848BAEAA3FE724B3550E2F4B
223E6BF264BEAE9E39142B648CDB51FB8DAF8EA5B63913D29419B67582FCCCE
9B372660F03668CC453216D9449C6B67EF3

Track 1 hashed
3418AC88F65E1DB7ED4D10973F99DFC8463FF6DF
Track 2 hashed
113B6226C4898A9D355057ECAF11A5598F02CA31
KSN
62994901190000000001
LRC, checksum and ETX
39 9F 03

Masked Data:

Track 1 data masked in ASCII:
%4266_9999^BUSH JR/GEORGE
W.MR^_
***********************?

Track 2 data masked in ASCII:
;4266*******9999=*************?

Track 3 data unencrypted in ASCII:
;33333333337676760707077676763333333333767676070707767676333333333376767
607070776767633333333337676760707?2

Key Value: F8 2A 7A 0D 7C 67 46 F1 96 18 9A FB 54 2C 65 A3

KSN: 62 99 49 01 19 00 00 00 00 01

Decrypted Data in ASCII:
%B4266841088889999^BUSH JR/GEORGE
W.MR^0809101100001100000000046000000?!;4266841088889999=080910110000046
?0
;33333333337676760707077676763333333333767676070707767676333333333376767
607070776767633333333337676760707?2

Decrypted Data in Hex:
2542343236363834313038383838393939395E42555348204A522F47454F52474520572
E4D525E303830393130313130303030313130303030303030303034363030303030303F
213B343236363834313038383838393939393D3038303931303131303030303034363F3
00000000000

Thats all.

In your DUKPT Tdes Decrypt code (which i downloaded here)
How to pass the value for TRACK argument..
that is ,

        var bdk = "0123456789ABCDEFFEDCBA9876543210";
        var ksn = "FFFF9876543210E00008";
        var track = " HERE WHICH TRACK I HAVE TO GIVE HERE EITHER TOTAL TRACK CODE              OR TRACK1 DATA";
        var decBytes = Dukpt.Decrypt(bdk, ksn, BigInt.FromHex(track).GetBytes());

If i pass the above track1data in this code , i got exception says EXCEPTION : Length of the data to decrypt is invalid as sme as previous question.

Waiting for your valuable reply

Thanks..

from dukpt.net.

ichoes avatar ichoes commented on August 30, 2024

Hi SaddamBInSyed,
For securemag you need to modify the code to use the securemag standard.
here is the link for the solution.
#7
#7

In track you can put either track1 or track2, If your card reader is not
set to enhanced mode, you will get track1 and track 2 combined.

*The code will decryrt it fine, you need to parse it after decryption. *

On Fri, Dec 5, 2014 at 11:11 AM, SaddamBInSyed [email protected]
wrote:

Hi sgbj,

Here the full description of what i am trying..

Decryption of a three track ABA card with the original encryption format.
SecureMag Reader with default settings
Original encryption format can be recognized because the high bit of the
fourth byte
underlined (00) is 0.

027D01003F48236B252A343236362A2A2A2A2A2A2A2A393939395E42555348204A
522F47454F52474520572E4D525E2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2
A2A2A2A2A2A2A2A2A2A2A2A2A2A3F2A3B343236362A2A2A2A2A2A2A2A3939
39393D2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A3F2A3B3333333333333333333337
363736373630373037303737363736373633333333333333333333373637363736303730
373037373637363736333333333333333333333736373637363037303730373736373637
3633333333333333333333373637363736303730373F32863E9E3DA28E455B28F7736
B77E47A64EDDA3BF03A06E44F31D1818C0BCD7A353FB1AD70EFD30FFC3DA08
A4FBC9372E57E8B40848BAEAA3FE724B3550E2F4B223E6BF264BEAE9E39142B6
48CDB51FB8DAF8EA5B63913D29419B67582FCCCE9B372660F03668CC453216D9
449C6B67EF33418AC88F65E1DB7ED4D10973F99DFC8463FF6DF113B6226C4898A
9D355057ECAF11A5598F02CA3162994901190000000001399F03

STX, Length (LSB, MSB), card type, track status, length track 1, length
track 2, length
track 3

02 7D01 00 3F 48 23 6B
The above broken down and interpreted
02—STX character
7D—low byte of total length
01—high byte of total length
00—card type byte (interpretation old format ABA card)
3F—3 tracks of data all good
48—track 1 clear/mask data length
23—track 2 clear/mask data length
6B— track 3 clear/mask data length

Track 1 data masked (length 0x48)
252A343236362A2A2A2A2A2A2A2A393939395E42555348204A522F47454F5247452
0572E4D525E2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2
A2A2A2A2A2A2A3F2A

Track 2 data in hex masked (length 0x23)
3B343236362A2A2A2A2A2A2A2A393939393D2A2A2A2A2A2A2A2A2A2A2A2A2
A2A2A3F2A

Track 3 data unencrypted (length 0x6B)
3B333333333333333333333736373637363037303730373736373637363333333333333
333333337363736373630373037303737363736373633333333333333333333373637363
73630373037303737363736373633333333333333333333373637363736303730373F32

Track 1 & 2 encrypted length 0x48+0x23 rounded up to 8 bytes =0x6B -> 0x70
(112
decimal)
863E9E3DA28E455B28F7736B77E47A64EDDA3BF03A06E44F31D1818C0BCD7A3
53FB1AD70EFD30FFC3DA08A4FBC9372E57E8B40848BAEAA3FE724B3550E2F4B
223E6BF264BEAE9E39142B648CDB51FB8DAF8EA5B63913D29419B67582FCCCE
9B372660F03668CC453216D9449C6B67EF3

Track 1 hashed
3418AC88F65E1DB7ED4D10973F99DFC8463FF6DF
Track 2 hashed
113B6226C4898A9D355057ECAF11A5598F02CA31
KSN
62994901190000000001
LRC, checksum and ETX
39 9F 03

Masked Data:

Track 1 data masked in ASCII:
%
4266_9999^BUSH JR/GEORGE W.MR
http://W.MR^_
***********************?

Track 2 data masked in ASCII:
;4266*******9999=*************?

Track 3 data unencrypted in ASCII:
;33333333337676760707077676763333333333767676070707767676333333333376767
607070776767633333333337676760707?2

Key Value: F8 2A 7A 0D 7C 67 46 F1 96 18 9A FB 54 2C 65 A3

KSN: 62 99 49 01 19 00 00 00 00 01

Decrypted Data in ASCII:
%B4266841088889999^BUSH JR/GEORGE
W.MR^0809101100001100000000046000000?!;4266841088889999=080910110000046
?0
;33333333337676760707077676763333333333767676070707767676333333333376767
607070776767633333333337676760707?2

Decrypted Data in Hex:
2542343236363834313038383838393939395E42555348204A522F47454F52474520572
E4D525E303830393130313130303030313130303030303030303034363030303030303F
213B343236363834313038383838393939393D3038303931303131303030303034363F3
00000000000

Thats all.

In your DUKPT Tdes Decrypt code (which i downloaded here)
How to pass the value for TRACK argument..
that is ,

    var bdk = "0123456789ABCDEFFEDCBA9876543210";
    var ksn = "FFFF9876543210E00008";
    var track = " HERE WHICH TRACK I HAVE TO GIVE HERE EITHER TOTAL TRACK CODE              OR TRACK1 DATA";
    var decBytes = Dukpt.Decrypt(bdk, ksn, BigInt.FromHex(track).GetBytes());

If i pass the above track1data in this code , i got exception says
EXCEPTION : Length of the data to decrypt is invalid as sme as previous
question.

Waiting for your valuable reply

Thanks..


Reply to this email directly or view it on GitHub
#8 (comment).

Rafael Gonzalez
Developer
www.emobilepos.com

from dukpt.net.

SaddamBInSyed avatar SaddamBInSyed commented on August 30, 2024

@ Ichoes Thank you very much for valuable reply.

I will try this and come back..

from dukpt.net.

SaddamBInSyed avatar SaddamBInSyed commented on August 30, 2024

@ichoes
can you send me the full implementation code.

It would be nice if u can do so.

My mail id : [email protected]

from dukpt.net.

SaddamBInSyed avatar SaddamBInSyed commented on August 30, 2024

Hi ichoes,
I have copied the CreateSessionKey() from your post and while running
I go the exception says "Specified key is not a valid size for this algorithm"

in transform() function

pls help me

from dukpt.net.

SaddamBInSyed avatar SaddamBInSyed commented on August 30, 2024

Worked nicely.

Thanks all for your support....

Bye

from dukpt.net.

SaddamBInSyed avatar SaddamBInSyed commented on August 30, 2024

Hi ..

I have successfully done the decrypt and encrypt operation. now i need the CVV number for to disply into the GUI.

How can i get the CVV number for IDTech SecureMag Reader..

Kindly help me

from dukpt.net.

Related Issues (18)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.