public void GetTotalEncryptionPasses_ShouldReturnNumberOfPasses_WhenCalled(string ksn, int expectedValue)
        {
            byte[] initialKSN = ConversionHelper.HexToByteArray(ksn);

            Helper.CallPrivateMethod("GetTotalEncryptionPasses", subject, out List <int> passList, new object[] { initialKSN });

            Assert.Equal(expectedValue, passList.Count);
        }
        public void DecryptData_ShouldDecryptTrackData_WhenCalled(string ksn, string encryptedTrack, string decryptedTrack)
        {
            byte[] expectedValue = ConversionHelper.HexToByteArray(decryptedTrack);

            byte[] actualValue = subject.DecryptData(ksn, encryptedTrack);

            Assert.Equal(expectedValue, actualValue);
        }
示例#3
0
        public void DecryptPinData_ShouldDecryptPinData_WhenCalled(string ksn, string pan, string encryptedPinData, string decryptedPinData)
        {
            byte[] expectedValue = ConversionHelper.HexToByteArray(decryptedPinData);

            byte[] actualValue = subject.DecryptData(ksn, encryptedPinData);

            Assert.Equal(expectedValue, actualValue);

            // Decode PIN Block: format ISO-0
        }
        //[InlineData("23B281E8E126E1EA3630353137373131313131383D3235313231303130373130383036393930303030303F33DFDB053525423337393630353137373131313131385E49534F2F414D455854455354202020205E323531323130313037313038303639393F3F800000", "", "ISO/AMEXTEST    ", "071080699")]
        //[InlineData("2542343831353838313030323836313839365E444F452F4C204A4F484E2020202020202020202020205E3232313231303233353638353820202020202030303939383030303030303F", "", "DOE/L JOHN            ", "")]
        //[InlineData("7846D845D274861F32343138303030313233343536335E4644435320544553542043415244202F4D4153544552434152445E32353132313031303030313131313132333435363738393031323F438000", "", "FDCS TEST CARD /MASTERCARD", "")]
        //[InlineData("19143D2F3491E8AA3935333139323335313030343D323530323135303331323334353F3BDFDB053E254233373339203533313932332035313030345E414D45582054455354204341524420414E5349202020202020205E323030383130303831323334353F5D8000", "", "AMEX TEST CARD ANSI       ", "")]
        public void RetrieveTrackData_ShouldProcessTrackData_WhenCalled(string decryptedTrack, string panData, string cardholderName, string discretionaryData)
        {
            byte[] trackInformation = ConversionHelper.HexToByteArray(decryptedTrack);

            MSRTrackData trackData = subject.RetrieveTrackData(trackInformation);

            Assert.NotNull(trackData.PANData);
            Assert.NotNull(trackData.Name);
            Assert.NotNull(trackData.ExpirationDate);
            Assert.Equal(panData, trackData.PANData);
            Assert.Equal(cardholderName, trackData.Name);
            Assert.Equal(discretionaryData, trackData.DiscretionaryData);
        }