ORACLE密码策略验证程序

ORACLE密码策略非常重要,下面就为您详细介绍ORACLE密码策略验证程序,如果您对ORACLE密码策略方面感兴趣的话,不妨一看。

成都创新互联致力于互联网网站建设与网站营销,提供成都网站设计、成都做网站、网站开发、seo优化、网站排名、互联网营销、小程序制作、公众号商城、等建站开发,成都创新互联网站建设策划专家,为不同类型的客户提供良好的互联网应用定制解决方案,帮助客户在新的全球化互联网环境中保持优势。

密码字符串要求:

-- Check if the password is same as the username
-- Check for the minimum length of the password
-- Check if the password contains at least one letter, one digit and one
-- Check if the password differs from the previous password by at least

CREATE OR REPLACE FUNCTION SYS.verify_function
(username varchar2,
password varchar2,
old_password varchar2)
RETURN boolean IS
n boolean;
m integer;
differ integer;
isdigit boolean;
ischar boolean;
ispunct boolean;
digitarray varchar2(20);
punctarray varchar2(25);
chararray varchar2(52);

BEGIN
digitarray:= '0123456789';
chararray:= 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
punctarray:='!"#$%&()``*+,-/:;<=>?_';

-- Check if the password is same as the username
IF NLS_LOWER(password) = NLS_LOWER(username) THEN
raise_application_error(-20001, 'Password same as or similar to user');
END IF;

-- Check for the minimum length of the password
IF length(password) < 8 THEN
raise_application_error(-20002, 'Password length less than 8');
END IF;

-- Check if the password is too simple. A dictionary of words may be
-- maintained and a check may be made so as not to allow the words
-- that are too simple for the password.
IF NLS_LOWER(password) IN ('welcome', 'database', 'account', 'user', 'password', 'oracle', 'computer', 'abcd') THEN
raise_application_error(-20002, 'Password too simple');
END IF;

-- Check if the password contains at least one letter, one digit and one
-- punctuation mark.
-- 1. Check for the digit

 
 
 
  1. isdigit:=FALSE;
  2. m := length(password);
  3. FOR i IN 1..10 LOOP 
  4. FOR j IN 1..m LOOP 
  5. IF substr(password,j,1) = substr(digitarray,i,1) THEN
  6. isdigit:=TRUE;
  7. GOTO findchar;
  8. END IF;
  9. END LOOP;
  10. END LOOP;
  11. IF isdigit = FALSE THEN
  12. raise_application_error(-20003, 'Password should contain at least one digit, one character and one punctuation');
  13. END IF;

-- 2. Check for the character

 
 
 
  1. <>
  2. ischar:=FALSE;
  3. FOR i IN 1..length(chararray) LOOP 
  4. FOR j IN 1..m LOOP 
  5. IF substr(password,j,1) = substr(chararray,i,1) THEN
  6. ischar:=TRUE;
  7. GOTO findpunct;
  8. END IF;
  9. END LOOP;
  10. END LOOP;
  11. IF ischar = FALSE THEN
  12. raise_application_error(-20003, 'Password should contain at least one 
  13. digit, one character and one punctuation');
  14. END IF;

-- 3. Check for the punctuation

 
 
 
  1. <>
  2. ispunct:=FALSE;
  3. FOR i IN 1..length(punctarray) LOOP 
  4. FOR j IN 1..m LOOP 
  5. IF substr(password,j,1) = substr(punctarray,i,1) THEN
  6. ispunct:=TRUE;
  7. GOTO endsearch;
  8. END IF;
  9. END LOOP;
  10. END LOOP;
  11. IF ispunct = FALSE THEN
  12. raise_application_error(-20003, 'Password should contain at least one 
  13. digit, one character and one punctuation');
  14. END IF;
  15. <>
  16. -- Check if the password differs from the previous password by at least
  17. -- 3 letters
  18. IF old_password IS NOT NULL THEN
  19. differ := length(old_password) - length(password);
  20. IF abs(differ) < 3 THEN
  21. IF length(password) < length(old_password) THEN
  22. m := length(password);
  23. ELSE
  24. m := length(old_password);
  25. END IF;
  26. differ := abs(differ);
  27. FOR i IN 1..m LOOP
  28. IF substr(password,i,1) != substr(old_password,i,1) THEN
  29. differ := differ + 1;
  30. END IF;
  31. END LOOP;
  32. IF differ < 3 THEN
  33. raise_application_error(-20004, 'Password should differ by at 
  34. least 3 characters');
  35. END IF;
  36. END IF;
  37. END IF;
  38. -- Everything is fine; return TRUE ; 
  39. RETURN(TRUE);
  40. END; 

网站栏目:ORACLE密码策略验证程序
路径分享:http://www.shufengxianlan.com/qtweb/news1/242301.html

网站建设、网络推广公司-创新互联,是专注品牌与效果的网站制作,网络营销seo公司;服务项目有等

广告

声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 创新互联