1 19 package org.netbeans.modules.subversion.config; 20 21 import java.io.File ; 22 import java.security.MessageDigest ; 23 import java.security.NoSuchAlgorithmException ; 24 import org.openide.ErrorManager; 25 26 32 public abstract class SVNCredentialFile extends KVFile { 33 34 35 38 protected SVNCredentialFile(File file) { 39 super(file); 40 } 41 42 45 protected static String getFileName(String realmString) { 46 assert realmString != null; 47 String fileName = ""; try { 49 MessageDigest md5 = MessageDigest.getInstance("MD5"); md5.update(realmString.getBytes()); 51 byte[] md5digest = md5.digest(); 52 for (int i = 0; i < md5digest.length; i++) { 53 String hex = Integer.toHexString(md5digest[i] & 0x000000FF); 54 if(hex.length()==1) { 55 hex = "0" + hex; } 57 fileName += hex; 58 } 59 } catch (NoSuchAlgorithmException e) { 60 ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, e); } 62 63 return fileName; 64 } 65 66 protected abstract String getRealmString(); 67 protected abstract void setRealmString(String realm); 68 } 69 | Popular Tags |