Last active
July 19, 2019 01:03
-
-
Save Nosmadas/e16602117f067d9cc66c7756e4d63c4e to your computer and use it in GitHub Desktop.
MIsc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ArqcGeneratorTests | |
{ | |
private string MasterKey = "9E15204313F7318ACB79B90BD986AD29"; | |
private readonly ArqcGenerator _arqcGenerator = new ArqcGenerator(); | |
/// <summary> | |
/// Generates a chip card master key using the issuers master key. | |
/// Also sometimes known as UDK (User derived key) | |
/// </summary> | |
[Fact] | |
public void GenerateIccMasterKey() | |
{ | |
var pan = "5204730000000013"; | |
var panSequenceNumber = "00"; | |
var result = _arqcGenerator.GenerateIccMasterKey(MasterKey, pan, panSequenceNumber); | |
result.ShouldBe("23EA67CDB0315D7C581F0ED6077A761F"); | |
} | |
[Fact] | |
public void GenerateSessionKey() | |
{ | |
var iccMasterKey = "23EA67CDB0315D7C581F0ED6077A761F"; | |
var applicationTransactionCounter = "01F6"; | |
var unpredictableNumber = "040F2741"; | |
var result = _arqcGenerator.GenerateSessionKey(iccMasterKey, applicationTransactionCounter, unpredictableNumber); | |
result.ShouldBe("A8D5A18040B3D915573170ABA816084C"); | |
} | |
[Fact] | |
public void GenerateArqc() | |
{ | |
var sessionKey = "A8D5A18040B3D915573170ABA816084C"; | |
var result = _arqcGenerator.GenerateArqc(new ArqcGenerationRequest | |
{ | |
Pan = "5204730000000013", | |
Amount = "000000001000", | |
AmountOther = "000000000000", | |
CountryCode = "0840", | |
VerificationResults = "0000000000", | |
CurrencyCode = "0840", | |
TransactionDate = "180831", | |
TransactionType = "00", | |
UnpredictableNumber = "040F2741", | |
ApplicationInterchangeProfile = "5800", | |
ApplicationTransactionCounter = "01F6", | |
CardVerificationResults = "03250000" | |
}); | |
result.ShouldBe("984622B67AA575CF"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment