Skip to content

Commit ef749c1

Browse files
committed
Renamed base class, added further unit test skeletons
Renamed TPadding to TPaddingBase. Added empty stubs for the still missing DUnit unit tests for the paddings and updated the documentation.
1 parent c4ad266 commit ef749c1

File tree

3 files changed

+26
-7
lines changed

3 files changed

+26
-7
lines changed

Docs/DEC65.pdf

-4.5 KB
Binary file not shown.

Source/DECCipherPaddings.pas

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ interface
3737
/// This abstract class defines the basic interfaces for adding, validating,
3838
/// and removing padding.
3939
/// </remarks>
40-
TPadding = class abstract
40+
TPaddingBase = class abstract
4141
/// <summary>
4242
/// Adds padding to the specified data to align it with the given block size.
4343
/// </summary>
@@ -186,7 +186,7 @@ TPadding = class abstract
186186
/// Class type of the padding base class, relevant for the class registration
187187
/// and simplified use in DECipherFormsts.
188188
/// </summary>
189-
TDECPaddingClass = class of TPadding;
189+
TDECPaddingClass = class of TPaddingBase;
190190

191191
/// <summary>
192192
/// Base class for the PKCS7 and ANSI X.923 algorithms, as they are quite similar.
@@ -195,7 +195,7 @@ TDECPaddingClass = class of TPadding;
195195
/// PKCS7 padding is a standard algorithm used in symmetric cryptosystems like AES.
196196
/// It appends the number of padding bytes as the value of the padding itself.
197197
/// </remarks>
198-
TFixedBytePadding = class abstract(TPadding)
198+
TFixedBytePadding = class abstract(TPaddingBase)
199199
strict protected
200200
/// <summary>
201201
/// Check if block size is supported by the concerete padding algorithm.

Unit Tests/Tests/TestDECCipherPaddings.pas

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,16 +71,29 @@ TestTANSI_X9_23Padding = class(TestTPaddingBase)
7171
published
7272
end;
7373

74-
// Test methods for class TANSI_X9_23Padding_Legacy
74+
// Test methods for class TPKCS5Padding
7575
{$IFDEF DUnitX} [TestFixture] {$ENDIF}
76-
TestTANSI_X9_23Padding_Legacy = class(TestTPaddingBase)
76+
TestTPKCS5Padding = class(TestTPaddingBase)
7777
strict private
7878
public
7979
published
8080
end;
8181

82+
// Test methods for class TISO10126Padding
83+
{$IFDEF DUnitX} [TestFixture] {$ENDIF}
84+
TestTISO10126Padding = class(TestTPaddingBase)
85+
strict private
86+
public
87+
published
88+
end;
8289

83-
// {, pmISO10126, pmISO7816
90+
// Test methods for class TISO7816Padding
91+
{$IFDEF DUnitX} [TestFixture] {$ENDIF}
92+
TestTISO7816Padding = class(TestTPaddingBase)
93+
strict private
94+
public
95+
published
96+
end;
8497

8598
implementation
8699

@@ -247,8 +260,14 @@ initialization
247260
{$IFDEF DUnitX}
248261
TDUnitX.RegisterTestFixture(TestTPKCS7Padding);
249262
TDUnitX.RegisterTestFixture(TestTANSI_X9_23Padding);
263+
TDUnitX.RegisterTestFixture(TestTPKCS5Padding);
264+
TDUnitX.RegisterTestFixture(TestTISO10126Padding);
265+
TDUnitX.RegisterTestFixture(TestTISO7816Padding);
250266
{$ELSE}
251267
RegisterTests('DECCipherPaddings', [TestTPKCS7Padding.Suite,
252-
TestTANSI_X9_23Padding.Suite]);
268+
TestTANSI_X9_23Padding.Suite,
269+
TestTPKCS5Padding.Suite,
270+
TestTISO10126Padding.Suite,
271+
TestTISO7816Padding.Suite]);
253272
{$ENDIF}
254273
end.

0 commit comments

Comments
 (0)