Skip to content

Instantly share code, notes, and snippets.

@mlittle
Created May 27, 2012 16:35
Show Gist options
  • Save mlittle/2814993 to your computer and use it in GitHub Desktop.
Save mlittle/2814993 to your computer and use it in GitHub Desktop.
Test code for my PL/SQL PKCS #7 Pad/Trim functions
DECLARE
PROCEDURE sp_test_pkcs7 (pData IN RAW, pBlockSize IN PLS_INTEGER)
IS
vInData RAW(100);
vDataPadded RAW(100);
vDataTrimmed RAW(100);
BEGIN
vInData := hextoraw(pData);
vDataPadded := fn_pkcs7_pad(vInData, pBlockSize);
vDataTrimmed := fn_pkcs7_trim(vDataPadded);
dbms_output.put_line('------------------------------------');
dbms_output.put_line('IN: ' || rawtohex(vInData));
dbms_output.put_line('BLOCK SIZE: ' || pBlockSize);
dbms_output.put_line('PADDED: ' || rawtohex(vDataPadded));
dbms_output.put_line('TRIMMED: ' || rawtohex(vDataTrimmed)) ;
dbms_output.put_line('------------------------------------');
END;
BEGIN
sp_test_pkcs7('AABBCC', 8); --3 bytes of data
sp_test_pkcs7('AABBCCDDEEFF', 8); --6 byes of data
sp_test_pkcs7('AABBCCDDEEFFAABB', 8); --8 bytes of data
END;
/
@mlittle
Copy link
Author

mlittle commented May 27, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment