Created
May 27, 2012 16:25
-
-
Save mlittle/2814959 to your computer and use it in GitHub Desktop.
Oracle PL/SQL function that removes PKCS #7 padding from the input
This file contains hidden or 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
| CREATE OR REPLACE FUNCTION fn_PKCS7_Trim(pData IN RAW) | |
| RETURN RAW | |
| IS | |
| vPadSize PLS_INTEGER; | |
| vPadValue RAW(2); | |
| BEGIN | |
| vPadValue := utl_raw.substr(pData, -1, 1); | |
| vPadSize := to_number(rawtohex(vPadValue), 'XX'); | |
| RETURN utl_raw.substr(pData, 1, utl_raw.length(pData) - vPadSize); | |
| END; | |
| / |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
More details on this function: http://matthewjlittle.com/2011/07/02/plsql-pkcs-7-padding/