cipher.encryptAndDecorate( passwd, DefaultSecDispatcher.SYSTEM_PROPERTY_SEC_LOCATION ) ); System.out.println( cipher.encryptAndDecorate( passwd, masterPasswd ) );
private static void show( boolean showMaster ) throws Exception { if( showMaster ) System.out.print("\nsettings master password\n"); else System.out.print("\nsettings server password\n"); System.out.print("enter password: "); BufferedReader r = new BufferedReader( new InputStreamReader( System.in ) ); String pass = r.readLine(); System.out.println("\n"); DefaultPlexusCipher dc = new DefaultPlexusCipher(); DefaultSecDispatcher dd = new DefaultSecDispatcher(); dd._cipher = dc; if( showMaster ) System.out.println( dc.encryptAndDecorate( pass, DefaultSecDispatcher.SYSTEM_PROPERTY_SEC_LOCATION ) ); else { SettingsSecurity sec = dd.getSec(); System.out.println( dc.encryptAndDecorate( pass, dd.getMaster(sec) ) ); } } //---------------------------------------------------------------
cliRequest.stdout.println( cipher.encryptAndDecorate( passwd, DefaultSecDispatcher.SYSTEM_PROPERTY_SEC_LOCATION ) ); cliRequest.stdout.println( cipher.encryptAndDecorate( passwd, masterPasswd ) );
private String encryptAndDecorate( String passwd ) throws IllegalStateException, SecDispatcherException, PlexusCipherException { String configurationFile = secDispatcher.getConfigurationFile(); if ( configurationFile.startsWith( "~" ) ) { configurationFile = System.getProperty( "user.home" ) + configurationFile.substring( 1 ); } String file = System.getProperty( DefaultSecDispatcher.SYSTEM_PROPERTY_SEC_LOCATION, configurationFile ); String master = null; SettingsSecurity sec = SecUtil.read( file, true ); if ( sec != null ) { master = sec.getMaster(); } if ( master == null ) { throw new IllegalStateException( "Master password is not set in the setting security file: " + file ); } DefaultPlexusCipher cipher = new DefaultPlexusCipher(); String masterPasswd = cipher.decryptDecorated( master, DefaultSecDispatcher.SYSTEM_PROPERTY_SEC_LOCATION ); return cipher.encryptAndDecorate( passwd, masterPasswd ); }
System.out.println( cipher.encryptAndDecorate( passwd, DefaultSecDispatcher.SYSTEM_PROPERTY_SEC_LOCATION ) ); System.out.println( cipher.encryptAndDecorate( passwd, masterPasswd ) );
private String encryptAndDecorate( String passwd ) throws IllegalStateException, SecDispatcherException, PlexusCipherException { String configurationFile = secDispatcher.getConfigurationFile(); if ( configurationFile.startsWith( "~" ) ) { configurationFile = System.getProperty( "user.home" ) + configurationFile.substring( 1 ); } String file = System.getProperty( DefaultSecDispatcher.SYSTEM_PROPERTY_SEC_LOCATION, configurationFile ); String master = null; SettingsSecurity sec = SecUtil.read( file, true ); if ( sec != null ) { master = sec.getMaster(); } if ( master == null ) { throw new IllegalStateException( "Master password is not set in the setting security file: " + file ); } DefaultPlexusCipher cipher = new DefaultPlexusCipher(); String masterPasswd = cipher.decryptDecorated( master, DefaultSecDispatcher.SYSTEM_PROPERTY_SEC_LOCATION ); return cipher.encryptAndDecorate( passwd, masterPasswd ); }
cliRequest.stdout.println( cipher.encryptAndDecorate( passwd, DefaultSecDispatcher.SYSTEM_PROPERTY_SEC_LOCATION ) ); cliRequest.stdout.println( cipher.encryptAndDecorate( passwd, masterPasswd ) );
cipher.encryptAndDecorate( passwd, DefaultSecDispatcher.SYSTEM_PROPERTY_SEC_LOCATION ) ); System.out.println( cipher.encryptAndDecorate( passwd, masterPasswd ) );
System.out.println( cipher.encryptAndDecorate( passwd, DefaultSecDispatcher.SYSTEM_PROPERTY_SEC_LOCATION ) ); System.out.println( cipher.encryptAndDecorate( passwd, masterPasswd ) );
System.out.println("Encrypted password: " + cipher.encryptAndDecorate(password, masterPassword)); System.out.println("You can use this encrypted password when defining repositories and proxies"); return; String encryptedPassword = cipher.encryptAndDecorate(password, DefaultSecDispatcher.SYSTEM_PROPERTY_SEC_LOCATION); System.out.println("Encrypted master password: " + encryptedPassword); if (persist) {
result = cipher.encryptAndDecorate(password, SYSTEM_PROPERTY_SEC_LOCATION); String masterPasswd = cipher.decryptDecorated(master, SYSTEM_PROPERTY_SEC_LOCATION); result = cipher.encryptAndDecorate(password, masterPasswd);