You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@turbine.apache.org by pa...@apache.org on 2019/05/21 03:58:59 UTC
svn commit: r1045259 [13/39] - in
/websites/production/turbine/content/fulcrum/fulcrum-yaafi-crypto: ./
apidocs/ apidocs/org/apache/fulcrum/jce/crypto/
apidocs/org/apache/fulcrum/jce/crypto/class-use/ apidocs/resources/
apidocs/src-html/org/apache/fulc...
Modified: websites/production/turbine/content/fulcrum/fulcrum-yaafi-crypto/apidocs/src-html/org/apache/fulcrum/jce/crypto/PasswordFactory.html
==============================================================================
--- websites/production/turbine/content/fulcrum/fulcrum-yaafi-crypto/apidocs/src-html/org/apache/fulcrum/jce/crypto/PasswordFactory.html (original)
+++ websites/production/turbine/content/fulcrum/fulcrum-yaafi-crypto/apidocs/src-html/org/apache/fulcrum/jce/crypto/PasswordFactory.html Tue May 21 03:58:58 2019
@@ -1,177 +1,192 @@
-<HTML>
-<BODY BGCOLOR="white">
-<PRE>
-<FONT color="green">001</FONT> package org.apache.fulcrum.jce.crypto;<a name="line.1"></a>
-<FONT color="green">002</FONT> <a name="line.2"></a>
-<FONT color="green">003</FONT> /*<a name="line.3"></a>
-<FONT color="green">004</FONT> * Licensed to the Apache Software Foundation (ASF) under one<a name="line.4"></a>
-<FONT color="green">005</FONT> * or more contributor license agreements. See the NOTICE file<a name="line.5"></a>
-<FONT color="green">006</FONT> * distributed with this work for additional information<a name="line.6"></a>
-<FONT color="green">007</FONT> * regarding copyright ownership. The ASF licenses this file<a name="line.7"></a>
-<FONT color="green">008</FONT> * to you under the Apache License, Version 2.0 (the<a name="line.8"></a>
-<FONT color="green">009</FONT> * "License"); you may not use this file except in compliance<a name="line.9"></a>
-<FONT color="green">010</FONT> * with the License. You may obtain a copy of the License at<a name="line.10"></a>
-<FONT color="green">011</FONT> *<a name="line.11"></a>
-<FONT color="green">012</FONT> * http://www.apache.org/licenses/LICENSE-2.0<a name="line.12"></a>
-<FONT color="green">013</FONT> *<a name="line.13"></a>
-<FONT color="green">014</FONT> * Unless required by applicable law or agreed to in writing,<a name="line.14"></a>
-<FONT color="green">015</FONT> * software distributed under the License is distributed on an<a name="line.15"></a>
-<FONT color="green">016</FONT> * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY<a name="line.16"></a>
-<FONT color="green">017</FONT> * KIND, either express or implied. See the License for the<a name="line.17"></a>
-<FONT color="green">018</FONT> * specific language governing permissions and limitations<a name="line.18"></a>
-<FONT color="green">019</FONT> * under the License.<a name="line.19"></a>
-<FONT color="green">020</FONT> */<a name="line.20"></a>
-<FONT color="green">021</FONT> <a name="line.21"></a>
-<FONT color="green">022</FONT> import java.io.UnsupportedEncodingException;<a name="line.22"></a>
-<FONT color="green">023</FONT> import java.security.MessageDigest;<a name="line.23"></a>
-<FONT color="green">024</FONT> import java.security.NoSuchAlgorithmException;<a name="line.24"></a>
-<FONT color="green">025</FONT> <a name="line.25"></a>
-<FONT color="green">026</FONT> /**<a name="line.26"></a>
-<FONT color="green">027</FONT> * The implementation supplies a default password in the case that<a name="line.27"></a>
-<FONT color="green">028</FONT> * the programmer don't want to have additional hassles. It is easy to<a name="line.28"></a>
-<FONT color="green">029</FONT> * reengineer the password being used but much better than a hard-coded<a name="line.29"></a>
-<FONT color="green">030</FONT> * password in the application.<a name="line.30"></a>
-<FONT color="green">031</FONT> *<a name="line.31"></a>
-<FONT color="green">032</FONT> * The code uses parts from Markus Hahn's Blowfish library found at<a name="line.32"></a>
-<FONT color="green">033</FONT> * http://blowfishj.sourceforge.net/<a name="line.33"></a>
-<FONT color="green">034</FONT> *<a name="line.34"></a>
-<FONT color="green">035</FONT> * @author <a href="mailto:siegfried.goeschl@it20one.at">Siegfried Goeschl </a><a name="line.35"></a>
-<FONT color="green">036</FONT> * @author <a href="mailto:maakus@earthlink.net">Markus Hahn</a><a name="line.36"></a>
-<FONT color="green">037</FONT> */<a name="line.37"></a>
-<FONT color="green">038</FONT> <a name="line.38"></a>
-<FONT color="green">039</FONT> public class PasswordFactory implements PasswordParameters<a name="line.39"></a>
-<FONT color="green">040</FONT> {<a name="line.40"></a>
-<FONT color="green">041</FONT> <a name="line.41"></a>
-<FONT color="green">042</FONT> /**<a name="line.42"></a>
-<FONT color="green">043</FONT> * @return a default password using "xxxx-xxxx-xxxx-xxxxx"<a name="line.43"></a>
-<FONT color="green">044</FONT> */<a name="line.44"></a>
-<FONT color="green">045</FONT> public static char[] create()<a name="line.45"></a>
-<FONT color="green">046</FONT> throws NoSuchAlgorithmException, UnsupportedEncodingException<a name="line.46"></a>
-<FONT color="green">047</FONT> {<a name="line.47"></a>
-<FONT color="green">048</FONT> return create(<a name="line.48"></a>
-<FONT color="green">049</FONT> PasswordParameters.DEFAULTPASSWORD,<a name="line.49"></a>
-<FONT color="green">050</FONT> PasswordParameters.SALT,<a name="line.50"></a>
-<FONT color="green">051</FONT> PasswordParameters.COUNT<a name="line.51"></a>
-<FONT color="green">052</FONT> );<a name="line.52"></a>
-<FONT color="green">053</FONT> }<a name="line.53"></a>
-<FONT color="green">054</FONT> <a name="line.54"></a>
-<FONT color="green">055</FONT> /**<a name="line.55"></a>
-<FONT color="green">056</FONT> * @param seed the default password supplied by the caller<a name="line.56"></a>
-<FONT color="green">057</FONT> * @return a password using "xxxx-xxxx-xxxx-xxxxx"<a name="line.57"></a>
-<FONT color="green">058</FONT> */<a name="line.58"></a>
-<FONT color="green">059</FONT> public static char[] create( String seed )<a name="line.59"></a>
-<FONT color="green">060</FONT> throws NoSuchAlgorithmException, UnsupportedEncodingException<a name="line.60"></a>
-<FONT color="green">061</FONT> {<a name="line.61"></a>
-<FONT color="green">062</FONT> return create(<a name="line.62"></a>
-<FONT color="green">063</FONT> seed.toCharArray()<a name="line.63"></a>
-<FONT color="green">064</FONT> );<a name="line.64"></a>
-<FONT color="green">065</FONT> }<a name="line.65"></a>
-<FONT color="green">066</FONT> <a name="line.66"></a>
-<FONT color="green">067</FONT> /**<a name="line.67"></a>
-<FONT color="green">068</FONT> * @param seed the default password supplied by the caller<a name="line.68"></a>
-<FONT color="green">069</FONT> * @return a password using "xxxx-xxxx-xxxx-xxxxx"<a name="line.69"></a>
-<FONT color="green">070</FONT> */<a name="line.70"></a>
-<FONT color="green">071</FONT> public static final char[] create( char[] seed )<a name="line.71"></a>
-<FONT color="green">072</FONT> throws NoSuchAlgorithmException, UnsupportedEncodingException<a name="line.72"></a>
-<FONT color="green">073</FONT> {<a name="line.73"></a>
-<FONT color="green">074</FONT> return create(<a name="line.74"></a>
-<FONT color="green">075</FONT> seed,<a name="line.75"></a>
-<FONT color="green">076</FONT> PasswordFactory.SALT,<a name="line.76"></a>
-<FONT color="green">077</FONT> PasswordFactory.COUNT<a name="line.77"></a>
-<FONT color="green">078</FONT> );<a name="line.78"></a>
-<FONT color="green">079</FONT> }<a name="line.79"></a>
-<FONT color="green">080</FONT> <a name="line.80"></a>
-<FONT color="green">081</FONT> /**<a name="line.81"></a>
-<FONT color="green">082</FONT> * Creates a default password using "xxxx-xxxx-xxxx-xxxxx".<a name="line.82"></a>
-<FONT color="green">083</FONT> *<a name="line.83"></a>
-<FONT color="green">084</FONT> * @param salt the password salt<a name="line.84"></a>
-<FONT color="green">085</FONT> * @param password the default password<a name="line.85"></a>
-<FONT color="green">086</FONT> * @param count number of MessageDigest iterations<a name="line.86"></a>
-<FONT color="green">087</FONT> * @return the default password<a name="line.87"></a>
-<FONT color="green">088</FONT> * @throws NoSuchAlgorithmException the encryption algorithm is not supported<a name="line.88"></a>
-<FONT color="green">089</FONT> * @throws UnsupportedEncodingException the requested encoding is not supported<a name="line.89"></a>
-<FONT color="green">090</FONT> */<a name="line.90"></a>
-<FONT color="green">091</FONT> public static char [] create( char[] password, byte[] salt, int count )<a name="line.91"></a>
-<FONT color="green">092</FONT> throws NoSuchAlgorithmException, UnsupportedEncodingException<a name="line.92"></a>
-<FONT color="green">093</FONT> {<a name="line.93"></a>
-<FONT color="green">094</FONT> char [] result = null;<a name="line.94"></a>
-<FONT color="green">095</FONT> MessageDigest sha1 = MessageDigest.getInstance( "SHA1" );<a name="line.95"></a>
-<FONT color="green">096</FONT> byte [] passwordMask = new String( password ).getBytes( "UTF-8" );<a name="line.96"></a>
-<FONT color="green">097</FONT> byte [] temp = new byte[salt.length + passwordMask.length];<a name="line.97"></a>
-<FONT color="green">098</FONT> byte [] digest = null;<a name="line.98"></a>
-<FONT color="green">099</FONT> <a name="line.99"></a>
-<FONT color="green">100</FONT> StringBuffer stringBuffer = new StringBuffer();<a name="line.100"></a>
-<FONT color="green">101</FONT> <a name="line.101"></a>
-<FONT color="green">102</FONT> // combine the password with the salt string into a byte[9<a name="line.102"></a>
-<FONT color="green">103</FONT> <a name="line.103"></a>
-<FONT color="green">104</FONT> System.arraycopy( passwordMask, 0, temp, 0, passwordMask.length );<a name="line.104"></a>
-<FONT color="green">105</FONT> System.arraycopy( salt, 0, temp, passwordMask.length, salt.length );<a name="line.105"></a>
-<FONT color="green">106</FONT> <a name="line.106"></a>
-<FONT color="green">107</FONT> // create a hash over and over to make it a bit random<a name="line.107"></a>
-<FONT color="green">108</FONT> <a name="line.108"></a>
-<FONT color="green">109</FONT> digest = temp;<a name="line.109"></a>
-<FONT color="green">110</FONT> <a name="line.110"></a>
-<FONT color="green">111</FONT> for (int i = 0; i < count; i++)<a name="line.111"></a>
-<FONT color="green">112</FONT> {<a name="line.112"></a>
-<FONT color="green">113</FONT> sha1.update( digest );<a name="line.113"></a>
-<FONT color="green">114</FONT> digest = sha1.digest();<a name="line.114"></a>
-<FONT color="green">115</FONT> }<a name="line.115"></a>
-<FONT color="green">116</FONT> <a name="line.116"></a>
-<FONT color="green">117</FONT> // build a well-formed password string to be usable<a name="line.117"></a>
-<FONT color="green">118</FONT> // by a human<a name="line.118"></a>
-<FONT color="green">119</FONT> <a name="line.119"></a>
-<FONT color="green">120</FONT> long long1 = createLong( digest, 0 );<a name="line.120"></a>
-<FONT color="green">121</FONT> long long2 = createLong( digest, 4 );<a name="line.121"></a>
-<FONT color="green">122</FONT> long long3 = createLong( digest, 8 );<a name="line.122"></a>
-<FONT color="green">123</FONT> long long4 = createLong( digest, 12 );<a name="line.123"></a>
-<FONT color="green">124</FONT> <a name="line.124"></a>
-<FONT color="green">125</FONT> stringBuffer.append( Long.toHexString( long1 ).substring( 0, 4 ) );<a name="line.125"></a>
-<FONT color="green">126</FONT> stringBuffer.append( '-' );<a name="line.126"></a>
-<FONT color="green">127</FONT> stringBuffer.append( Long.toHexString( long2 ).substring( 0, 4 ) );<a name="line.127"></a>
-<FONT color="green">128</FONT> stringBuffer.append( '-' );<a name="line.128"></a>
-<FONT color="green">129</FONT> stringBuffer.append( Long.toHexString( long3 ).substring( 0, 4 ) );<a name="line.129"></a>
-<FONT color="green">130</FONT> stringBuffer.append( '-' );<a name="line.130"></a>
-<FONT color="green">131</FONT> stringBuffer.append( Long.toHexString( long4 ).substring( 0, 5 ) );<a name="line.131"></a>
-<FONT color="green">132</FONT> <a name="line.132"></a>
-<FONT color="green">133</FONT> // copy the password<a name="line.133"></a>
-<FONT color="green">134</FONT> <a name="line.134"></a>
-<FONT color="green">135</FONT> result = new char[stringBuffer.length()];<a name="line.135"></a>
-<FONT color="green">136</FONT> <a name="line.136"></a>
-<FONT color="green">137</FONT> for (int i = 0; i < stringBuffer.length(); i++)<a name="line.137"></a>
-<FONT color="green">138</FONT> {<a name="line.138"></a>
-<FONT color="green">139</FONT> result[i] = stringBuffer.charAt( i );<a name="line.139"></a>
-<FONT color="green">140</FONT> }<a name="line.140"></a>
-<FONT color="green">141</FONT> <a name="line.141"></a>
-<FONT color="green">142</FONT> // wipe out the StringBuffer<a name="line.142"></a>
-<FONT color="green">143</FONT> <a name="line.143"></a>
-<FONT color="green">144</FONT> for (int i = 0; i < stringBuffer.length(); i++)<a name="line.144"></a>
-<FONT color="green">145</FONT> {<a name="line.145"></a>
-<FONT color="green">146</FONT> stringBuffer.setCharAt( i, ' ' );<a name="line.146"></a>
-<FONT color="green">147</FONT> }<a name="line.147"></a>
-<FONT color="green">148</FONT> <a name="line.148"></a>
-<FONT color="green">149</FONT> return result;<a name="line.149"></a>
-<FONT color="green">150</FONT> }<a name="line.150"></a>
-<FONT color="green">151</FONT> <a name="line.151"></a>
-<FONT color="green">152</FONT> /**<a name="line.152"></a>
-<FONT color="green">153</FONT> * Gets bytes from an array into a long.<a name="line.153"></a>
-<FONT color="green">154</FONT> *<a name="line.154"></a>
-<FONT color="green">155</FONT> * @param buf where to get the bytes<a name="line.155"></a>
-<FONT color="green">156</FONT> * @param nOfs index from where to read the data<a name="line.156"></a>
-<FONT color="green">157</FONT> * @return the 64bit integer<a name="line.157"></a>
-<FONT color="green">158</FONT> */<a name="line.158"></a>
-<FONT color="green">159</FONT> private static long createLong(byte [] buf, int nOfs)<a name="line.159"></a>
-<FONT color="green">160</FONT> {<a name="line.160"></a>
-<FONT color="green">161</FONT> return<a name="line.161"></a>
-<FONT color="green">162</FONT> ((long)(( buf[nOfs ] << 24) |<a name="line.162"></a>
-<FONT color="green">163</FONT> ((buf[nOfs + 1] & 0x0ff) << 16) |<a name="line.163"></a>
-<FONT color="green">164</FONT> ((buf[nOfs + 2] & 0x0ff) << 8) |<a name="line.164"></a>
-<FONT color="green">165</FONT> ( buf[nOfs + 3] & 0x0ff )) << 32) |<a name="line.165"></a>
-<FONT color="green">166</FONT> ((long)(( buf[nOfs + 4] << 24) |<a name="line.166"></a>
-<FONT color="green">167</FONT> ((buf[nOfs + 5] & 0x0ff) << 16) |<a name="line.167"></a>
-<FONT color="green">168</FONT> ((buf[nOfs + 6] & 0x0ff) << 8) |<a name="line.168"></a>
-<FONT color="green">169</FONT> ( buf[nOfs + 7] & 0x0ff )) & 0x0ffffffffL);<a name="line.169"></a>
-<FONT color="green">170</FONT> }<a name="line.170"></a>
-<FONT color="green">171</FONT> }<a name="line.171"></a>
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html lang="en">
+<head>
+<title>Source code</title>
+<link rel="stylesheet" type="text/css" href="../../../../../../stylesheet.css" title="Style">
+</head>
+<body>
+<div class="sourceContainer">
+<pre><span class="sourceLineNo">001</span>package org.apache.fulcrum.jce.crypto;<a name="line.1"></a>
+<span class="sourceLineNo">002</span><a name="line.2"></a>
+<span class="sourceLineNo">003</span>/*<a name="line.3"></a>
+<span class="sourceLineNo">004</span> * Licensed to the Apache Software Foundation (ASF) under one<a name="line.4"></a>
+<span class="sourceLineNo">005</span> * or more contributor license agreements. See the NOTICE file<a name="line.5"></a>
+<span class="sourceLineNo">006</span> * distributed with this work for additional information<a name="line.6"></a>
+<span class="sourceLineNo">007</span> * regarding copyright ownership. The ASF licenses this file<a name="line.7"></a>
+<span class="sourceLineNo">008</span> * to you under the Apache License, Version 2.0 (the<a name="line.8"></a>
+<span class="sourceLineNo">009</span> * "License"); you may not use this file except in compliance<a name="line.9"></a>
+<span class="sourceLineNo">010</span> * with the License. You may obtain a copy of the License at<a name="line.10"></a>
+<span class="sourceLineNo">011</span> *<a name="line.11"></a>
+<span class="sourceLineNo">012</span> * http://www.apache.org/licenses/LICENSE-2.0<a name="line.12"></a>
+<span class="sourceLineNo">013</span> *<a name="line.13"></a>
+<span class="sourceLineNo">014</span> * Unless required by applicable law or agreed to in writing,<a name="line.14"></a>
+<span class="sourceLineNo">015</span> * software distributed under the License is distributed on an<a name="line.15"></a>
+<span class="sourceLineNo">016</span> * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY<a name="line.16"></a>
+<span class="sourceLineNo">017</span> * KIND, either express or implied. See the License for the<a name="line.17"></a>
+<span class="sourceLineNo">018</span> * specific language governing permissions and limitations<a name="line.18"></a>
+<span class="sourceLineNo">019</span> * under the License.<a name="line.19"></a>
+<span class="sourceLineNo">020</span> */<a name="line.20"></a>
+<span class="sourceLineNo">021</span><a name="line.21"></a>
+<span class="sourceLineNo">022</span>import java.io.UnsupportedEncodingException;<a name="line.22"></a>
+<span class="sourceLineNo">023</span>import java.security.MessageDigest;<a name="line.23"></a>
+<span class="sourceLineNo">024</span>import java.security.NoSuchAlgorithmException;<a name="line.24"></a>
+<span class="sourceLineNo">025</span><a name="line.25"></a>
+<span class="sourceLineNo">026</span>/**<a name="line.26"></a>
+<span class="sourceLineNo">027</span> * The implementation supplies a default password in the case that<a name="line.27"></a>
+<span class="sourceLineNo">028</span> * the programmer don't want to have additional hassles. It is easy to<a name="line.28"></a>
+<span class="sourceLineNo">029</span> * reengineer the password being used but much better than a hard-coded<a name="line.29"></a>
+<span class="sourceLineNo">030</span> * password in the application.<a name="line.30"></a>
+<span class="sourceLineNo">031</span> *<a name="line.31"></a>
+<span class="sourceLineNo">032</span> * The code uses parts from Markus Hahn's Blowfish library found at<a name="line.32"></a>
+<span class="sourceLineNo">033</span> * http://blowfishj.sourceforge.net/<a name="line.33"></a>
+<span class="sourceLineNo">034</span> *<a name="line.34"></a>
+<span class="sourceLineNo">035</span> * @author <a href="mailto:siegfried.goeschl@it20one.at">Siegfried Goeschl </a><a name="line.35"></a>
+<span class="sourceLineNo">036</span> * @author <a href="mailto:maakus@earthlink.net">Markus Hahn</a><a name="line.36"></a>
+<span class="sourceLineNo">037</span> */<a name="line.37"></a>
+<span class="sourceLineNo">038</span><a name="line.38"></a>
+<span class="sourceLineNo">039</span>public class PasswordFactory implements PasswordParameters<a name="line.39"></a>
+<span class="sourceLineNo">040</span>{<a name="line.40"></a>
+<span class="sourceLineNo">041</span><a name="line.41"></a>
+<span class="sourceLineNo">042</span> /**<a name="line.42"></a>
+<span class="sourceLineNo">043</span> * Create a new password<a name="line.43"></a>
+<span class="sourceLineNo">044</span> * <a name="line.44"></a>
+<span class="sourceLineNo">045</span> * @return a default password using "xxxx-xxxx-xxxx-xxxxx"<a name="line.45"></a>
+<span class="sourceLineNo">046</span> * <a name="line.46"></a>
+<span class="sourceLineNo">047</span> * @throws NoSuchAlgorithmException the encryption algorithm is not supported<a name="line.47"></a>
+<span class="sourceLineNo">048</span> * @throws UnsupportedEncodingException the requested encoding is not supported<a name="line.48"></a>
+<span class="sourceLineNo">049</span> */<a name="line.49"></a>
+<span class="sourceLineNo">050</span> public static char[] create()<a name="line.50"></a>
+<span class="sourceLineNo">051</span> throws NoSuchAlgorithmException, UnsupportedEncodingException<a name="line.51"></a>
+<span class="sourceLineNo">052</span> {<a name="line.52"></a>
+<span class="sourceLineNo">053</span> return create(<a name="line.53"></a>
+<span class="sourceLineNo">054</span> PasswordParameters.DEFAULTPASSWORD,<a name="line.54"></a>
+<span class="sourceLineNo">055</span> PasswordParameters.SALT,<a name="line.55"></a>
+<span class="sourceLineNo">056</span> PasswordParameters.COUNT<a name="line.56"></a>
+<span class="sourceLineNo">057</span> );<a name="line.57"></a>
+<span class="sourceLineNo">058</span> }<a name="line.58"></a>
+<span class="sourceLineNo">059</span><a name="line.59"></a>
+<span class="sourceLineNo">060</span> /**<a name="line.60"></a>
+<span class="sourceLineNo">061</span> * Create a new password using a seed<a name="line.61"></a>
+<span class="sourceLineNo">062</span> * <a name="line.62"></a>
+<span class="sourceLineNo">063</span> * @param seed the default password supplied by the caller<a name="line.63"></a>
+<span class="sourceLineNo">064</span> * @return a password using "xxxx-xxxx-xxxx-xxxxx"<a name="line.64"></a>
+<span class="sourceLineNo">065</span> * <a name="line.65"></a>
+<span class="sourceLineNo">066</span> * @throws NoSuchAlgorithmException the encryption algorithm is not supported<a name="line.66"></a>
+<span class="sourceLineNo">067</span> * @throws UnsupportedEncodingException the requested encoding is not supported<a name="line.67"></a>
+<span class="sourceLineNo">068</span> */<a name="line.68"></a>
+<span class="sourceLineNo">069</span> public static char[] create( String seed )<a name="line.69"></a>
+<span class="sourceLineNo">070</span> throws NoSuchAlgorithmException, UnsupportedEncodingException<a name="line.70"></a>
+<span class="sourceLineNo">071</span> {<a name="line.71"></a>
+<span class="sourceLineNo">072</span> return create(<a name="line.72"></a>
+<span class="sourceLineNo">073</span> seed.toCharArray()<a name="line.73"></a>
+<span class="sourceLineNo">074</span> );<a name="line.74"></a>
+<span class="sourceLineNo">075</span> }<a name="line.75"></a>
+<span class="sourceLineNo">076</span><a name="line.76"></a>
+<span class="sourceLineNo">077</span> /**<a name="line.77"></a>
+<span class="sourceLineNo">078</span> * @param seed the default password supplied by the caller<a name="line.78"></a>
+<span class="sourceLineNo">079</span> * @return a password using "xxxx-xxxx-xxxx-xxxxx"<a name="line.79"></a>
+<span class="sourceLineNo">080</span> * @throws NoSuchAlgorithmException the encryption algorithm is not supported<a name="line.80"></a>
+<span class="sourceLineNo">081</span> * @throws UnsupportedEncodingException the requested encoding is not supported<a name="line.81"></a>
+<span class="sourceLineNo">082</span> */<a name="line.82"></a>
+<span class="sourceLineNo">083</span> public static final char[] create( char[] seed )<a name="line.83"></a>
+<span class="sourceLineNo">084</span> throws NoSuchAlgorithmException, UnsupportedEncodingException<a name="line.84"></a>
+<span class="sourceLineNo">085</span> {<a name="line.85"></a>
+<span class="sourceLineNo">086</span> return create(<a name="line.86"></a>
+<span class="sourceLineNo">087</span> seed,<a name="line.87"></a>
+<span class="sourceLineNo">088</span> PasswordFactory.SALT,<a name="line.88"></a>
+<span class="sourceLineNo">089</span> PasswordFactory.COUNT<a name="line.89"></a>
+<span class="sourceLineNo">090</span> );<a name="line.90"></a>
+<span class="sourceLineNo">091</span> }<a name="line.91"></a>
+<span class="sourceLineNo">092</span><a name="line.92"></a>
+<span class="sourceLineNo">093</span> /**<a name="line.93"></a>
+<span class="sourceLineNo">094</span> * Creates a default password using "xxxx-xxxx-xxxx-xxxxx".<a name="line.94"></a>
+<span class="sourceLineNo">095</span> *<a name="line.95"></a>
+<span class="sourceLineNo">096</span> * @param salt the password salt<a name="line.96"></a>
+<span class="sourceLineNo">097</span> * @param password the default password<a name="line.97"></a>
+<span class="sourceLineNo">098</span> * @param count number of MessageDigest iterations<a name="line.98"></a>
+<span class="sourceLineNo">099</span> * @return the default password<a name="line.99"></a>
+<span class="sourceLineNo">100</span> * @throws NoSuchAlgorithmException the encryption algorithm is not supported<a name="line.100"></a>
+<span class="sourceLineNo">101</span> * @throws UnsupportedEncodingException the requested encoding is not supported<a name="line.101"></a>
+<span class="sourceLineNo">102</span> */<a name="line.102"></a>
+<span class="sourceLineNo">103</span> public static char [] create( char[] password, byte[] salt, int count )<a name="line.103"></a>
+<span class="sourceLineNo">104</span> throws NoSuchAlgorithmException, UnsupportedEncodingException<a name="line.104"></a>
+<span class="sourceLineNo">105</span> {<a name="line.105"></a>
+<span class="sourceLineNo">106</span> char [] result = null;<a name="line.106"></a>
+<span class="sourceLineNo">107</span> MessageDigest sha1 = MessageDigest.getInstance( "SHA1" );<a name="line.107"></a>
+<span class="sourceLineNo">108</span> byte [] passwordMask = new String( password ).getBytes( "UTF-8" );<a name="line.108"></a>
+<span class="sourceLineNo">109</span> byte [] temp = new byte[salt.length + passwordMask.length];<a name="line.109"></a>
+<span class="sourceLineNo">110</span> byte [] digest = null;<a name="line.110"></a>
+<span class="sourceLineNo">111</span><a name="line.111"></a>
+<span class="sourceLineNo">112</span> StringBuilder stringBuffer = new StringBuilder();<a name="line.112"></a>
+<span class="sourceLineNo">113</span><a name="line.113"></a>
+<span class="sourceLineNo">114</span> // combine the password with the salt string into a byte[9<a name="line.114"></a>
+<span class="sourceLineNo">115</span><a name="line.115"></a>
+<span class="sourceLineNo">116</span> System.arraycopy( passwordMask, 0, temp, 0, passwordMask.length );<a name="line.116"></a>
+<span class="sourceLineNo">117</span> System.arraycopy( salt, 0, temp, passwordMask.length, salt.length );<a name="line.117"></a>
+<span class="sourceLineNo">118</span><a name="line.118"></a>
+<span class="sourceLineNo">119</span> // create a hash over and over to make it a bit random<a name="line.119"></a>
+<span class="sourceLineNo">120</span><a name="line.120"></a>
+<span class="sourceLineNo">121</span> digest = temp;<a name="line.121"></a>
+<span class="sourceLineNo">122</span><a name="line.122"></a>
+<span class="sourceLineNo">123</span> for (int i = 0; i < count; i++)<a name="line.123"></a>
+<span class="sourceLineNo">124</span> {<a name="line.124"></a>
+<span class="sourceLineNo">125</span> sha1.update( digest );<a name="line.125"></a>
+<span class="sourceLineNo">126</span> digest = sha1.digest();<a name="line.126"></a>
+<span class="sourceLineNo">127</span> }<a name="line.127"></a>
+<span class="sourceLineNo">128</span><a name="line.128"></a>
+<span class="sourceLineNo">129</span> // build a well-formed password string to be usable<a name="line.129"></a>
+<span class="sourceLineNo">130</span> // by a human<a name="line.130"></a>
+<span class="sourceLineNo">131</span><a name="line.131"></a>
+<span class="sourceLineNo">132</span> long long1 = createLong( digest, 0 );<a name="line.132"></a>
+<span class="sourceLineNo">133</span> long long2 = createLong( digest, 4 );<a name="line.133"></a>
+<span class="sourceLineNo">134</span> long long3 = createLong( digest, 8 );<a name="line.134"></a>
+<span class="sourceLineNo">135</span> long long4 = createLong( digest, 12 );<a name="line.135"></a>
+<span class="sourceLineNo">136</span><a name="line.136"></a>
+<span class="sourceLineNo">137</span> stringBuffer.append( Long.toHexString( long1 ).substring( 0, 4 ) );<a name="line.137"></a>
+<span class="sourceLineNo">138</span> stringBuffer.append( '-' );<a name="line.138"></a>
+<span class="sourceLineNo">139</span> stringBuffer.append( Long.toHexString( long2 ).substring( 0, 4 ) );<a name="line.139"></a>
+<span class="sourceLineNo">140</span> stringBuffer.append( '-' );<a name="line.140"></a>
+<span class="sourceLineNo">141</span> stringBuffer.append( Long.toHexString( long3 ).substring( 0, 4 ) );<a name="line.141"></a>
+<span class="sourceLineNo">142</span> stringBuffer.append( '-' );<a name="line.142"></a>
+<span class="sourceLineNo">143</span> stringBuffer.append( Long.toHexString( long4 ).substring( 0, 5 ) );<a name="line.143"></a>
+<span class="sourceLineNo">144</span><a name="line.144"></a>
+<span class="sourceLineNo">145</span> // copy the password<a name="line.145"></a>
+<span class="sourceLineNo">146</span> result = new char[stringBuffer.length()];<a name="line.146"></a>
+<span class="sourceLineNo">147</span><a name="line.147"></a>
+<span class="sourceLineNo">148</span> for (int i = 0; i < stringBuffer.length(); i++)<a name="line.148"></a>
+<span class="sourceLineNo">149</span> {<a name="line.149"></a>
+<span class="sourceLineNo">150</span> result[i] = stringBuffer.charAt( i );<a name="line.150"></a>
+<span class="sourceLineNo">151</span> }<a name="line.151"></a>
+<span class="sourceLineNo">152</span><a name="line.152"></a>
+<span class="sourceLineNo">153</span> // wipe out the StringBuilder<a name="line.153"></a>
+<span class="sourceLineNo">154</span> for (int i = 0; i < stringBuffer.length(); i++)<a name="line.154"></a>
+<span class="sourceLineNo">155</span> {<a name="line.155"></a>
+<span class="sourceLineNo">156</span> stringBuffer.setCharAt( i, ' ' );<a name="line.156"></a>
+<span class="sourceLineNo">157</span> }<a name="line.157"></a>
+<span class="sourceLineNo">158</span><a name="line.158"></a>
+<span class="sourceLineNo">159</span> return result;<a name="line.159"></a>
+<span class="sourceLineNo">160</span> }<a name="line.160"></a>
+<span class="sourceLineNo">161</span><a name="line.161"></a>
+<span class="sourceLineNo">162</span> /**<a name="line.162"></a>
+<span class="sourceLineNo">163</span> * Gets bytes from an array into a long.<a name="line.163"></a>
+<span class="sourceLineNo">164</span> *<a name="line.164"></a>
+<span class="sourceLineNo">165</span> * @param buf where to get the bytes<a name="line.165"></a>
+<span class="sourceLineNo">166</span> * @param nOfs index from where to read the data<a name="line.166"></a>
+<span class="sourceLineNo">167</span> * @return the 64bit integer<a name="line.167"></a>
+<span class="sourceLineNo">168</span> */<a name="line.168"></a>
+<span class="sourceLineNo">169</span> private static long createLong(byte [] buf, int nOfs)<a name="line.169"></a>
+<span class="sourceLineNo">170</span> {<a name="line.170"></a>
+<span class="sourceLineNo">171</span> return<a name="line.171"></a>
+<span class="sourceLineNo">172</span> ((long)(( buf[nOfs ] << 24) |<a name="line.172"></a>
+<span class="sourceLineNo">173</span> ((buf[nOfs + 1] & 0x0ff) << 16) |<a name="line.173"></a>
+<span class="sourceLineNo">174</span> ((buf[nOfs + 2] & 0x0ff) << 8) |<a name="line.174"></a>
+<span class="sourceLineNo">175</span> ( buf[nOfs + 3] & 0x0ff )) << 32) |<a name="line.175"></a>
+<span class="sourceLineNo">176</span> ((long)(( buf[nOfs + 4] << 24) |<a name="line.176"></a>
+<span class="sourceLineNo">177</span> ((buf[nOfs + 5] & 0x0ff) << 16) |<a name="line.177"></a>
+<span class="sourceLineNo">178</span> ((buf[nOfs + 6] & 0x0ff) << 8) |<a name="line.178"></a>
+<span class="sourceLineNo">179</span> ( buf[nOfs + 7] & 0x0ff )) & 0x0ffffffffL);<a name="line.179"></a>
+<span class="sourceLineNo">180</span> }<a name="line.180"></a>
+<span class="sourceLineNo">181</span>}<a name="line.181"></a>
@@ -232,6 +247,7 @@
-</PRE>
-</BODY>
-</HTML>
+</pre>
+</div>
+</body>
+</html>
\ No newline at end of file
Modified: websites/production/turbine/content/fulcrum/fulcrum-yaafi-crypto/apidocs/src-html/org/apache/fulcrum/jce/crypto/PasswordParameters.html
==============================================================================
--- websites/production/turbine/content/fulcrum/fulcrum-yaafi-crypto/apidocs/src-html/org/apache/fulcrum/jce/crypto/PasswordParameters.html (original)
+++ websites/production/turbine/content/fulcrum/fulcrum-yaafi-crypto/apidocs/src-html/org/apache/fulcrum/jce/crypto/PasswordParameters.html Tue May 21 03:58:58 2019
@@ -1,52 +1,57 @@
-<HTML>
-<BODY BGCOLOR="white">
-<PRE>
-<FONT color="green">001</FONT> package org.apache.fulcrum.jce.crypto;<a name="line.1"></a>
-<FONT color="green">002</FONT> <a name="line.2"></a>
-<FONT color="green">003</FONT> /*<a name="line.3"></a>
-<FONT color="green">004</FONT> * Licensed to the Apache Software Foundation (ASF) under one<a name="line.4"></a>
-<FONT color="green">005</FONT> * or more contributor license agreements. See the NOTICE file<a name="line.5"></a>
-<FONT color="green">006</FONT> * distributed with this work for additional information<a name="line.6"></a>
-<FONT color="green">007</FONT> * regarding copyright ownership. The ASF licenses this file<a name="line.7"></a>
-<FONT color="green">008</FONT> * to you under the Apache License, Version 2.0 (the<a name="line.8"></a>
-<FONT color="green">009</FONT> * "License"); you may not use this file except in compliance<a name="line.9"></a>
-<FONT color="green">010</FONT> * with the License. You may obtain a copy of the License at<a name="line.10"></a>
-<FONT color="green">011</FONT> *<a name="line.11"></a>
-<FONT color="green">012</FONT> * http://www.apache.org/licenses/LICENSE-2.0<a name="line.12"></a>
-<FONT color="green">013</FONT> *<a name="line.13"></a>
-<FONT color="green">014</FONT> * Unless required by applicable law or agreed to in writing,<a name="line.14"></a>
-<FONT color="green">015</FONT> * software distributed under the License is distributed on an<a name="line.15"></a>
-<FONT color="green">016</FONT> * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY<a name="line.16"></a>
-<FONT color="green">017</FONT> * KIND, either express or implied. See the License for the<a name="line.17"></a>
-<FONT color="green">018</FONT> * specific language governing permissions and limitations<a name="line.18"></a>
-<FONT color="green">019</FONT> * under the License.<a name="line.19"></a>
-<FONT color="green">020</FONT> */<a name="line.20"></a>
-<FONT color="green">021</FONT> <a name="line.21"></a>
-<FONT color="green">022</FONT> /**<a name="line.22"></a>
-<FONT color="green">023</FONT> * Parameters for creating a password.<a name="line.23"></a>
-<FONT color="green">024</FONT> *<a name="line.24"></a>
-<FONT color="green">025</FONT> * @author <a href="mailto:siegfried.goeschl@it20one.at">Siegfried Goeschl</a><a name="line.25"></a>
-<FONT color="green">026</FONT> */<a name="line.26"></a>
-<FONT color="green">027</FONT> <a name="line.27"></a>
-<FONT color="green">028</FONT> public interface PasswordParameters<a name="line.28"></a>
-<FONT color="green">029</FONT> {<a name="line.29"></a>
-<FONT color="green">030</FONT> /** Parameter for the number of SHA1 invocation */<a name="line.30"></a>
-<FONT color="green">031</FONT> int COUNT = 20;<a name="line.31"></a>
-<FONT color="green">032</FONT> <a name="line.32"></a>
-<FONT color="green">033</FONT> /** The default password used for creating the internal password */<a name="line.33"></a>
-<FONT color="green">034</FONT> char[] DEFAULTPASSWORD = {<a name="line.34"></a>
-<FONT color="green">035</FONT> (char) 'f', (char) 'u', (char) 'l', (char) 'c',<a name="line.35"></a>
-<FONT color="green">036</FONT> (char) 'r', (char) 'u', (char) 'm', (char) '-',<a name="line.36"></a>
-<FONT color="green">037</FONT> (char) 'y', (char) 'a', (char) 'a', (char) 'f',<a name="line.37"></a>
-<FONT color="green">038</FONT> (char) 'i'<a name="line.38"></a>
-<FONT color="green">039</FONT> };<a name="line.39"></a>
-<FONT color="green">040</FONT> <a name="line.40"></a>
-<FONT color="green">041</FONT> /** The password salt */<a name="line.41"></a>
-<FONT color="green">042</FONT> byte[] SALT = {<a name="line.42"></a>
-<FONT color="green">043</FONT> (byte)0xc6, (byte)0x74, (byte)0x81, (byte)0x8a,<a name="line.43"></a>
-<FONT color="green">044</FONT> (byte)0x7b, (byte)0xe8, (byte)0xfe, (byte)0x99<a name="line.44"></a>
-<FONT color="green">045</FONT> };<a name="line.45"></a>
-<FONT color="green">046</FONT> }<a name="line.46"></a>
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html lang="en">
+<head>
+<title>Source code</title>
+<link rel="stylesheet" type="text/css" href="../../../../../../stylesheet.css" title="Style">
+</head>
+<body>
+<div class="sourceContainer">
+<pre><span class="sourceLineNo">001</span>package org.apache.fulcrum.jce.crypto;<a name="line.1"></a>
+<span class="sourceLineNo">002</span><a name="line.2"></a>
+<span class="sourceLineNo">003</span>/*<a name="line.3"></a>
+<span class="sourceLineNo">004</span> * Licensed to the Apache Software Foundation (ASF) under one<a name="line.4"></a>
+<span class="sourceLineNo">005</span> * or more contributor license agreements. See the NOTICE file<a name="line.5"></a>
+<span class="sourceLineNo">006</span> * distributed with this work for additional information<a name="line.6"></a>
+<span class="sourceLineNo">007</span> * regarding copyright ownership. The ASF licenses this file<a name="line.7"></a>
+<span class="sourceLineNo">008</span> * to you under the Apache License, Version 2.0 (the<a name="line.8"></a>
+<span class="sourceLineNo">009</span> * "License"); you may not use this file except in compliance<a name="line.9"></a>
+<span class="sourceLineNo">010</span> * with the License. You may obtain a copy of the License at<a name="line.10"></a>
+<span class="sourceLineNo">011</span> *<a name="line.11"></a>
+<span class="sourceLineNo">012</span> * http://www.apache.org/licenses/LICENSE-2.0<a name="line.12"></a>
+<span class="sourceLineNo">013</span> *<a name="line.13"></a>
+<span class="sourceLineNo">014</span> * Unless required by applicable law or agreed to in writing,<a name="line.14"></a>
+<span class="sourceLineNo">015</span> * software distributed under the License is distributed on an<a name="line.15"></a>
+<span class="sourceLineNo">016</span> * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY<a name="line.16"></a>
+<span class="sourceLineNo">017</span> * KIND, either express or implied. See the License for the<a name="line.17"></a>
+<span class="sourceLineNo">018</span> * specific language governing permissions and limitations<a name="line.18"></a>
+<span class="sourceLineNo">019</span> * under the License.<a name="line.19"></a>
+<span class="sourceLineNo">020</span> */<a name="line.20"></a>
+<span class="sourceLineNo">021</span><a name="line.21"></a>
+<span class="sourceLineNo">022</span>/**<a name="line.22"></a>
+<span class="sourceLineNo">023</span> * Parameters for creating a password.<a name="line.23"></a>
+<span class="sourceLineNo">024</span> *<a name="line.24"></a>
+<span class="sourceLineNo">025</span> * @author <a href="mailto:siegfried.goeschl@it20one.at">Siegfried Goeschl</a><a name="line.25"></a>
+<span class="sourceLineNo">026</span> */<a name="line.26"></a>
+<span class="sourceLineNo">027</span><a name="line.27"></a>
+<span class="sourceLineNo">028</span>public interface PasswordParameters<a name="line.28"></a>
+<span class="sourceLineNo">029</span>{<a name="line.29"></a>
+<span class="sourceLineNo">030</span> /** Parameter for the number of SHA1 invocation */<a name="line.30"></a>
+<span class="sourceLineNo">031</span> int COUNT = 20;<a name="line.31"></a>
+<span class="sourceLineNo">032</span><a name="line.32"></a>
+<span class="sourceLineNo">033</span> /** The default password used for creating the internal password */<a name="line.33"></a>
+<span class="sourceLineNo">034</span> char[] DEFAULTPASSWORD = {<a name="line.34"></a>
+<span class="sourceLineNo">035</span> (char) 'f', (char) 'u', (char) 'l', (char) 'c',<a name="line.35"></a>
+<span class="sourceLineNo">036</span> (char) 'r', (char) 'u', (char) 'm', (char) '-',<a name="line.36"></a>
+<span class="sourceLineNo">037</span> (char) 'y', (char) 'a', (char) 'a', (char) 'f',<a name="line.37"></a>
+<span class="sourceLineNo">038</span> (char) 'i'<a name="line.38"></a>
+<span class="sourceLineNo">039</span> };<a name="line.39"></a>
+<span class="sourceLineNo">040</span><a name="line.40"></a>
+<span class="sourceLineNo">041</span> /** The password salt */<a name="line.41"></a>
+<span class="sourceLineNo">042</span> byte[] SALT = {<a name="line.42"></a>
+<span class="sourceLineNo">043</span> (byte)0xc6, (byte)0x74, (byte)0x81, (byte)0x8a,<a name="line.43"></a>
+<span class="sourceLineNo">044</span> (byte)0x7b, (byte)0xe8, (byte)0xfe, (byte)0x99<a name="line.44"></a>
+<span class="sourceLineNo">045</span> };<a name="line.45"></a>
+<span class="sourceLineNo">046</span>}<a name="line.46"></a>
@@ -107,6 +112,7 @@
-</PRE>
-</BODY>
-</HTML>
+</pre>
+</div>
+</body>
+</html>
\ No newline at end of file