DatabaseProcApplicationCreatedLinks
sybsystemprocssp_aux_encrkey_info  14 déc. 14Defects Propagation Dependencies

1     
2     
3     create or replace procedure sp_aux_encrkey_info
4         @owner varchar(30),
5         @keyname varchar(255)
6     as
7         declare @random_pad int
8             , @init_vector int
9             , @system_password int
10            , @login_access int
11            , @login_password int
12            , @user_password int
13            , @aes int
14            , @default_key int
15            , @key_recovery int
16            , @status_master_encr int
17            , @status_dualcontrol int
18            , @status_mek_encr int
19            , @status_static_encr int
20            , @dbname varchar(30)
21        begin
22            /* These bits are defined in encryptkey.h */
23            select @random_pad = 2 /* EK_RANDOMPAD */
24                , @init_vector = 1 /* EK_INITVECTOR */
25                , @login_password = 16 /* EK_LOGINPASS */
26                , @login_access = 8 /* EK_LOGINACCESS */
27                , @system_password = 32 /* EK_SYSENCRPASS */
28                , @user_password = 256 /* EK_USERPWD */
29                , @aes = 1 /* AES algorithm */
30                , @default_key = 4 /* EK_DEFAULT */
31                , @key_recovery = 64 /* EK_KEYRECOVERY */
32                , @status_master_encr = 2048 /* EK_MASTER_ENCR */
33                , @status_dualcontrol = 4096 /* EK_DUALCONTROL */
34                , @status_mek_encr = 8192 /* EK_MEK_ENCR */
35                , @status_static_encr = 16384 /* EK_STATIC_ENCR */
36    
37    
38            begin --{
39                select @dbname = db_name()
40    
41                insert #encr_column_info(keyname, keyowner, keydbname, keylength,
42                    keyalgorithm, keytype, random_pad, init_vector,
43                    protectedby, keyrecovery)
44                select
45                    o1.name
46                    , user_name(o1.uid), @dbname, e1.eklen
47                    , case (e1.ekalgorithm & @aes)
48                        when 0 then "RSA"
49                        else "AES"
50                    end
51                    , e1.type
52                    , case (e1.status & @random_pad)
53                        when 0 then 0
54                        else 1
55                    end
56                    , case (e1.status & @init_vector)
57                        when 0 then 0
58                        else 1
59                    end
60                    , case (e1.status & (@status_dualcontrol
61                    | @status_master_encr | @login_access
62                    | @login_password | @system_password
63                    | @user_password | @status_mek_encr
64                    | @status_static_encr))
65                        when (@login_access | @system_password) then "login access"
66                        when (@login_access | @status_master_encr) then "login access"
67                        when @login_password then "login password"
68                        when @system_password then "system encryption password"
69                        when @user_password then "user password"
70                        when @status_master_encr then "master key"
71                        when (@status_dualcontrol | @user_password) then
72                        "dual_control(master key + user password)"
73                        when (@status_dualcontrol | @login_access | @status_master_encr) then
74                        "dual_control(login access)"
75                        when (@status_dualcontrol | @login_password) then
76                        "dual_control(master key + login password)"
77                        when (@status_dualcontrol | @status_master_encr) then
78                        "dual_control(master key + dual master key)"
79                        when @status_mek_encr then "automatic startup key"
80                        when @status_static_encr then "static key"
81                    end
82                    , case (e1.type & @key_recovery)
83                        when 0 then 0
84                        else 1
85                    end
86                from sysobjects o1, sysencryptkeys e1
87                where o1.id = e1.id
88                    and o1.type = "EK"
89                    and o1.name like @keyname
90                    and user_name(o1.uid) like @owner
91            end --}
92    
93        end
94    

DEFECTS
 MINU 4 Unique Index with nullable columns sybsystemprocs..sysencryptkeys sybsystemprocs..sysencryptkeys
 MAW1 3 Warning message on %name% sybsystemprocs..sysencryptkeys.id: Warning message on sysencryptkeys 87
 MAW1 3 Warning message on %name% sybsystemprocs..sysobjects.id: Warning message on sysobjects 87
 MGTP 3 Grant to public sybsystemprocs..sysobjects  
 MNER 3 No Error Check should check @@error after insert 41
 MUCO 3 Useless Code Useless Begin-End Pair 21
 MUCO 3 Useless Code Useless Begin-End Pair 38
 QNAJ 3 Not using ANSI Inner Join 86
 VNRD 3 Variable is not read @default_key 30
 MTR1 2 Metrics: Comments Ratio Comments: 8% 3
 MTR2 2 Metrics: Cyclomatic Complexity Cyclo: 2 = 1dec - 1exi + 2 3
 MTR3 2 Metrics: Query Complexity Complexity: 12 3
 PRED_QUERY_COLLECTION 2 {e=sybsystemprocs..sysencryptkeys, o=sybsystemprocs..sysobjects} 0 44

DEPENDENCIES
PROCS AND TABLES USED
reads table sybsystemprocs..sysencryptkeys  
writes table tempdb..#encr_column_info (1) 
reads table sybsystemprocs..sysobjects