PPP Java Implementation
UPDATED! See this post
Here is my java implementation of Steve Gibson’s PPPv2 built off of John Graham-Cumming’s Java Phone Client Implementation. My class will handle all of the necessary functions to create a PPP card including performing the SHA-256 hash of a passcode to the 64 character sequence key.
This is a copy of my example driver for my class:
1: Scanner in = new Scanner(System.in);
2: System.out.print("Password: ");
3: String password = in.next();
4: System.out.print("Card #: ");
5: int card = in.nextInt();
6: System.out.print("Column: ");
7: String col = in.next();
8: System.out.print("Row: ");
9: int row = in.nextInt();
10: String sequencekey = PPPengine.findSequenceKey(password);
11: PPPengine card1 = new PPPengine(sequencekey);
12: System.out.println("Your one-time code is "+card1.makePasscode (card,col,row));
<p>.csharpcode, .csharpcode pre { font-size: small; color: black; font-family: consolas, “Courier New”, courier, monospace; background-color: #ffffff; /*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt { background-color: #f4f4f4; width: 100%; margin: 0em; } .csharpcode .lnum { color: #606060; }
Download the zip file including the source, the bytecode, the javadocs, a demonstration jar file, and a demonstration exe file made from the jar using jSmooth.
Class PPPengine Java Doc
java.lang.Object extended by PPPengine
-
public class PPPengine
- extends java.lang.Object
Main class for PPP password calculations.
| Constructor Summary | |
|---|---|
PPPengine(java.lang.String sequencekey)
Initiates the PPP card object. |
|
| Method Summary | |
|---|---|
int |
columnToInt(java.lang.String s)
Converts A-F to 0-6 for the PPPengine. |
static java.lang.String |
findSequenceKey(java.lang.String passphrase)
Creates 64-bit sequence key from passphrase using SHA-256. |
java.lang.String |
makePasscode()
Generates the passcode using the Rijndael cypher. |
java.lang.String |
makePasscode(int cardNumber, int column, int row)
Generates and returns specified passcode. |
java.lang.String |
makePasscode(int cardNumber, java.lang.String column, int row)
Generates and returns specified passcode. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
PPPengine
public PPPengine(java.lang.String sequencekey)
- Initiates the PPP card object. Use this to create a virtual replacement for printed PPP cards. Takes sequence key only.
- Parameters:
sequencekey– 64 Character key used to generate card
| Method Detail |
|---|
columnToInt
public int columnToInt(java.lang.String s)
- Converts A-F to 0-6 for the PPPengine.
-
- Parameters:
s– String A-F to be converted- Returns:
- 0-5 to be used as column
- Throws:
java.lang.IllegalArgumentException
makePasscode
public java.lang.String makePasscode()
- Generates the passcode using the Rinjndael cypher.
-
- Returns:
- String of 4 characters that is the passcode.
- Throws:
java.lang.IllegalArgumentException- See Also:
Rinjndael
makePasscode
public java.lang.String makePasscode(int cardNumber, java.lang.String column, int row)
- Generates and returns specified passcode. Takes String column.
-
- Parameters:
cardNumber– Card numbercolumn– String A-F specifing columnrow– Int 1-10 specifing row
makePasscode
public java.lang.String makePasscode(int cardNumber, int column, int row)
- Generates and returns specified passcode. Takes integer column.
-
- Parameters:
cardNumber– Card numbercolumn– Int 1-6 specifing columnrow– Int 1-10 specifing row
findSequenceKey
public static java.lang.String findSequenceKey(java.lang.String passphrase)
- Creates 64-bit sequence key from passphrase using SHA-256.
-
- Parameters:
passphrase– String passphrase to be converted- Returns:
- String 64-bit sequence key

Leave a Reply