This repository has been archived by the owner on Oct 29, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c052da6
commit 1bfb48f
Showing
5 changed files
with
260 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,170 @@ | ||
/******************************************************************************* | ||
* This file is part of Waarp Project (named also Waarp or GG). | ||
* | ||
* Copyright (c) 2019, Waarp SAS, and individual contributors by the @author | ||
* tags. See the COPYRIGHT.txt in the distribution for a full listing of | ||
* individual contributors. | ||
* | ||
* All Waarp Project is free software: you can redistribute it and/or | ||
* modify it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or (at your | ||
* option) any later version. | ||
* | ||
* Waarp is distributed in the hope that it will be useful, but WITHOUT ANY | ||
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR | ||
* A PARTICULAR PURPOSE. See the GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License along with | ||
* Waarp . If not, see <http://www.gnu.org/licenses/>. | ||
******************************************************************************/ | ||
|
||
package org.waarp.uip; | ||
|
||
import org.junit.Test; | ||
import org.waarp.common.utility.DetectionUtils; | ||
import org.waarp.common.utility.WaarpStringUtils; | ||
|
||
import java.io.File; | ||
|
||
import static junit.framework.TestCase.*; | ||
|
||
public class WaarpPasswordTest { | ||
|
||
@Test | ||
public void testWaarpPassword() throws Exception { | ||
DetectionUtils.setJunit(true); | ||
int step = 0; | ||
System.out.println("Step " + step++); | ||
{ | ||
String[] args = { | ||
}; | ||
WaarpPassword.main(args); | ||
} | ||
Thread.sleep(5); | ||
// using DES | ||
System.out.println("Step " + step++); | ||
File keyFile = new File("/tmp/out.ggp"); | ||
keyFile.delete(); | ||
{ | ||
String[] args = { | ||
"-clear", | ||
"-des", | ||
"-ko", "/tmp/out.ggp" | ||
}; | ||
WaarpPassword.main(args); | ||
assertTrue(keyFile.exists()); | ||
} | ||
Thread.sleep(5); | ||
System.out.println("Step " + step++); | ||
{ | ||
String[] args = { | ||
"-clear", | ||
"-ki", "/tmp/out.ggp" | ||
}; | ||
WaarpPassword.main(args); | ||
} | ||
Thread.sleep(5); | ||
System.out.println("Step " + step++); | ||
File pwd = new File("/tmp/pwd.ggp"); | ||
pwd.delete(); | ||
{ | ||
String[] args = { | ||
"-clear", | ||
"-ki", "/tmp/out.ggp", | ||
"-po", "/tmp/pwd.ggp", | ||
"-pwd", "pwd" | ||
}; | ||
WaarpPassword.main(args); | ||
assertTrue(pwd.exists()); | ||
} | ||
Thread.sleep(5); | ||
System.out.println("Step " + step++); | ||
{ | ||
String[] args = { | ||
"-clear", | ||
"-ki", "/tmp/out.ggp", | ||
"-pi", "/tmp/pwd.ggp" | ||
}; | ||
WaarpPassword.main(args); | ||
} | ||
Thread.sleep(5); | ||
System.out.println("Step " + step++); | ||
String cpwd = WaarpStringUtils.readFile("/tmp/pwd.ggp"); | ||
{ | ||
String[] args = { | ||
"-clear", | ||
"-ki", "/tmp/out.ggp", | ||
"-po", "/tmp/pwd.ggp", | ||
"-cpwd", cpwd | ||
}; | ||
WaarpPassword.main(args); | ||
assertTrue(pwd.exists()); | ||
} | ||
// Using BlowFish | ||
keyFile.delete(); | ||
pwd.delete(); | ||
Thread.sleep(5); | ||
System.out.println("Step " + step++); | ||
|
||
{ | ||
String[] args = { | ||
"-clear", | ||
"-blf", | ||
"-ko", "/tmp/out.ggp" | ||
}; | ||
WaarpPassword.main(args); | ||
assertTrue(keyFile.exists()); | ||
} | ||
Thread.sleep(5); | ||
System.out.println("Step " + step++); | ||
{ | ||
String[] args = { | ||
"-clear", | ||
"-blf", | ||
"-ki", "/tmp/out.ggp" | ||
}; | ||
WaarpPassword.main(args); | ||
} | ||
Thread.sleep(5); | ||
System.out.println("Step " + step++); | ||
{ | ||
String[] args = { | ||
"-clear", | ||
"-blf", | ||
"-ki", "/tmp/out.ggp", | ||
"-po", "/tmp/pwd.ggp", | ||
"-pwd", "pwd" | ||
}; | ||
WaarpPassword.main(args); | ||
assertTrue(pwd.exists()); | ||
} | ||
Thread.sleep(5); | ||
System.out.println("Step " + step++); | ||
{ | ||
String[] args = { | ||
"-clear", | ||
"-blf", | ||
"-ki", "/tmp/out.ggp", | ||
"-pi", "/tmp/pwd.ggp" | ||
}; | ||
WaarpPassword.main(args); | ||
} | ||
Thread.sleep(5); | ||
System.out.println("Step " + step++); | ||
cpwd = WaarpStringUtils.readFile("/tmp/pwd.ggp"); | ||
{ | ||
String[] args = { | ||
"-clear", | ||
"-blf", | ||
"-ki", "/tmp/out.ggp", | ||
"-po", "/tmp/pwd.ggp", | ||
"-cpwd", cpwd | ||
}; | ||
WaarpPassword.main(args); | ||
assertTrue(pwd.exists()); | ||
} | ||
pwd.delete(); | ||
keyFile.delete(); | ||
} | ||
|
||
} |