Skip to content

Commit 9be7084

Browse files
committed
removed unused static main in ConsoleProxyPasswordBasedEncryptor
This closes #11 This closes #10 This closes #176
1 parent 02031ab commit 9be7084

File tree

2 files changed

+0
-60
lines changed

2 files changed

+0
-60
lines changed

server/src/com/cloud/servlet/ConsoleProxyPasswordBasedEncryptor.java

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
import java.security.InvalidAlgorithmParameterException;
2020
import java.security.InvalidKeyException;
2121
import java.security.NoSuchAlgorithmException;
22-
import java.security.SecureRandom;
2322

2423
import javax.crypto.BadPaddingException;
2524
import javax.crypto.Cipher;
@@ -159,33 +158,4 @@ public void setIvBytes(byte[] ivBytes) {
159158
}
160159
}
161160

162-
public static void main(String[] args) {
163-
SecureRandom random;
164-
try {
165-
random = SecureRandom.getInstance("SHA1PRNG");
166-
byte[] keyBytes = new byte[16];
167-
random.nextBytes(keyBytes);
168-
169-
byte[] ivBytes = new byte[16];
170-
random.nextBytes(ivBytes);
171-
172-
KeyIVPair keyIvPair = new KeyIVPair("8x/xUBgX0Up+3UEo39dSeG277JhVj31+ElHkN5+EC0Q=", "Y2SUiIN6JXTdKNK/ZMDyVtLB7gAM9MCCiyrP1xd3bSQ=");
173-
//keyIvPair.setKeyBytes(keyBytes);
174-
//keyIvPair.setIvBytes(ivBytes);
175-
176-
Gson gson = new GsonBuilder().create();
177-
ConsoleProxyPasswordBasedEncryptor encryptor = new ConsoleProxyPasswordBasedEncryptor(gson.toJson(keyIvPair));
178-
179-
String encrypted = encryptor.encryptText("Hello, world");
180-
181-
System.out.println("Encrypted result: " + encrypted);
182-
183-
String decrypted = encryptor.decryptText(encrypted);
184-
185-
System.out.println("Decrypted result: " + decrypted);
186-
187-
} catch (NoSuchAlgorithmException e) {
188-
e.printStackTrace();
189-
}
190-
}
191161
}

services/console-proxy/server/src/com/cloud/consoleproxy/ConsoleProxyPasswordBasedEncryptor.java

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
import java.security.InvalidAlgorithmParameterException;
2020
import java.security.InvalidKeyException;
2121
import java.security.NoSuchAlgorithmException;
22-
import java.security.SecureRandom;
2322

2423
import javax.crypto.BadPaddingException;
2524
import javax.crypto.Cipher;
@@ -165,33 +164,4 @@ public void setIvBytes(byte[] ivBytes) {
165164
}
166165
}
167166

168-
public static void main(String[] args) {
169-
SecureRandom random;
170-
try {
171-
random = SecureRandom.getInstance("SHA1PRNG");
172-
byte[] keyBytes = new byte[16];
173-
random.nextBytes(keyBytes);
174-
175-
byte[] ivBytes = new byte[16];
176-
random.nextBytes(ivBytes);
177-
178-
KeyIVPair keyIvPair = new KeyIVPair("8x/xUBgX0Up+3UEo39dSeG277JhVj31+ElHkN5+EC0Q=", "Y2SUiIN6JXTdKNK/ZMDyVtLB7gAM9MCCiyrP1xd3bSQ=");
179-
//keyIvPair.setKeyBytes(keyBytes);
180-
//keyIvPair.setIvBytes(ivBytes);
181-
182-
Gson gson = new GsonBuilder().create();
183-
ConsoleProxyPasswordBasedEncryptor encryptor = new ConsoleProxyPasswordBasedEncryptor(gson.toJson(keyIvPair));
184-
185-
String encrypted = encryptor.encryptText("Hello, world");
186-
187-
System.out.println("Encrypted result: " + encrypted);
188-
189-
String decrypted = encryptor.decryptText(encrypted);
190-
191-
System.out.println("Decrypted result: " + decrypted);
192-
193-
} catch (NoSuchAlgorithmException e) {
194-
e.printStackTrace();
195-
}
196-
}
197167
}

0 commit comments

Comments
 (0)