de.frame4j
Class PKextr

java.lang.Object
  extended by de.frame4j.util.App
      extended by de.frame4j.PKextr
All Implemented Interfaces:
AttrSettable, TextHelper.MessageComponents, UIInfo, ActionListener, EventListener, DynamicMBean

@MinDoc(copyright="Copyright 2004, 2008 , 2009  A. Weinert",
        author="Albrecht Weinert",
        version="V.21",
        lastModified="12.02.2010",
        lastModifiedBy="A. Weinert",
        usage="start as Java application (-? for help)",
        purpose="extract keys from keystores or certificates")
public class PKextr
extends App

Determine / extract public key from keystore or certificate.

This Java application extracts a public key from a

A password question may be necessary. If so it will be done graphically using an AskDialog window. The user's password entry will not be visible / readable.

The public key's output will be in textual form (human readable) to the console and optionally to a (log) file (that is to App.log). Additionally a binary public key file may be output, from which the key can be read / regenerated by standard JAva means.

Hint: To this application PKextr (source) belongs a .properties file PKextr.properties that may be considered as part of the documentation and may answer open questions.

Hint 2: Provided one has the necessary privileges this application can also extract the private key.


Copyright 2004, 2005, 2008   Albrecht Weinert

See Also:
App

Field Summary
 String certFileName
          Name of input file (certificate or keystore).
 String certType
          Type of certificate / keystore.
 boolean exportPrivate
          Export the private instead of the public key.
 boolean fromCert
          Read from certificate not from keystore.
protected  String keyAlias
          Alias name for key from keystore.
protected  String pubKeyFil
          Output file for the public key.
 String storePassW
          Password for the keystore.
 String w0
          Word parameter 1 and 2.
 String w1
          Word parameter 1 and 2.
 
Fields inherited from class de.frame4j.util.App
ano, appBase, appIO, appStartTime, args, bgColor, err, fullClassName, help, icon, INIT_ERROR, jmxRemoteNote, JOB_DONE_OK, log, LOG_OUT_ERROR, MAIN_THREAD_EXC, mainThread, myClass, myFrame, name, NO_PARS_ERROR, objectName, out, outMode, packName, prop, retCode, runFlag, shortClassName, title, verbose, verbosity
 
Fields inherited from interface de.frame4j.net.AttrSettable
ILLEGAL_TYPE, ILLEGAL_VALUE, NO_ATTRIBUTE, NO_KNOWN_ATTRIBUTE, NO_VALUE, OK
 
Constructor Summary
PKextr()
           
 
Method Summary
 int doIt()
          Working method of PKextr.
static void main(String[] args)
          Start method of PKextr.
 
Methods inherited from class de.frame4j.util.App
actionPerformed, allowNoPropertiesFile, clientOrder, condHelpLog, connect, errMeld, errMeld, errorExit, errorExit, errorExit, errorText, formMessage, formMessage, getAbout, getAboutText, getActTime, getAppLogger, getAppStartTime, getArgs, getAttribute, getAttributes, getAuthor, getCopyright, getDbLogger, getExecTimeMs, getExecTimeString, getHelp, getHelpText, getIcon, getLanguage, getLogHandler, getMBeanInfo, getMessageComponent, getMessageComponentsLength, getMyFrame, getName, getNameWithVersDate, getOutMode, getProp, getPurpose, getStartTime, getStateString, getTitle, getUsage, getVerbosity, getVerbosityString, getVersDate, getXMLinput, go, go, go, haveIcon, invoke, isDebug, isHelp, isHelpLog, isNormal, isRunFlag, isSilent, isTest, isVerbose, logVerbose, logVerbose, makeDbLogger, makeMenuBar, makeMenuBar, makeStatusTextEnd, makeStatusTextStart, messageFormat, normalExit, parsePartial, performeAction, postDeregister, postRegister, preRegister, queueAction, registerAsMBean, setAboutText, setAttribute, setAttribute, setAttribute, setAttributes, setAuthor, setBgColor, setCodePages, setCopyright, setHelp, setJmxRemoteNote, setLogOut2, setName, setOutMode, setOutMode, setPurpose, setTitle, setUsage, setVerbose, setVerbose, setVerbosity, setVerbosity, setVerbosityString, setVersDate, stop, threeLineEndMsg, toString, twoLineEndMsg, twoLineStartMsg, valueLang, valueLang, wakeMainThread
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

pubKeyFil

protected String pubKeyFil
Output file for the public key.


certType

public String certType
Type of certificate / keystore.

Allowed values for certificate: "X.509"
Allowed values for keystore: "JKS",  "PKCS12"
default: "X.509"


fromCert

public boolean fromCert
Read from certificate not from keystore.

default: true

See Also:
certType

exportPrivate

public boolean exportPrivate
Export the private instead of the public key.

default: false


certFileName

public String certFileName
Name of input file (certificate or keystore).

default: null


storePassW

public String storePassW
Password for the keystore.


keyAlias

protected String keyAlias
Alias name for key from keystore.


w0

public String w0
Word parameter 1 and 2.


w1

public String w1
Word parameter 1 and 2.

Constructor Detail

PKextr

public PKextr()
Method Detail

main

public static void main(String[] args)
Start method of PKextr.

The application end with exit-code 0 on success. Exit-code > 0 means abort due to a problem.

Parameters:
args - command line parameter
Execute: PKextr [options]

doIt

public int doIt()
Working method of PKextr.

Specified by:
doIt in class App
Returns:
> 0: error; 0: OK
See Also:
Prop, App.go(String[], boolean), App.go(String[], String, boolean, CharSequence), App.mainThread