自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

Jenkins專有用戶數(shù)據(jù)庫加密算法簡析

數(shù)據(jù)庫 算法
Jenkins專有用戶數(shù)據(jù)庫使用了jbcrypt加密,jbcrypt加密是不可逆的,而且對于同一個明文的加密結果一般不同。

Jenkins訪問控制分為:安全域(即認證)與授權策略。

其中,安全域可以采用三種形式,分別為:Jenkins專有用戶數(shù)據(jù)庫、LDAP、Servlet容器代理。

 

 

Jenkins專有用戶的數(shù)據(jù)信息存放位置: <JENKINS_HOME> /users/

每個用戶的相關信息存放在config.xml文件中: <JENKINS_HOME>/users/ <user>/config.xml

在config.xml文件中 passwordHash節(jié)點可以看到用戶名加密后的密文哈希值

那么,它是用何種加密方式加密的呢?可否解密密文得到明文呢?

github上查看其源碼,通過關鍵字 #jbcrypt搜索定位到 HudsonPrivateSecurityRealm.java這個文件

HudsonPrivateSecurityRealm.java詳細路徑是:jenkins/core/src/main/java/hudson/security/HudsonPrivateSecurityRealm.java

通過分析該源碼得知:

1、密文的格式為:salt: encPass,其中以#jbcrypt表示salt作為數(shù)據(jù)頭

2、明文通過jbcrypt算法得到密文 encPass

關于jbcrypt:

jbcrypt是bcrypt加密工具的java實現(xiàn)。

它的API非常簡單,DEMO如下,在HudsonPrivateSecurityRealm.java中可以看到加密和校驗時使用了如下API:

  1. // Hash a password for the first time   
  2. String hashed = BCrypt.hashpw(password, BCrypt.gensalt());   
  3.  
  4. // gensalt's log_rounds parameter determines the complexity the work factor is 2**log_rounds, and the default is 10   
  5. String hashed = BCrypt.hashpw(password, BCrypt.gensalt(12));   
  6.  
  7. // Check that an unencrypted password matches one that has previously been hashed   
  8. if (BCrypt.checkpw(candidate, hashed))   
  9. System.out.println("It matches");   
  10. else   
  11. System.out.println("It does not match");   

經(jīng)驗證,用jbcrypt對同一個明文加密后因為salt一般不同,加密后的密文一般不同

 

關于bcrypt:

1、bcrypt是不可逆的加密算法,無法通過解密密文得到明文。

2、bcrypt和其他對稱或非對稱加密方式不同的是,不是直接解密得到明文,也不是二次加密比較密文,而是把明文和存儲的密文一塊運算得到另一個密文,如果這兩個密文相同則驗證成功。

綜上,Jenkins專有用戶數(shù)據(jù)庫使用了jbcrypt加密,jbcrypt加密是不可逆的,而且對于同一個明文的加密結果一般不同。

本文出自:http://my.oschina.net/donhui/blog/379925

責任編輯:林師授 來源: donhui的博客
相關推薦

2014-09-23 10:03:04

2010-11-29 15:35:31

sybase創(chuàng)建用戶

2010-02-22 17:07:16

CentOS vsft

2015-01-05 09:56:41

UDPLinux TCP

2011-03-03 10:04:28

PureFTPdmysql

2011-09-06 10:17:46

2021-01-21 11:30:59

數(shù)據(jù)泄露漏洞信息安全

2021-01-20 23:40:27

數(shù)據(jù)泄露OpenWRT攻擊

2022-04-29 14:44:50

漏洞網(wǎng)絡攻擊網(wǎng)絡安全

2011-03-25 15:21:43

2021-01-06 10:01:09

數(shù)據(jù)泄露漏洞信息安全

2022-12-01 12:14:09

2021-05-11 11:05:58

蘋果iOS隱私

2023-10-23 19:18:05

2015-10-19 18:18:44

2016-03-16 10:56:12

數(shù)據(jù)營銷數(shù)據(jù)分析LinkedIn

2015-10-30 17:58:43

用戶數(shù)據(jù)收集信息安全WhatsApp

2019-08-14 16:08:43

大數(shù)據(jù)安全互聯(lián)網(wǎng)

2019-05-17 10:10:30

優(yōu)衣庫黑客數(shù)據(jù)泄漏

2021-08-22 14:34:59

黑客數(shù)據(jù)泄露網(wǎng)絡攻擊
點贊
收藏

51CTO技術棧公眾號