DBA Data[Home] [Help]

PACKAGE: APPS.IBY_SECURITY_PKG

Source


1 PACKAGE IBY_SECURITY_PKG AUTHID CURRENT_USER AS
2 /* $Header: ibysecs.pls 120.26.12020000.2 2013/04/05 06:18:15 gmamidip ship $ */
3 
4  --
5  -- module name used for the application debugging framework
6  --
7  G_DEBUG_MODULE CONSTANT VARCHAR2(100) := 'iby.plsql.IBY_SECURITY_PKG';
8 
9   -- Encryption modes
10   G_ENCRYPT_MODE_SCHED CONSTANT VARCHAR2(30) := 'SCHEDULED';
11   G_ENCRYPT_MODE_NONE CONSTANT VARCHAR2(30) := 'NONE';
12   G_ENCRYPT_MODE_INSTANT CONSTANT VARCHAR2(30) := 'IMMEDIATE';
13 
14   -- Mask options
15   G_MASK_NONE CONSTANT VARCHAR2(30) := 'DISPLAY_ALL';
16   G_MASK_ALL CONSTANT VARCHAR2(30) := 'DISPLAY_NONE';
17   G_MASK_PREFIX CONSTANT VARCHAR2(30) := 'DISPLAY_LAST';
18   G_MASK_POSTFIX CONSTANT VARCHAR2(30) := 'DISPLAY_FIRST';
19 
20   -- Clear-text encoding schemes
21   G_ENCODING_NUMERIC CONSTANT VARCHAR2(30) := 'NUMERIC';
22   G_ENCODING_UTF8_AL32 CONSTANT VARCHAR2(30) := 'AL32UTF8';
23 
24   --
25   -- Maximum length (in bytes) of a triple DES key.
26   --
27   G_DES3_MAX_KEY_LEN CONSTANT INTEGER := 24;
28 
29   --
30   -- shared FND wallet; used for making http callouts from the
31   -- database
32   --
33   C_SHARED_WALLET_LOC_PROP_NAME CONSTANT VARCHAR2(50) := 'FND_DB_WALLET_DIR';
34 
35   -- Masking character
36   G_MASK_CHARACTER CONSTANT VARCHAR2(1) := 'X';
37 
38   -- Expiry date string format to be used before encryption
39   -- Do not modify this variable. This might cause existing
40   -- data corruption !!
41   G_ENCRYPTED_EXPDATE_FORMAT         VARCHAR2(20) := 'MMYYYY';
42   G_MASKED_EXPDATE_FORMAT            VARCHAR2(20) := 'MM/YY';
43 
44 
45   SUBTYPE DES3_KEY_TYPE IS RAW(24);
46 
47 
48   --
49   -- USE
50   --    Validates the system security key
51   --
52   -- ARGS
53   --    p_sys_sec_key => system security key in plain text form
54   --
55   -- OUTS
56   --    x_err_code => IBY_XXXX type error code if the key failed to validate
57   --                  or NULL if validation succeeds
58   --
59   PROCEDURE Validate_Sys_Key
60   (p_sys_sec_key   IN  DES3_KEY_TYPE,
61    x_err_code      OUT NOCOPY VARCHAR2
62   );
63 
64   --
65   -- USE
66   --    Creates the system security key
67   --
68   -- ARGS
69   --    p_sys_sec_key => the system security key
70   --    p_wallet_path => the path of the key wallet
74   --    prepare_des3key() function
71   --
72   -- NOTES
73   --    note that it may be padded or otherwised changed by the
75   --
76   PROCEDURE Create_Sys_Key
77   (p_commit      IN VARCHAR2,
78    p_sys_sec_key IN DES3_KEY_TYPE,
79    p_wallet_path IN VARCHAR2
80   );
81 
82   --
83   -- USE
84   --    Changes the system security key
85   --
86   -- ARGS
87   --    p_commit => Whether to commit changes
88   --    p_sys_key_old => The system security key
89   --    p_sys_key_new => The new security key
90   --    p_wallet_path_new => New wallet patch location
91   --
92   -- NOTES
93   --    note that the new key may be padded or otherwised changed by the
94   --    prepare_des3key() function
95   --
96   PROCEDURE Change_Sys_Key
97   (p_commit        IN     VARCHAR2 := FND_API.G_FALSE,
98    p_sys_key_old   IN     DES3_KEY_TYPE,
99    p_sys_key_new   IN     DES3_KEY_TYPE,
100    p_wallet_path_new IN   VARCHAR2
101   );
102 
103   --
104   -- USE
105   --   Gets the next system subkey, creating a new one if the current
106   --   key has exceeded its usage limit
107   --
108   -- ARGS
109   --   p_commit => Whether to commit changes
110   --   p_masterkey => The system master key
111   --   p_instrument_use_flag => If 'N' then the key is being used on existing
112   --                            data; else it is for new data and so increase
113   --                            its use count
114   --   x_subkey_id => primary key of the sub-key to use
115   --   x_subkey => subkey clear text
116   --
117   PROCEDURE Get_Sys_Subkey
118   (p_commit        IN     VARCHAR2 := FND_API.G_FALSE,
119    p_masterkey     IN     DES3_KEY_TYPE,
120    p_inc_use_flag  IN     VARCHAR2,
121    x_subkey_id     OUT NOCOPY iby_sys_security_subkeys.sec_subkey_id%TYPE,
122    x_subkey        OUT NOCOPY DES3_KEY_TYPE
123   );
124 
125   --
126   -- USE
127   --   Gets the subkey based upon its cipher-text values from the database
128   -- ARGS
129   --   p_masterkey => The system master key
130   --   p_subkey_cipher => The subkey cipher text
131   --
132   FUNCTION Get_Sys_Subkey
133   (p_sys_key       IN     DES3_KEY_TYPE,
134    p_subkey_cipher IN     iby_sys_security_subkeys.subkey_cipher_text%TYPE
135   )
136   RETURN DES3_KEY_TYPE;
137 
138    --
139   -- USE
140   --   Gets the next system subkey, creating a new one if the current
141   --   key has exceeded its usage limit
142   --   This is similar to the Get_Sys_Subkey API, except for the fact
143   --   that it returns the Hex representation of the subkey as a
144   --   varchar2 value. This can be used by the java layer encryption.
145   --
146   -- ARGS
147   --   p_commit => Whether to commit changes
148   --   p_sys_key => The system master key
149   --   p_instrument_use_flag => If 'N' then the key is being used on existing
150   --                            data; else it is for new data and so increase
151   --                            its use count
152   --   x_subkey_id => primary key of the sub-key to use
153   --   x_subkey_Hex => Hex value of the subkey clear text
154   --
155   PROCEDURE Get_Sys_Subkey_Hex
156   (p_commit        IN     VARCHAR2 := FND_API.G_FALSE,
157    p_sys_key       IN     DES3_KEY_TYPE,
158    p_inc_use_flag  IN     VARCHAR2,
159    x_subkey_id     OUT  NOCOPY iby_sys_security_subkeys.sec_subkey_id%TYPE,
160    x_subkey_Hex    OUT  NOCOPY VARCHAR2
161   );
162 
163   --
164   -- USE
165   --   Gets the Hex form of subkey based upon the subkey_id
166   --   This API will be called to pass the Hex key to java
167   --   layer, which would be in turn used to decrypt the
168   --   acknowledgment files.
169   -- ARGS
170   --   p_sys_key => The system master key
171   --   p_subkey_id => The subkey id
172   --
173   FUNCTION Get_Sys_Subkey_Hex
174   (p_subkey_id     IN     iby_sys_security_subkeys.sec_subkey_id%TYPE,
175    p_sys_key       IN     DES3_KEY_TYPE
176   )
177   RETURN VARCHAR2;
178 
179 
180   --
181   -- USE
182   --    Pads or otherwise prepares clear text to be ciphered
183   --
184   -- ARGS
185   --    p_cleartxt => the data (unencrypted) to prepare
186   --    p_padchar => padding character to use
187   --
188   -- RETURN
189   --    The data padded and ready to be input to a cipher function
190   --
191   FUNCTION Prepare_Cleartxt( p_cleartxt IN VARCHAR2, p_padchar IN VARCHAR2 )
192   RETURN VARCHAR2;
193 
194   --
195   -- USE
196   --    Unpacks or otherwise unpads clear text that was ciphered
197   --
198   -- ARGS
199   --    p_cleartxt => the clear text in its to-be-packed form
200   --    p_padchar => padding character used to pack it
201   --
202   -- RETURN
203   --    The clear text/data as it originally was
204   --
205   FUNCTION Unpack_Cleartxt( p_cleartxt IN VARCHAR2, p_padchar IN VARCHAR2 )
206   RETURN VARCHAR2;
207 
208   --
209   -- USE
210   --   Light-weight ciphering function; does not do any key validation, and
211   --   choses strong encryption was encoding based on in input parameter
212   --
213   -- ARGS
214   --   p_data => the data to cipher
215   --   p_sec_key => encryption key to use; should be already validated
216   --   p_pad => character used to pad the data to appropriate length
217   --   p_encrypt => 'Y' if data should be encrypted; otherwise it will be
218   --                 encoded and the passed security key ignored
219   --
220   FUNCTION Cipher_Data
221   (p_data IN VARCHAR2,
225   )
222    p_sec_key IN IBY_SECURITY_PKG.DES3_KEY_TYPE,
223    p_pad IN VARCHAR2,
224    p_encrypt IN VARCHAR2
226   RETURN VARCHAR2;
227 
228   --
229   -- USE
230   --   Gets the hash value of a string
231   -- ARGS
232   --   p_text => the text
233   --   p_salt => if FND_API.G_TRUE, then the text is "salted"
234   --
235   FUNCTION Get_Hash( p_text IN VARCHAR2, p_salt IN VARCHAR2 )
236   RETURN VARCHAR2;
237 
238   --
239   -- USE
240   --   Gets the hash value of a string
241   -- ARGS
242   --   p_text => the text
243   --   p_salt => if FND_API.G_TRUE, then the text is "salted"
244   --   p_site_salt => RAWTOHEX(IBY_SECURITY_PKG.get_site_salt())
245   --
246   --   bug 7228583
247   FUNCTION Get_Hash( p_text IN VARCHAR2, p_salt IN VARCHAR2, p_site_salt IN VARCHAR2)
248   RETURN VARCHAR2;
249 
250   --
251   -- USE
252   --   Computes a new stronger hash
253   --   p_text => the text
254   --   p_site_salt => The site salt value
255   --
256 
257   FUNCTION Compute_New_Hash (p_text IN VARCHAR2,
258 			     p_site_salt IN RAW
259 			     )
260   RETURN VARCHAR2;
261 
262   --
263   -- USE
264   --   Gets raw site salt
265 
266   FUNCTION get_site_salt
267   RETURN RAW;
268 
269   --
270   -- USE
271   --   Gets the version of the salting scheme
272   --
273   FUNCTION get_salt_version RETURN NUMBER;
274 
275   --
276   -- USE
277   --   Generates hashes for RAW values
278   --
279   FUNCTION Get_Raw_Hash( p_data IN RAW ) RETURN RAW;
280 
281   --
282   -- USE
283   --   Generates the (salted) hash for a key
284   --
285   FUNCTION Get_Key_Hash( p_sys_key IN RAW ) RETURN RAW;
286 
287   --
288   -- USE
289   --   Masks the given data
290   -- ARGS
291   --   p_data => the text to mask
292   --   p_mask_option => on the of the mask option constants; whether to
293   --                    mask all, none, from the beginning, or from the end
294   --                    of the data
295   --   p_unmask_len => number of characters to expose
296   --   p_mask_char => masking character
297   --
298   FUNCTION Mask_Data
299   (p_data IN VARCHAR2,
300    p_mask_option IN VARCHAR2,
301    p_unmask_len IN NUMBER,
302    p_mask_char IN VARCHAR2
303   )
304   RETURN VARCHAR2;
305 
306    --
307   -- USE
308   --   Masks the given date value
309   -- ARGS
310   --   p_date => the date value to mask
311   --   p_return_format => The date format in which the
312   --                      the returned mask value needs to
313   --                      be in.
314   --   p_mask_char => masking character
315   --
316   FUNCTION Mask_Date_Field
317   (p_date IN DATE,
318    p_return_format IN VARCHAR2,
319    p_mask_char IN VARCHAR2
320   )
321   RETURN VARCHAR2;
322 
323   --
324   -- USE
325   --   Gets the unmasked portion of the given data
326   -- ARGS
327   --   p_data => the text to mask
328   --   p_mask_option => on the of the mask option constants; whether to
329   --                    mask all, none, from the beginning, or from the end
330   --                    of the data
331   --   p_unmask_len => number of characters to expose
332   --
333   FUNCTION Get_Unmasked_Data
334   ( p_data IN VARCHAR2, p_mask_option IN VARCHAR2, p_unmask_len IN NUMBER )
335   RETURN VARCHAR2;
336 
337   --
338   -- USE
339   --   Encodes a number into a compressed binary representation
340   -- ARGS
341   --   p_number => The number to encode
342   --   p_des3mask => Whether to mask the data for DES3 encryption
343   -- RETURN
344   --   The number encoded in a unit 8 length hex string
345   -- NOTES
346   --    !!! DO NOT MODIFY THE ESSENTIAL CHARACTERISTICS OF THIS FUNCTION !!!
347   --    !!! DOING SO COULD LEAD TO CREDIT CARD DATA CORRUPTION           !!!
348   --
349   FUNCTION Encode_Number( p_number IN VARCHAR2, p_des3mask IN BOOLEAN )
350   RETURN VARCHAR2;
351 
352   --
353   -- USE
354   --   Decodes a number after decryption
355   -- ARGS
356   --   p_number => The encoded number
357   --   p_length => The number length (in base 10 representation)
358   --   p_des3mask => Whether to unmask the data from DES3 encryption
359   -- NOTES
360   --    !!! DO NOT MODIFY THE ESSENTIAL CHARACTERISTICS OF THIS FUNCTION !!!
361   --    !!! DOING SO COULD LEAD TO CREDIT CARD DATA CORRUPTION           !!!
362   --
363   FUNCTION Decode_Number
364   ( p_number IN VARCHAR2, p_length IN NUMBER, p_des3mask IN BOOLEAN )
365   RETURN VARCHAR2;
366 
367  --
368   -- USE
369   --   Encodes a number into a compressed binary representation
370   --   This does exactly the same thing as the Encode_Number API
371   --   The only difference is, it pads the input number to
372   --   32-Bytes. This is a PABP mandate for cvv values.
373   -- ARGS
374   --   p_number => The number to encode (CVV)
375   --   p_des3mask => Whether to mask the data for DES3 encryption
376   -- RETURN
377   --   The number encoded in a unit 32 length hex string
378   -- NOTES
379   --    !!! DO NOT MODIFY THE ESSENTIAL CHARACTERISTICS OF THIS FUNCTION !!!
380   --    !!! DOING SO COULD LEAD TO CREDIT CARD DATA CORRUPTION           !!!
381   --
382   FUNCTION Encode_CVV( p_number IN VARCHAR2, p_des3mask IN BOOLEAN )
383   RETURN VARCHAR2;
384 
385 
386   -- USE
390   --   p_segment => raw segment data
387   --   Creates a secure segment using the next subkey.
388   -- ARGS
389   --   p_commit => if FND_API.G_TRUE, commit the data
391   --   p_encoding => binary encoding scheme for the segment data
392   --   p_sys_key => The system key
393   -- OUTS
394   --   x_segment_id => Primary key of the segment created
395   --
396   PROCEDURE Create_Segment
397   (p_commit IN VARCHAR2 := FND_API.G_FALSE,
398    p_segment IN RAW,
399    p_encoding IN VARCHAR2,
400    p_sys_key IN DES3_KEY_TYPE,
401    x_segment_id OUT NOCOPY iby_security_segments.sec_segment_id%TYPE
402   );
403 
404   PROCEDURE Update_Segment
405   (p_commit IN VARCHAR2 := FND_API.G_FALSE,
406    p_segment_id IN iby_security_segments.sec_segment_id%TYPE,
407    p_segment IN RAW,
408    p_encoding IN VARCHAR2,
409    p_sys_key IN DES3_KEY_TYPE,
410    p_subkey_cipher IN DES3_KEY_TYPE
411   );
412 
413   --
414   -- USE
415   --   Creates a security credential for the given key
416   --
417   PROCEDURE Store_Credential( p_key IN VARCHAR2, x_cred OUT NOCOPY NUMBER );
418 
419   --
420   -- USE
421   --   Verifies if the given credential was issued for the given
422   --   key.
423   --
424   PROCEDURE Verify_Credential
425   ( p_key IN VARCHAR2, p_cred IN NUMBER, x_verify OUT NOCOPY VARCHAR2 );
426 
427   --
428   -- USE
429   --   Utility function for reciphering subkeys
430   --
431   FUNCTION Recipher_Key
432   ( p_data IN RAW, p_oldkey IN DES3_KEY_TYPE, p_newkey IN DES3_KEY_TYPE )
433   RETURN RAW;
434 
435   FUNCTION Gen_Des3_Key( p_random_seed IN RAW ) RETURN RAW;
436 
437   --
438   -- USE
439   --   PKCS5 padding function; copied from AFSOCTKB.pls
440   FUNCTION PKCS5_Pad(p_data IN RAW) RETURN RAW;
441 
442   --
443   -- USE
444   --   PKCS5 unpadding function; copied from AFSOCTKB.pls
445   --
446   FUNCTION PKCS5_Unpad(p_data raw) RETURN RAW;
447 
448   /* Bug 6018583: Implementation of the sceurity around Account Option Values
449  	          and Transmission Values
450  	          The entire code written below is added for the above purpose.
451   */
452 
453   --
454   -- encrypt_field_vals
455   -- This function returns sec_segment_id.
456   --
457  FUNCTION encrypt_field_vals
458  	  (
459  	  p_value                 IN  VARCHAR2,
460 	  master_key_in           IN  DES3_KEY_TYPE,
461  	  p_sec_segment_id        IN  NUMBER,
462  	  p_commit                IN  VARCHAR2 DEFAULT 'N'
463  	  ) RETURN NUMBER;
464 
465  --
466  -- encrypt_num_field_vals
467  -- This function returns sec_segment_id.
468  --
469  FUNCTION encrypt_num_field_vals
470  	  (
471  	  p_value                 IN  NUMBER,
472 	  master_key_in           IN  DES3_KEY_TYPE,
473  	  p_sec_segment_id        IN  NUMBER,
474  	  p_commit                IN  VARCHAR2 DEFAULT 'N'
475  	  ) RETURN NUMBER;
476 
477   --
478   -- encrypt_date_field_vals
479   -- This function returns sec_segment_id.
480   -- This function will truncate the date value to
481   -- mmyyyy format and then create the corresponding
482   -- cipher text.
483   --
484  FUNCTION encrypt_date_field
485  	  (
486  	  p_value                 IN  DATE,
487 	  master_key_in           IN  DES3_KEY_TYPE,
488 	  p_sec_segment_id        IN  NUMBER,
489  	  p_commit                IN  VARCHAR2 DEFAULT 'N'
490  	  ) RETURN NUMBER;
491 
492  --
493  -- decrypt_field_vals
494  -- This function returns decrypted value.
495  --
496  FUNCTION decrypt_field_vals
497  	  (
498  	  p_sec_segment_id        IN  NUMBER,
499  	  master_key_in           IN  DES3_KEY_TYPE
500  	  ) RETURN VARCHAR2;
501 
502  --
503  -- decrypt_num_field_vals
504  -- This function returns decrypted value.
505  --
506  FUNCTION decrypt_num_field_vals
507  	  (
508  	  p_sec_segment_id        IN  NUMBER,
509  	  master_key_in           IN  DES3_KEY_TYPE
510  	  ) RETURN NUMBER;
511  --
512  -- decrypt_date_field_vals
513  -- This function returns decrypted date value that is
514  -- truncated to the last day of month.
515  --
516  FUNCTION decrypt_date_field
517  	  (
518  	  p_sec_segment_id        IN  NUMBER,
519  	  master_key_in           IN  DES3_KEY_TYPE
520  	  ) RETURN DATE;
521 
522  -- [Author]: lmallick
523  -- The procedure migrates the 11i vaulted system key
524  PROCEDURE Init_App_With_Vaulted_Key
525          (
526 	   p_wallet_path   IN iby_sys_security_options.SYS_KEY_FILE_LOCATION%TYPE,
527 	   x_sys_key       OUT NOCOPY DES3_KEY_TYPE,
528 	   x_result_msg    OUT NOCOPY VARCHAR2,
529 	   x_aux_msg       OUT NOCOPY VARCHAR2
530 	 );
531 
532   PROCEDURE Compress_CC_Number
533   (p_card_number IN iby_creditcard.ccnumber%TYPE,
534    p_prefix      IN iby_cc_issuer_ranges.card_number_prefix%TYPE,
535    p_digit_check IN iby_creditcard_issuers_b.digit_check_flag%TYPE,
536    p_mask_setting IN iby_sys_security_options.credit_card_mask_setting%TYPE,
537    p_unmask_len  IN iby_sys_security_options.credit_card_unmask_len%TYPE,
538    x_compress_num OUT NOCOPY iby_creditcard.ccnumber%TYPE,
539    x_unmask_digits OUT NOCOPY iby_creditcard.masked_cc_number%TYPE
540   );
541 
542   FUNCTION Uncompress_CC_Number
543   (p_card_number IN iby_creditcard.ccnumber%TYPE,
544    p_card_length IN iby_creditcard.cc_number_length%TYPE,
545    p_prefix      IN iby_cc_issuer_ranges.card_number_prefix%TYPE,
546    p_digit_check IN iby_creditcard_issuers_b.digit_check_flag%TYPE,
547    p_mask_setting IN iby_sys_security_options.credit_card_mask_setting%TYPE,
548    p_unmask_len  IN iby_sys_security_options.credit_card_unmask_len%TYPE,
549    p_unmask_digits IN iby_creditcard.masked_cc_number%TYPE
550   )
551   RETURN iby_creditcard.ccnumber%TYPE;
552 
553   FUNCTION Get_Compressed_Len
554   (p_card_length IN iby_creditcard.cc_number_length%TYPE,
555    p_prefix      IN iby_cc_issuer_ranges.card_number_prefix%TYPE,
556    p_digit_check IN iby_creditcard_issuers_b.digit_check_flag%TYPE,
557    p_mask_setting IN iby_sys_security_options.credit_card_mask_setting%TYPE,
558    p_unmask_len  IN iby_sys_security_options.credit_card_unmask_len%TYPE
559   )
560   RETURN NUMBER;
561 
562   FUNCTION uncipher_ccnumber
563   (p_cc_number     IN     iby_creditcard.ccnumber%TYPE,
564    p_segment_cipher IN    iby_security_segments.segment_cipher_text%TYPE,
565    p_encrypted     IN     iby_creditcard.encrypted%TYPE,
566    p_sys_key       IN     iby_security_pkg.DES3_KEY_TYPE,
567    p_subkey_cipher IN     iby_sys_security_subkeys.subkey_cipher_text%TYPE,
568    p_card_len      IN     iby_cc_issuer_ranges.card_number_length%TYPE,
569    p_cc_prefix     IN     iby_cc_issuer_ranges.card_number_prefix%TYPE,
570    p_digit_check   IN     iby_creditcard_issuers_b.digit_check_flag%TYPE,
571    p_mask_setting  IN     iby_sys_security_options.credit_card_mask_setting%TYPE,
572    p_unmask_len    IN     iby_sys_security_options.credit_card_unmask_len%TYPE,
573    p_unmask_digits IN     iby_creditcard.masked_cc_number%TYPE
574   )
575   RETURN iby_creditcard.ccnumber%TYPE;
576 
577   PROCEDURE encrypt_chname
578   (p_sec_key IN iby_security_pkg.DES3_KEY_TYPE,
579    p_chname  IN iby_creditcard.chname%TYPE,
580    p_segment_id IN NUMBER,
581    x_segment_id OUT NOCOPY NUMBER,
582    x_masked_chname OUT NOCOPY iby_creditcard.chname%TYPE,
583    x_mask_setting OUT NOCOPY iby_sys_security_options.credit_card_mask_setting%TYPE,
584    x_unmask_len   OUT NOCOPY iby_sys_security_options.credit_card_unmask_len%TYPE
585    );
586 
587   FUNCTION decrypt_chname
588   (p_sec_key IN iby_security_pkg.DES3_KEY_TYPE,
589    p_instrid  IN iby_creditcard.instrid%TYPE
590   ) RETURN iby_creditcard.chname%TYPE;
591 
592   PROCEDURE prepare_instr_data
593   (p_commit   IN  VARCHAR2,
594    p_sys_key  IN  iby_security_pkg.DES3_KEY_TYPE,
595    p_instrnum IN  iby_trxn_summaries_all.instrnumber%TYPE,
596    p_instrtype IN  iby_trxn_summaries_all.instrtype%TYPE,
597    x_instrnum OUT NOCOPY iby_trxn_summaries_all.instrnumber%TYPE,
598    x_instr_subtype OUT NOCOPY iby_trxn_summaries_all.instrsubtype%TYPE,
599    x_instr_hash    OUT NOCOPY iby_trxn_summaries_all.instrnum_hash%TYPE,
600    x_range_id OUT NOCOPY iby_trxn_summaries_all.instrnum_sec_segment_id%TYPE,
601    x_instr_len OUT NOCOPY iby_trxn_summaries_all.instrnum_length%TYPE,
602    x_segment_id OUT NOCOPY iby_trxn_summaries_all.instrnum_sec_segment_id%TYPE
603   );
604 
605   FUNCTION unencrypt_instr_num
606   (p_instrnum    IN iby_trxn_summaries_all.instrnumber%TYPE,
607    p_payee_key   IN iby_security_pkg.des3_key_type,
608    p_payee_subkey_cipher IN iby_payee_subkeys.subkey_cipher_text%TYPE,
609    p_sys_key     IN RAW,
610    p_sys_subkey_cipher IN iby_sys_security_subkeys.subkey_cipher_text%TYPE,
611    p_segment_id  IN iby_security_segments.sec_segment_id%TYPE,
612    p_segment_cipher IN iby_security_segments.segment_cipher_text%TYPE,
613    p_card_prefix IN iby_cc_issuer_ranges.card_number_prefix%TYPE,
614    p_card_len    IN iby_cc_issuer_ranges.card_number_length%TYPE,
615    p_digit_check IN iby_creditcard_issuers_b.digit_check_flag%TYPE
616   )
617   RETURN iby_trxn_summaries_all.instrnumber%TYPE;
618 
619   PROCEDURE unencrypt_instr_num
620   (trxnmid_in    IN iby_trxn_summaries_all.trxnmid%TYPE,
621    master_key_in IN iby_security_pkg.DES3_KEY_TYPE,
622    instr_num_out OUT NOCOPY iby_trxn_summaries_all.instrnumber%TYPE
623   );
624 
625 --secure data
626 PROCEDURE Encrypt_Setup_Data (
627 p_commit        IN     VARCHAR2 := FND_API.G_FALSE,
628 p_sys_key   IN     iby_security_pkg.DES3_KEY_TYPE,
629 x_err_code OUT NOCOPY VARCHAR2
630 );
631 
632 
633 TYPE Bep_Acct_Opt_Vals_rec is record
634 (
635 BepAccountId                  IBY_BEP_ACCT_OPT_VALS.BEP_ACCOUNT_ID%type,
636 BepAccountOptionCode          IBY_BEP_ACCT_OPT_VALS.ACCOUNT_OPTION_CODE%type,
637 BepAccountOptionValue         IBY_BEP_ACCT_OPT_VALS.ACCOUNT_OPTION_VALUE%type
638 );
639 
640 
641 TYPE Transmit_Vals_rec is record
642 (
643 TransmitValueId               IBY_TRANSMIT_VALUES.TRANSMIT_VALUE_ID%type,
644 TransmitVarchar2Value         IBY_TRANSMIT_VALUES.TRANSMIT_VARCHAR2_VALUE%type,
645 TransmitNumberValue           IBY_TRANSMIT_VALUES.TRANSMIT_NUMBER_VALUE%type,
646 TransmitParameterType         IBY_TRANSMIT_PARAMETERS_vl.TRANSMIT_PARAMETER_TYPE%type
647 );
648 
649 PROCEDURE Decrypt_Setup_Data (
650 p_commit        IN     VARCHAR2 := FND_API.G_FALSE,
651 p_sys_key   IN     iby_security_pkg.DES3_KEY_TYPE,
652 x_err_code OUT NOCOPY VARCHAR2
653 );
654 
655 
656 END IBY_SECURITY_PKG;