Skip to content

Commit

Permalink
add jceks-decode
Browse files Browse the repository at this point in the history
  • Loading branch information
kgyrtkirk committed Mar 11, 2020
1 parent 677d132 commit fc8f6ec
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 6 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ compile 'org.slf4j:slf4j-simple:1.7.25'

compile 'hu.rxd:lexirex:+'
// https://mvnrepository.com/artifact/org.eclipse.jgit/org.eclipse.jgit
compile group: 'org.eclipse.jgit', name: 'org.eclipse.jgit', version: '4.11.0.201803080745-r'
compile group: 'org.eclipse.jgit', name: 'org.eclipse.jgit', version: '5.6.1.202002131546-r'

compile 'org.rauschig:jarchivelib:0.7.1'
// https://mvnrepository.com/artifact/org.codehaus.plexus/plexus-utils
Expand Down
40 changes: 35 additions & 5 deletions src/main/java/hu/rxd/toolbox/Toolbox.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,34 +19,64 @@
package hu.rxd.toolbox;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.PrintStream;
import java.math.BigInteger;
import java.net.URL;
import java.security.Key;
import java.security.KeyStore;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Enumeration;
import java.util.List;
import java.util.Random;

import org.apache.commons.io.FileUtils;
import javax.crypto.SecretKey;

import org.apache.commons.collections.EnumerationUtils;
import org.apache.xerces.impl.dv.util.Base64;

import com.google.common.base.Joiner;
import com.google.common.collect.Iterables;

import hu.rxd.toolbox.jenkins.TestEntries;
import hu.rxd.toolbox.jira.HiveTicket;
import hu.rxd.toolbox.jira.ToolboxSettings;
import hu.rxd.toolbox.qtest.IInputStreamDispatcher;
import hu.rxd.toolbox.qtest.LastQAReportInputStreamDispatcher;
import hu.rxd.toolbox.qtest.LocalFileDispatcher;
import hu.rxd.toolbox.qtest.LocalizedArchiveDispatcher;
import hu.rxd.toolbox.qtest.QTDiffRunner;
import hu.rxd.toolbox.qtest.diff.CachedURL;
import net.rcarz.jiraclient.Attachment;
import net.rcarz.jiraclient.Comment;

public class Toolbox {

public static void main(String[] args) throws FileNotFoundException, Exception {

if (args[0].equals("jceks-decode")) {
String fileName = args[1];
char[] password = "none".toCharArray();
// String alias = args[2];

KeyStore ks = KeyStore.getInstance("JCEKS");
try (FileInputStream fis = new FileInputStream(fileName)) {
ks.load(fis, password);
Enumeration<String> aa = ks.aliases();
for (String alias : (List<String>) EnumerationUtils.toList(aa)) {
SecretKey secretKey = (SecretKey) ks.getKey(alias, password);
String secret = new String(secretKey.getEncoded());

System.out.println("alias: " + alias);
System.out.println("secret: " + secret);
// System.out.println(Base64.decode(secret));
// System.out.println(new BigInteger(1, secretKey.getEncoded()).toString(16));
// System.out.println(secretKey.getEncoded());
// Key key = secretKey;

}
}
return;
}

if (args[0].equals("reattach")) {
TicketUtils.reattach(args[1]);
return;
Expand Down

0 comments on commit fc8f6ec

Please sign in to comment.