1644: IF (NOT p_ext_bank_acct_rec.bank_account_num IS NULL) THEN
1645: l_masked_ba_num :=
1646: Mask_Bank_Number(nvl(l_account_number, p_ext_bank_acct_rec.bank_account_num),lx_mask_option,
1647: lx_unmask_len);
1648: l_ba_num_hash1 := iby_security_pkg.Get_Hash
1649: (nvl(l_account_number, p_ext_bank_acct_rec.bank_account_num),'F');
1650: l_ba_num_hash2 := iby_security_pkg.Get_Hash
1651: (nvl(l_account_number, p_ext_bank_acct_rec.bank_account_num),'T');
1652: END IF;
1646: Mask_Bank_Number(nvl(l_account_number, p_ext_bank_acct_rec.bank_account_num),lx_mask_option,
1647: lx_unmask_len);
1648: l_ba_num_hash1 := iby_security_pkg.Get_Hash
1649: (nvl(l_account_number, p_ext_bank_acct_rec.bank_account_num),'F');
1650: l_ba_num_hash2 := iby_security_pkg.Get_Hash
1651: (nvl(l_account_number, p_ext_bank_acct_rec.bank_account_num),'T');
1652: END IF;
1653:
1654: IF (NOT p_ext_bank_acct_rec.iban IS NULL) THEN
1654: IF (NOT p_ext_bank_acct_rec.iban IS NULL) THEN
1655: l_masked_iban :=
1656: Mask_Bank_Number(p_ext_bank_acct_rec.iban,lx_mask_option,
1657: lx_unmask_len);
1658: l_iban_hash1 := iby_security_pkg.Get_Hash(p_ext_bank_acct_rec.iban,'F');
1659: l_iban_hash2 := iby_security_pkg.Get_Hash(p_ext_bank_acct_rec.iban,'T');
1660: END IF;
1661:
1662: -- inserting the new account into IBY_EXT_BANK_ACCOUNTS
1655: l_masked_iban :=
1656: Mask_Bank_Number(p_ext_bank_acct_rec.iban,lx_mask_option,
1657: lx_unmask_len);
1658: l_iban_hash1 := iby_security_pkg.Get_Hash(p_ext_bank_acct_rec.iban,'F');
1659: l_iban_hash2 := iby_security_pkg.Get_Hash(p_ext_bank_acct_rec.iban,'T');
1660: END IF;
1661:
1662: -- inserting the new account into IBY_EXT_BANK_ACCOUNTS
1663: INSERT INTO IBY_EXT_BANK_ACCOUNTS
1794: p_ext_bank_acct_rec.short_acct_name, --SHORT_ACCT_NAME
1795: p_ext_bank_acct_rec.description, --DESCRIPTION
1796: 'N', -- encrypted
1797: l_bank_account_num_electronic,
1798: iby_security_pkg.get_salt_version,
1799: p_ext_bank_acct_rec.secondary_account_reference, -- Bug 7408747
1800: p_ext_bank_acct_rec.contact_name,
1801: p_ext_bank_acct_rec.contact_phone,
1802: p_ext_bank_acct_rec.contact_email,
2476:
2477: if (NOT l_acct_number IS NULL) then
2478: IF ( G_LEVEL_STATEMENT >= G_CURRENT_RUNTIME_LEVEL) THEN
2479: print_debuginfo('The value of Get_Hash(l_acct_number,F): '||
2480: iby_security_pkg.Get_Hash(l_acct_number,'F'));
2481: print_debuginfo('The value of Get_Hash(l_acct_number,T): '||
2482: iby_security_pkg.Get_Hash(l_acct_number,'T'));
2483: print_debuginfo('The value of l_ba_num_hash1: ' ||l_ba_num_hash1);
2484: print_debuginfo('The value of l_ba_num_hash1: '|| l_ba_num_hash2);
2478: IF ( G_LEVEL_STATEMENT >= G_CURRENT_RUNTIME_LEVEL) THEN
2479: print_debuginfo('The value of Get_Hash(l_acct_number,F): '||
2480: iby_security_pkg.Get_Hash(l_acct_number,'F'));
2481: print_debuginfo('The value of Get_Hash(l_acct_number,T): '||
2482: iby_security_pkg.Get_Hash(l_acct_number,'T'));
2483: print_debuginfo('The value of l_ba_num_hash1: ' ||l_ba_num_hash1);
2484: print_debuginfo('The value of l_ba_num_hash1: '|| l_ba_num_hash2);
2485:
2486: END IF;
2483: print_debuginfo('The value of l_ba_num_hash1: ' ||l_ba_num_hash1);
2484: print_debuginfo('The value of l_ba_num_hash1: '|| l_ba_num_hash2);
2485:
2486: END IF;
2487: if ( (iby_security_pkg.Get_Hash(l_acct_number,'F') = l_ba_num_hash1)
2488: AND (iby_security_pkg.Get_Hash(l_acct_number,'T') = l_ba_num_hash2)
2489: )
2490: then
2491: IF ( G_LEVEL_STATEMENT >= G_CURRENT_RUNTIME_LEVEL) THEN
2484: print_debuginfo('The value of l_ba_num_hash1: '|| l_ba_num_hash2);
2485:
2486: END IF;
2487: if ( (iby_security_pkg.Get_Hash(l_acct_number,'F') = l_ba_num_hash1)
2488: AND (iby_security_pkg.Get_Hash(l_acct_number,'T') = l_ba_num_hash2)
2489: )
2490: then
2491: IF ( G_LEVEL_STATEMENT >= G_CURRENT_RUNTIME_LEVEL) THEN
2492: print_debuginfo('User doesnt change the bank account number');
2495: l_ba_num_hash1:=null;
2496: l_ba_num_hash2:=null;
2497: l_masked_ba_num:=null;
2498: else
2499: l_ba_num_hash1 := iby_security_pkg.Get_Hash(l_acct_number,'F');
2500:
2501: IF ( G_LEVEL_STATEMENT >= G_CURRENT_RUNTIME_LEVEL) THEN
2502: print_debuginfo('User has changed the bank account number');
2503: print_debuginfo('The value of l_masked_ba_num before masking:'||
2502: print_debuginfo('User has changed the bank account number');
2503: print_debuginfo('The value of l_masked_ba_num before masking:'||
2504: l_masked_ba_num);
2505: END IF;
2506: l_ba_num_hash2 := iby_security_pkg.Get_Hash(l_acct_number,'T');
2507: l_masked_ba_num :=
2508: Mask_Bank_Number(l_acct_number,l_mask_option,l_unmask_len);
2509: IF ( G_LEVEL_STATEMENT >= G_CURRENT_RUNTIME_LEVEL) THEN
2510: print_debuginfo('The value of l_masked_ba_num after masking:'||
2536: /*
2537: l_iban :=p_ext_bank_acct_rec.iban;
2538: begin
2539: if (NOT l_iban IS NULL) then
2540: if ( (iby_security_pkg.Get_Hash(l_iban,'F') = l_iban_hash1)
2541: AND (iby_security_pkg.Get_Hash(l_iban,'T') = l_iban_hash2)
2542: )
2543: then
2544: IF ( G_LEVEL_STATEMENT >= G_CURRENT_RUNTIME_LEVEL) THEN
2537: l_iban :=p_ext_bank_acct_rec.iban;
2538: begin
2539: if (NOT l_iban IS NULL) then
2540: if ( (iby_security_pkg.Get_Hash(l_iban,'F') = l_iban_hash1)
2541: AND (iby_security_pkg.Get_Hash(l_iban,'T') = l_iban_hash2)
2542: )
2543: then
2544: IF ( G_LEVEL_STATEMENT >= G_CURRENT_RUNTIME_LEVEL) THEN
2545: print_debuginfo('User doesnt change the IBAN');
2555: IF ( G_LEVEL_STATEMENT >= G_CURRENT_RUNTIME_LEVEL) THEN
2556: print_debuginfo('Validated IBAN Number');
2557:
2558: END IF;
2559: l_iban_hash1 := iby_security_pkg.Get_Hash(l_iban,'F');
2560: l_iban_hash2 := iby_security_pkg.Get_Hash(l_iban,'T');
2561: l_masked_iban := Mask_Bank_Number(l_iban,l_mask_option,l_unmask_len);
2562:
2563: l_encrypted := 'N';
2556: print_debuginfo('Validated IBAN Number');
2557:
2558: END IF;
2559: l_iban_hash1 := iby_security_pkg.Get_Hash(l_iban,'F');
2560: l_iban_hash2 := iby_security_pkg.Get_Hash(l_iban,'T');
2561: l_masked_iban := Mask_Bank_Number(l_iban,l_mask_option,l_unmask_len);
2562:
2563: l_encrypted := 'N';
2564: DELETE FROM iby_security_segments
2596: print_debuginfo('Validated IBAN Number');
2597: print_debuginfo(x_return_status);
2598: print_debuginfo(l_iban);
2599: END IF;
2600: l_iban_hash1 := iby_security_pkg.Get_Hash(l_iban,'F');
2601: IF ( G_LEVEL_STATEMENT >= G_CURRENT_RUNTIME_LEVEL) THEN
2602: print_debuginfo(l_iban_hash1);
2603: END IF;
2604: l_iban_hash2 := iby_security_pkg.Get_Hash(l_iban,'T');
2600: l_iban_hash1 := iby_security_pkg.Get_Hash(l_iban,'F');
2601: IF ( G_LEVEL_STATEMENT >= G_CURRENT_RUNTIME_LEVEL) THEN
2602: print_debuginfo(l_iban_hash1);
2603: END IF;
2604: l_iban_hash2 := iby_security_pkg.Get_Hash(l_iban,'T');
2605: IF ( G_LEVEL_STATEMENT >= G_CURRENT_RUNTIME_LEVEL) THEN
2606: print_debuginfo(l_iban_hash2);
2607: END IF;
2608: l_masked_iban := Mask_Bank_Number(l_iban,l_mask_option,l_unmask_len);
2789:
2790: if (NOT l_acct_number IS NULL) then
2791: IF ( G_LEVEL_STATEMENT >= G_CURRENT_RUNTIME_LEVEL) THEN
2792: print_debuginfo('The value of Get_Hash(l_acct_number,F): '||
2793: iby_security_pkg.Get_Hash(l_acct_number,'F'));
2794: print_debuginfo('The value of Get_Hash(l_acct_number,T): '||
2795: iby_security_pkg.Get_Hash(l_acct_number,'T'));
2796: print_debuginfo('The value of l_ba_num_hash1: ' ||l_ba_num_hash1);
2797: print_debuginfo('The value of l_ba_num_hash1: '|| l_ba_num_hash2);
2791: IF ( G_LEVEL_STATEMENT >= G_CURRENT_RUNTIME_LEVEL) THEN
2792: print_debuginfo('The value of Get_Hash(l_acct_number,F): '||
2793: iby_security_pkg.Get_Hash(l_acct_number,'F'));
2794: print_debuginfo('The value of Get_Hash(l_acct_number,T): '||
2795: iby_security_pkg.Get_Hash(l_acct_number,'T'));
2796: print_debuginfo('The value of l_ba_num_hash1: ' ||l_ba_num_hash1);
2797: print_debuginfo('The value of l_ba_num_hash1: '|| l_ba_num_hash2);
2798:
2799: END IF;
2796: print_debuginfo('The value of l_ba_num_hash1: ' ||l_ba_num_hash1);
2797: print_debuginfo('The value of l_ba_num_hash1: '|| l_ba_num_hash2);
2798:
2799: END IF;
2800: if ( (iby_security_pkg.Get_Hash(l_acct_number,'F') = l_ba_num_hash1)
2801: AND (iby_security_pkg.Get_Hash(l_acct_number,'T') = l_ba_num_hash2)
2802: )
2803: then
2804: IF ( G_LEVEL_STATEMENT >= G_CURRENT_RUNTIME_LEVEL) THEN
2797: print_debuginfo('The value of l_ba_num_hash1: '|| l_ba_num_hash2);
2798:
2799: END IF;
2800: if ( (iby_security_pkg.Get_Hash(l_acct_number,'F') = l_ba_num_hash1)
2801: AND (iby_security_pkg.Get_Hash(l_acct_number,'T') = l_ba_num_hash2)
2802: )
2803: then
2804: IF ( G_LEVEL_STATEMENT >= G_CURRENT_RUNTIME_LEVEL) THEN
2805: print_debuginfo('User doesnt change the bank account number');
2809: l_ba_num_hash2:=null;
2810: l_masked_ba_num:=null;
2811: l_bank_account_num_electronic:=null; --Should not touch Elec Bank account num as well
2812: else
2813: l_ba_num_hash1 := iby_security_pkg.Get_Hash(l_acct_number,'F');
2814:
2815: IF ( G_LEVEL_STATEMENT >= G_CURRENT_RUNTIME_LEVEL) THEN
2816: print_debuginfo('User has changed the bank account number');
2817: print_debuginfo('The value of l_masked_ba_num before masking:'||
2816: print_debuginfo('User has changed the bank account number');
2817: print_debuginfo('The value of l_masked_ba_num before masking:'||
2818: l_masked_ba_num);
2819: END IF;
2820: l_ba_num_hash2 := iby_security_pkg.Get_Hash(l_acct_number,'T');
2821: l_masked_ba_num :=
2822: Mask_Bank_Number(l_acct_number,l_mask_option,l_unmask_len);
2823: IF ( G_LEVEL_STATEMENT >= G_CURRENT_RUNTIME_LEVEL) THEN
2824: print_debuginfo('The value of l_masked_ba_num after masking:'||
2852: l_masked_ba_num :=
2853: Mask_Bank_Number(nvl(l_acct_number, p_ext_bank_acct_rec.bank_account_num),l_mask_option,
2854: l_unmask_len);
2855:
2856: l_ba_num_hash1 := iby_security_pkg.Get_Hash
2857: (nvl(l_acct_number, p_ext_bank_acct_rec.bank_account_num),'F');
2858: l_ba_num_hash2 := iby_security_pkg.Get_Hash
2859: (nvl(l_acct_number, p_ext_bank_acct_rec.bank_account_num),'T');
2860:
2854: l_unmask_len);
2855:
2856: l_ba_num_hash1 := iby_security_pkg.Get_Hash
2857: (nvl(l_acct_number, p_ext_bank_acct_rec.bank_account_num),'F');
2858: l_ba_num_hash2 := iby_security_pkg.Get_Hash
2859: (nvl(l_acct_number, p_ext_bank_acct_rec.bank_account_num),'T');
2860:
2861: END IF;
2862:
3649: check_mandatory('IBY_BANKACCT_NUM_FIELD',p_ext_bank_acct_rec.bank_account_num);
3650: END IF;
3651:
3652: IF (p_ext_bank_acct_rec.bank_account_num_hash1 IS NULL AND p_ext_bank_acct_rec.bank_account_num_hash2 IS NULL) THEN
3653: l_ba_num_hash1 := iby_security_pkg.get_hash(p_ext_bank_acct_rec.bank_account_num,'F');
3654: l_ba_num_hash2 := iby_security_pkg.get_hash(p_ext_bank_acct_rec.bank_account_num,'T');
3655: ELSE
3656: l_ba_num_hash1 := p_ext_bank_acct_rec.bank_account_num_hash1;
3657: l_ba_num_hash2 := p_ext_bank_acct_rec.bank_account_num_hash2;
3650: END IF;
3651:
3652: IF (p_ext_bank_acct_rec.bank_account_num_hash1 IS NULL AND p_ext_bank_acct_rec.bank_account_num_hash2 IS NULL) THEN
3653: l_ba_num_hash1 := iby_security_pkg.get_hash(p_ext_bank_acct_rec.bank_account_num,'F');
3654: l_ba_num_hash2 := iby_security_pkg.get_hash(p_ext_bank_acct_rec.bank_account_num,'T');
3655: ELSE
3656: l_ba_num_hash1 := p_ext_bank_acct_rec.bank_account_num_hash1;
3657: l_ba_num_hash2 := p_ext_bank_acct_rec.bank_account_num_hash2;
3658: END IF;
4942: )
4943: RETURN VARCHAR2
4944: IS
4945: BEGIN
4946: RETURN iby_security_pkg.Mask_Data
4947: (p_bank_number,p_mask_option,p_unmask_len,G_MASK_CHARACTER);
4948: END Mask_Bank_Number;
4949:
4950: PROCEDURE Compress_Bank_Number
4960: l_substr_start NUMBER;
4961: l_substr_stop NUMBER;
4962: BEGIN
4963: x_unmask_digits :=
4964: iby_security_pkg.Get_Unmasked_Data
4965: (p_bank_number,p_mask_setting,p_unmask_len);
4966: l_unmask_len := NVL(LENGTH(x_unmask_digits),0);
4967:
4968: -- all digits exposed; compressed number is trivial
4970: x_compress_num := NULL;
4971: RETURN;
4972: END IF;
4973:
4974: IF ( (p_mask_setting = iby_security_pkg.G_MASK_POSTFIX) )
4975: THEN
4976: l_substr_start := l_unmask_len + 1;
4977: ELSE
4978: l_substr_start := 1;
4977: ELSE
4978: l_substr_start := 1;
4979: END IF;
4980:
4981: IF (p_mask_setting = iby_security_pkg.G_MASK_PREFIX)
4982: AND (p_unmask_len>0)
4983: THEN
4984: l_substr_stop := GREATEST(LENGTH(p_bank_number)-p_unmask_len,0);
4985: ELSE
4996:
4997: FUNCTION Uncipher_Bank_Number
4998: (p_unmask_digits IN VARCHAR2,
4999: p_segment_id IN iby_security_segments.sec_segment_id%TYPE,
5000: p_sys_key IN iby_security_pkg.DES3_KEY_TYPE,
5001: p_sub_key_cipher IN iby_sys_security_subkeys.subkey_cipher_text%TYPE,
5002: p_segment_cipher IN iby_security_segments.segment_cipher_text%TYPE,
5003: p_encoding IN iby_security_segments.encoding_scheme%TYPE,
5004: p_mask_option IN iby_ext_bank_accounts.ba_mask_setting%TYPE,
5019: RETURN p_unmask_digits;
5020: END IF ;
5021:
5022: -- uncipher the subkey
5023: l_sub_key := iby_security_pkg.get_sys_subkey(p_sys_key,p_sub_key_cipher);
5024:
5025: -- uncipher the segment
5026: l_bank_segment :=
5027: dbms_obfuscation_toolkit.des3decrypt
5027: dbms_obfuscation_toolkit.des3decrypt
5028: ( input => p_segment_cipher, key => l_sub_key,
5029: which => dbms_obfuscation_toolkit.ThreeKeyMode
5030: );
5031: l_bank_segment := IBY_SECURITY_PKG.PKCS5_UNPAD(l_bank_segment);
5032: l_bank_num := UTL_I18N.RAW_TO_CHAR(l_bank_segment,p_encoding);
5033:
5034: IF (NOT p_unmask_digits IS NULL) THEN
5035: IF (p_mask_option = iby_security_pkg.G_MASK_POSTFIX) THEN
5031: l_bank_segment := IBY_SECURITY_PKG.PKCS5_UNPAD(l_bank_segment);
5032: l_bank_num := UTL_I18N.RAW_TO_CHAR(l_bank_segment,p_encoding);
5033:
5034: IF (NOT p_unmask_digits IS NULL) THEN
5035: IF (p_mask_option = iby_security_pkg.G_MASK_POSTFIX) THEN
5036: l_bank_num := p_unmask_digits || l_bank_num;
5037: ELSIF (p_mask_option = iby_security_pkg.G_MASK_PREFIX) THEN
5038: l_bank_num := l_bank_num || p_unmask_digits;
5039: END IF;
5033:
5034: IF (NOT p_unmask_digits IS NULL) THEN
5035: IF (p_mask_option = iby_security_pkg.G_MASK_POSTFIX) THEN
5036: l_bank_num := p_unmask_digits || l_bank_num;
5037: ELSIF (p_mask_option = iby_security_pkg.G_MASK_PREFIX) THEN
5038: l_bank_num := l_bank_num || p_unmask_digits;
5039: END IF;
5040: END IF;
5041:
5043: END Uncipher_Bank_Number;
5044:
5045: PROCEDURE Remask_Accounts
5046: (p_commit IN VARCHAR2 := FND_API.G_TRUE,
5047: p_sys_key IN iby_security_pkg.DES3_KEY_TYPE
5048: )
5049: IS
5050: lx_mask_option iby_ext_bank_accounts.ba_mask_setting%TYPE;
5051: lx_unmask_len iby_ext_bank_accounts.ba_unmask_length%TYPE;
5101: iby_debug_pub.G_LEVEL_INFO,l_dbg_mod);
5102: iby_debug_pub.add('unmask length:=' || lx_unmask_len,
5103: iby_debug_pub.G_LEVEL_INFO,l_dbg_mod);
5104:
5105: iby_security_pkg.Validate_Sys_Key(p_sys_key,lx_key_error);
5106: l_mode := Get_BA_Encrypt_Mode();
5107:
5108: iby_debug_pub.add('sys key check:=' || lx_key_error,
5109: iby_debug_pub.G_LEVEL_INFO,l_dbg_mod);
5158:
5159: IF (NOT lx_compress_num IS NULL) THEN
5160: l_ba_segment :=
5161: UTL_I18N.STRING_TO_RAW
5162: (lx_compress_num,iby_security_pkg.G_ENCODING_UTF8_AL32);
5163: l_ba_segment := IBY_SECURITY_PKG.PKCS5_PAD(l_ba_segment);
5164:
5165: IF (ext_ba_rec.ba_num_sec_segment_id IS NULL) THEN
5166: IBY_SECURITY_PKG.Create_Segment
5159: IF (NOT lx_compress_num IS NULL) THEN
5160: l_ba_segment :=
5161: UTL_I18N.STRING_TO_RAW
5162: (lx_compress_num,iby_security_pkg.G_ENCODING_UTF8_AL32);
5163: l_ba_segment := IBY_SECURITY_PKG.PKCS5_PAD(l_ba_segment);
5164:
5165: IF (ext_ba_rec.ba_num_sec_segment_id IS NULL) THEN
5166: IBY_SECURITY_PKG.Create_Segment
5167: (FND_API.G_FALSE,l_ba_segment,
5162: (lx_compress_num,iby_security_pkg.G_ENCODING_UTF8_AL32);
5163: l_ba_segment := IBY_SECURITY_PKG.PKCS5_PAD(l_ba_segment);
5164:
5165: IF (ext_ba_rec.ba_num_sec_segment_id IS NULL) THEN
5166: IBY_SECURITY_PKG.Create_Segment
5167: (FND_API.G_FALSE,l_ba_segment,
5168: iby_security_pkg.G_ENCODING_UTF8_AL32,
5169: p_sys_key,lx_ba_segment_id);
5170: ELSE
5164:
5165: IF (ext_ba_rec.ba_num_sec_segment_id IS NULL) THEN
5166: IBY_SECURITY_PKG.Create_Segment
5167: (FND_API.G_FALSE,l_ba_segment,
5168: iby_security_pkg.G_ENCODING_UTF8_AL32,
5169: p_sys_key,lx_ba_segment_id);
5170: ELSE
5171: lx_ba_segment_id := ext_ba_rec.ba_num_sec_segment_id;
5172: IBY_SECURITY_PKG.Update_Segment
5168: iby_security_pkg.G_ENCODING_UTF8_AL32,
5169: p_sys_key,lx_ba_segment_id);
5170: ELSE
5171: lx_ba_segment_id := ext_ba_rec.ba_num_sec_segment_id;
5172: IBY_SECURITY_PKG.Update_Segment
5173: (FND_API.G_FALSE,lx_ba_segment_id,l_ba_segment,
5174: iby_security_pkg.G_ENCODING_UTF8_AL32,p_sys_key,
5175: ext_ba_rec.ba_subkey_cipher);
5176: END IF;
5170: ELSE
5171: lx_ba_segment_id := ext_ba_rec.ba_num_sec_segment_id;
5172: IBY_SECURITY_PKG.Update_Segment
5173: (FND_API.G_FALSE,lx_ba_segment_id,l_ba_segment,
5174: iby_security_pkg.G_ENCODING_UTF8_AL32,p_sys_key,
5175: ext_ba_rec.ba_subkey_cipher);
5176: END IF;
5177: ELSE
5178: DELETE FROM iby_security_segments
5185:
5186: IF (NOT lx_compress_num IS NULL) THEN
5187: l_iban_segment :=
5188: UTL_I18N.STRING_TO_RAW
5189: (lx_compress_num,iby_security_pkg.G_ENCODING_UTF8_AL32);
5190: l_iban_segment := IBY_SECURITY_PKG.PKCS5_PAD(l_iban_segment);
5191:
5192: IF (ext_ba_rec.iban_sec_segment_id IS NULL) THEN
5193: IBY_SECURITY_PKG.Create_Segment
5186: IF (NOT lx_compress_num IS NULL) THEN
5187: l_iban_segment :=
5188: UTL_I18N.STRING_TO_RAW
5189: (lx_compress_num,iby_security_pkg.G_ENCODING_UTF8_AL32);
5190: l_iban_segment := IBY_SECURITY_PKG.PKCS5_PAD(l_iban_segment);
5191:
5192: IF (ext_ba_rec.iban_sec_segment_id IS NULL) THEN
5193: IBY_SECURITY_PKG.Create_Segment
5194: (FND_API.G_FALSE,l_iban_segment,
5189: (lx_compress_num,iby_security_pkg.G_ENCODING_UTF8_AL32);
5190: l_iban_segment := IBY_SECURITY_PKG.PKCS5_PAD(l_iban_segment);
5191:
5192: IF (ext_ba_rec.iban_sec_segment_id IS NULL) THEN
5193: IBY_SECURITY_PKG.Create_Segment
5194: (FND_API.G_FALSE,l_iban_segment,
5195: iby_security_pkg.G_ENCODING_UTF8_AL32,p_sys_key,
5196: lx_iban_segment_id);
5197: ELSE
5191:
5192: IF (ext_ba_rec.iban_sec_segment_id IS NULL) THEN
5193: IBY_SECURITY_PKG.Create_Segment
5194: (FND_API.G_FALSE,l_iban_segment,
5195: iby_security_pkg.G_ENCODING_UTF8_AL32,p_sys_key,
5196: lx_iban_segment_id);
5197: ELSE
5198: lx_iban_segment_id := ext_ba_rec.iban_sec_segment_id;
5199: IBY_SECURITY_PKG.Update_Segment
5195: iby_security_pkg.G_ENCODING_UTF8_AL32,p_sys_key,
5196: lx_iban_segment_id);
5197: ELSE
5198: lx_iban_segment_id := ext_ba_rec.iban_sec_segment_id;
5199: IBY_SECURITY_PKG.Update_Segment
5200: (FND_API.G_FALSE,lx_iban_segment_id,l_iban_segment,
5201: iby_security_pkg.G_ENCODING_UTF8_AL32,p_sys_key,
5202: ext_ba_rec.iban_subkey_cipher);
5203: END IF;
5197: ELSE
5198: lx_iban_segment_id := ext_ba_rec.iban_sec_segment_id;
5199: IBY_SECURITY_PKG.Update_Segment
5200: (FND_API.G_FALSE,lx_iban_segment_id,l_iban_segment,
5201: iby_security_pkg.G_ENCODING_UTF8_AL32,p_sys_key,
5202: ext_ba_rec.iban_subkey_cipher);
5203: END IF;
5204: ELSE
5205: DELETE FROM iby_security_segments
5229: Mask_Bank_Number(l_ba_num,lx_mask_option,lx_unmask_len),
5230: masked_iban = Mask_Bank_Number(l_iban,lx_mask_option,lx_unmask_len),
5231: ba_mask_setting = lx_mask_option,
5232: ba_unmask_length = lx_unmask_len,
5233: encrypted = DECODE(l_mode, iby_security_pkg.G_ENCRYPT_MODE_NONE,'N',
5234: 'Y'
5235: ),
5236: object_version_number = object_version_number + 1,
5237: last_update_date = sysdate,
5249: END Remask_Accounts;
5250:
5251: PROCEDURE Encrypt_Accounts
5252: (p_commit IN VARCHAR2,
5253: p_sys_key IN iby_security_pkg.DES3_KEY_TYPE
5254: )
5255: IS
5256: l_mode iby_sys_security_options.ext_ba_encryption_mode%TYPE;
5257: lx_key_error VARCHAR2(300);
5281:
5282: BEGIN
5283:
5284: l_mode := Get_BA_Encrypt_Mode();
5285: IF (l_mode = iby_security_pkg.G_ENCRYPT_MODE_NONE) THEN
5286: RETURN;
5287: END IF;
5288:
5289: iby_security_pkg.Validate_Sys_Key(p_sys_key,lx_key_error);
5285: IF (l_mode = iby_security_pkg.G_ENCRYPT_MODE_NONE) THEN
5286: RETURN;
5287: END IF;
5288:
5289: iby_security_pkg.Validate_Sys_Key(p_sys_key,lx_key_error);
5290: IF (NOT lx_key_error IS NULL) THEN
5291: raise_application_error(-20000,lx_key_error, FALSE);
5292: END IF;
5293:
5311:
5312: IF (NOT lx_compress_num IS NULL) THEN
5313: l_ba_segment :=
5314: UTL_I18N.STRING_TO_RAW
5315: (lx_compress_num,iby_security_pkg.G_ENCODING_UTF8_AL32);
5316: -- pad to unit 8 length
5317: l_ba_segment := IBY_SECURITY_PKG.PKCS5_PAD(l_ba_segment);
5318:
5319: IBY_SECURITY_PKG.Create_Segment
5313: l_ba_segment :=
5314: UTL_I18N.STRING_TO_RAW
5315: (lx_compress_num,iby_security_pkg.G_ENCODING_UTF8_AL32);
5316: -- pad to unit 8 length
5317: l_ba_segment := IBY_SECURITY_PKG.PKCS5_PAD(l_ba_segment);
5318:
5319: IBY_SECURITY_PKG.Create_Segment
5320: (FND_API.G_FALSE,l_ba_segment,iby_security_pkg.G_ENCODING_UTF8_AL32,
5321: p_sys_key,lx_ba_segment_id);
5315: (lx_compress_num,iby_security_pkg.G_ENCODING_UTF8_AL32);
5316: -- pad to unit 8 length
5317: l_ba_segment := IBY_SECURITY_PKG.PKCS5_PAD(l_ba_segment);
5318:
5319: IBY_SECURITY_PKG.Create_Segment
5320: (FND_API.G_FALSE,l_ba_segment,iby_security_pkg.G_ENCODING_UTF8_AL32,
5321: p_sys_key,lx_ba_segment_id);
5322: END IF;
5323: ELSE
5316: -- pad to unit 8 length
5317: l_ba_segment := IBY_SECURITY_PKG.PKCS5_PAD(l_ba_segment);
5318:
5319: IBY_SECURITY_PKG.Create_Segment
5320: (FND_API.G_FALSE,l_ba_segment,iby_security_pkg.G_ENCODING_UTF8_AL32,
5321: p_sys_key,lx_ba_segment_id);
5322: END IF;
5323: ELSE
5324: lx_ba_unmask_digits := ext_ba_rec.bank_account_num;
5333:
5334: IF (NOT lx_compress_num IS NULL) THEN
5335: l_iban_segment :=
5336: UTL_I18N.STRING_TO_RAW
5337: (lx_compress_num,iby_security_pkg.G_ENCODING_UTF8_AL32);
5338: -- pad to unit 8 length
5339: l_iban_segment := IBY_SECURITY_PKG.PKCS5_PAD(l_iban_segment);
5340:
5341: IBY_SECURITY_PKG.Create_Segment
5335: l_iban_segment :=
5336: UTL_I18N.STRING_TO_RAW
5337: (lx_compress_num,iby_security_pkg.G_ENCODING_UTF8_AL32);
5338: -- pad to unit 8 length
5339: l_iban_segment := IBY_SECURITY_PKG.PKCS5_PAD(l_iban_segment);
5340:
5341: IBY_SECURITY_PKG.Create_Segment
5342: (FND_API.G_FALSE,l_iban_segment,
5343: iby_security_pkg.G_ENCODING_UTF8_AL32,p_sys_key,lx_iban_segment_id);
5337: (lx_compress_num,iby_security_pkg.G_ENCODING_UTF8_AL32);
5338: -- pad to unit 8 length
5339: l_iban_segment := IBY_SECURITY_PKG.PKCS5_PAD(l_iban_segment);
5340:
5341: IBY_SECURITY_PKG.Create_Segment
5342: (FND_API.G_FALSE,l_iban_segment,
5343: iby_security_pkg.G_ENCODING_UTF8_AL32,p_sys_key,lx_iban_segment_id);
5344: END IF;
5345: ELSE
5339: l_iban_segment := IBY_SECURITY_PKG.PKCS5_PAD(l_iban_segment);
5340:
5341: IBY_SECURITY_PKG.Create_Segment
5342: (FND_API.G_FALSE,l_iban_segment,
5343: iby_security_pkg.G_ENCODING_UTF8_AL32,p_sys_key,lx_iban_segment_id);
5344: END IF;
5345: ELSE
5346: lx_iban_unmask_digits := ext_ba_rec.iban;
5347: END IF;
5352: lx_e_ba_unmask_digits := NULL;
5353: l_e_ba_segment :=
5354: UTL_I18N.STRING_TO_RAW
5355: (ext_ba_rec.bank_account_num_electronic,
5356: iby_security_pkg.G_ENCODING_UTF8_AL32);
5357: -- pad to unit 8 length
5358: l_e_ba_segment := IBY_SECURITY_PKG.PKCS5_PAD(l_e_ba_segment);
5359:
5360: IBY_SECURITY_PKG.Create_Segment
5354: UTL_I18N.STRING_TO_RAW
5355: (ext_ba_rec.bank_account_num_electronic,
5356: iby_security_pkg.G_ENCODING_UTF8_AL32);
5357: -- pad to unit 8 length
5358: l_e_ba_segment := IBY_SECURITY_PKG.PKCS5_PAD(l_e_ba_segment);
5359:
5360: IBY_SECURITY_PKG.Create_Segment
5361: (FND_API.G_FALSE,l_e_ba_segment,
5362: iby_security_pkg.G_ENCODING_UTF8_AL32,p_sys_key,lx_e_ba_segment_id);
5356: iby_security_pkg.G_ENCODING_UTF8_AL32);
5357: -- pad to unit 8 length
5358: l_e_ba_segment := IBY_SECURITY_PKG.PKCS5_PAD(l_e_ba_segment);
5359:
5360: IBY_SECURITY_PKG.Create_Segment
5361: (FND_API.G_FALSE,l_e_ba_segment,
5362: iby_security_pkg.G_ENCODING_UTF8_AL32,p_sys_key,lx_e_ba_segment_id);
5363: ELSE
5364: lx_e_ba_unmask_digits := ext_ba_rec.bank_account_num_electronic;
5358: l_e_ba_segment := IBY_SECURITY_PKG.PKCS5_PAD(l_e_ba_segment);
5359:
5360: IBY_SECURITY_PKG.Create_Segment
5361: (FND_API.G_FALSE,l_e_ba_segment,
5362: iby_security_pkg.G_ENCODING_UTF8_AL32,p_sys_key,lx_e_ba_segment_id);
5363: ELSE
5364: lx_e_ba_unmask_digits := ext_ba_rec.bank_account_num_electronic;
5365: END IF;
5366:
5383: END Encrypt_Accounts;
5384:
5385: PROCEDURE Decrypt_Accounts
5386: (p_commit IN VARCHAR2,
5387: p_sys_key IN iby_security_pkg.DES3_KEY_TYPE
5388: )
5389: IS
5390: l_mode iby_sys_security_options.ext_ba_encryption_mode%TYPE;
5391: l_subkey iby_sys_security_subkeys.subkey_cipher_text%TYPE;
5425:
5426: BEGIN
5427:
5428: l_mode := Get_BA_Encrypt_Mode();
5429: IF (NOT (l_mode = iby_security_pkg.G_ENCRYPT_MODE_NONE)) THEN
5430: RETURN;
5431: END IF;
5432:
5433: iby_security_pkg.Validate_Sys_Key(p_sys_key,lx_key_error);
5429: IF (NOT (l_mode = iby_security_pkg.G_ENCRYPT_MODE_NONE)) THEN
5430: RETURN;
5431: END IF;
5432:
5433: iby_security_pkg.Validate_Sys_Key(p_sys_key,lx_key_error);
5434:
5435: FOR ext_ba_rec IN c_ext_ba LOOP
5436:
5437: -- raise sys-key exception only if encrypted data exists
5520: SELECT ext_ba_mask_setting, ext_ba_unmask_len
5521: FROM iby_sys_security_options;
5522:
5523: BEGIN
5524: x_mask_setting := iby_security_pkg.G_MASK_PREFIX;
5525:
5526: IF (c_mask_setting%ISOPEN) THEN CLOSE c_mask_setting; END IF;
5527:
5528: OPEN c_mask_setting;
5529: FETCH c_mask_setting INTO x_mask_setting, x_unmask_len;
5530: CLOSE c_mask_setting;
5531:
5532: IF (x_mask_setting IS NULL) THEN
5533: x_mask_setting := iby_security_pkg.G_MASK_PREFIX;
5534: END IF;
5535: IF (x_unmask_len IS NULL) THEN
5536: x_unmask_len := G_DEF_UNMASK_LENGTH;
5537: END IF;
5618: /* Bug 14456128 Introduced procedure Uncipher_Bank_Acct_Number for
5619: decrypting Bank account number */
5620: FUNCTION Uncipher_Bank_Acct_Number(
5621: p_ext_bank_acct_id IN iby_ext_bank_accounts.ext_bank_account_id%type,
5622: p_sys_key IN iby_security_pkg.DES3_KEY_TYPE )
5623: RETURN VARCHAR2
5624: IS
5625: l_api_name CONSTANT VARCHAR2(30) := 'Uncipher_Bank_Acct_Number';
5626: l_api_version CONSTANT NUMBER := 1.0;
5658: END IF;
5659: IF ( G_LEVEL_STATEMENT >= G_CURRENT_RUNTIME_LEVEL) THEN
5660: print_debuginfo(l_module_name||': Validating Sys Key');
5661: END IF;
5662: IBY_SECURITY_PKG.Validate_Sys_Key(p_sys_key,l_err_code);
5663: IF (l_err_code IS NOT NULL) THEN
5664: IF ( G_LEVEL_STATEMENT >= G_CURRENT_RUNTIME_LEVEL) THEN
5665: print_debuginfo(l_module_name||': Sys key Validation Failed');
5666: END IF;
5694: IF ( G_LEVEL_STATEMENT >= G_CURRENT_RUNTIME_LEVEL) THEN
5695: print_debuginfo('uncipher the subkey');
5696: END IF;
5697: -- uncipher the subkey
5698: l_sub_key := iby_security_pkg.get_sys_subkey(p_sys_key,l_sub_key_cipher);
5699: -- uncipher the segment
5700: IF ( G_LEVEL_STATEMENT >= G_CURRENT_RUNTIME_LEVEL) THEN
5701: print_debuginfo('uncipher the segment');
5702: END IF;
5700: IF ( G_LEVEL_STATEMENT >= G_CURRENT_RUNTIME_LEVEL) THEN
5701: print_debuginfo('uncipher the segment');
5702: END IF;
5703: l_bank_segment := dbms_obfuscation_toolkit.des3decrypt ( input => l_segment_cipher, KEY => l_sub_key, which => dbms_obfuscation_toolkit.ThreeKeyMode );
5704: l_bank_segment := IBY_SECURITY_PKG.PKCS5_UNPAD(l_bank_segment);
5705: l_bank_num := UTL_I18N.RAW_TO_CHAR(l_bank_segment,l_encoding);
5706:
5707: IF (NOT l_bank_acct_num IS NULL) THEN
5708: IF (l_mask_option = iby_security_pkg.G_MASK_POSTFIX) THEN
5704: l_bank_segment := IBY_SECURITY_PKG.PKCS5_UNPAD(l_bank_segment);
5705: l_bank_num := UTL_I18N.RAW_TO_CHAR(l_bank_segment,l_encoding);
5706:
5707: IF (NOT l_bank_acct_num IS NULL) THEN
5708: IF (l_mask_option = iby_security_pkg.G_MASK_POSTFIX) THEN
5709: l_bank_num := l_bank_acct_num || l_bank_num;
5710: ELSIF (l_mask_option = iby_security_pkg.G_MASK_PREFIX) THEN
5711: l_bank_num := l_bank_num || l_bank_acct_num;
5712: END IF;
5706:
5707: IF (NOT l_bank_acct_num IS NULL) THEN
5708: IF (l_mask_option = iby_security_pkg.G_MASK_POSTFIX) THEN
5709: l_bank_num := l_bank_acct_num || l_bank_num;
5710: ELSIF (l_mask_option = iby_security_pkg.G_MASK_PREFIX) THEN
5711: l_bank_num := l_bank_num || l_bank_acct_num;
5712: END IF;
5713: END IF;
5714: IF ( G_LEVEL_STATEMENT >= G_CURRENT_RUNTIME_LEVEL) THEN