summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
authorMatthew Newhook <matthew@zeroc.com>2008-04-24 16:45:08 +0800
committerMatthew Newhook <matthew@zeroc.com>2008-04-24 16:45:08 +0800
commit493e68fbdcb885533b4343eaaa21dea027e2c55f (patch)
treee18b7bd63ae30a57d05e22d903ef84f00d9acbfb /cpp/src
parentbug 3012 - Python converter demo fixes (diff)
downloadice-493e68fbdcb885533b4343eaaa21dea027e2c55f.tar.bz2
ice-493e68fbdcb885533b4343eaaa21dea027e2c55f.tar.xz
ice-493e68fbdcb885533b4343eaaa21dea027e2c55f.zip
Squashed commit of the following:
commit 7c8786e9196dea0bd634a3b5fef9612a8416806a Author: Matthew Newhook <matthew@zeroc.com> Date: Thu Apr 24 16:13:45 2008 +0800 remove old junk. commit bc11400164ea4d8158d385179d798b1abc216a2e Author: Matthew Newhook <matthew@zeroc.com> Date: Thu Apr 24 14:09:07 2008 +0800 - iceca and associated ImportKey.class are now copied into bin and lib respectively. - iceca did not correctly support the --verbose flag with the import command. - iceca request has been simplified. The command now takes the name of the file to generate, the common name, and an optional email address. - Updated the IceGrid/secure demo for the iceca changes.
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/ca/Makefile13
-rw-r--r--cpp/src/ca/Makefile.mak21
-rwxr-xr-xcpp/src/ca/iceca77
3 files changed, 55 insertions, 56 deletions
diff --git a/cpp/src/ca/Makefile b/cpp/src/ca/Makefile
index 0c50a567eb0..57df5e43454 100644
--- a/cpp/src/ca/Makefile
+++ b/cpp/src/ca/Makefile
@@ -9,11 +9,20 @@
top_srcdir = ../..
+CA_FILES = iceca
+
+CLASS_FILES = ImportKey.class
+
+TARGETS = $(top_srcdir)/bin/iceca \
+ $(top_srcdir)/lib/ImportKey.class
+
include $(top_srcdir)/config/Make.rules
-CA_FILES = iceca
+$(top_srcdir)/bin/iceca: iceca
+ cp iceca $@
-CLASS_FILES = ImportKey.class
+$(top_srcdir)/lib/ImportKey.class: ImportKey.class
+ cp ImportKey.class $@
install::
@for subdir in $(prefix)/bin $(prefix)/lib; \
diff --git a/cpp/src/ca/Makefile.mak b/cpp/src/ca/Makefile.mak
index a0e46327c58..e5149fd0500 100644
--- a/cpp/src/ca/Makefile.mak
+++ b/cpp/src/ca/Makefile.mak
@@ -9,12 +9,25 @@
top_srcdir = ..\..
-!include $(top_srcdir)/config/Make.rules.mak
+CA_FILES = iceca \
+ iceca.bat
-CA_FILES = iceca \
- iceca.bat
+CLASS_FILES = ImportKey.class
-CLASS_FILES=ImportKey.class
+TARGETS = $(top_srcdir)\bin\iceca \
+ $(top_srcdir)\bin\iceca.bat \
+ $(top_srcdir)\lib\ImportKey.class
+
+!include $(top_srcdir)\config\Make.rules.mak
+
+$(top_srcdir)\bin\iceca: iceca
+ copy iceca $@
+
+$(top_srcdir)\bin\iceca.bat: iceca.bat
+ copy iceca.bat $@
+
+$(top_srcdir)\lib\ImportKey.class: ImportKey.class
+ copy ImportKey.class $@
install::
@for %i in ( $(CA_FILES) ) do \
diff --git a/cpp/src/ca/iceca b/cpp/src/ca/iceca
index 3053bc21ef7..c4d17f27d10 100755
--- a/cpp/src/ca/iceca
+++ b/cpp/src/ca/iceca
@@ -72,7 +72,7 @@ if sys.argv[script] == "import":
sys.exit(1)
try:
- opts, args = getopt.getopt(sys.argv[2:], "", [ "overwrite", "java", "cs"])
+ opts, args = getopt.getopt(sys.argv[script+1:], "", [ "overwrite", "java", "cs"])
except getopt.GetoptError:
usage()
@@ -166,6 +166,7 @@ if sys.argv[script] == "import":
alias + " -passout file:" + keypassfile1 + " -certfile " + os.path.join(home, "ca_cert.pem")
print "converting to pkcs12 format... ",
+ sys.stdout.flush()
if verbose: print cmd
status = os.system(cmd)
if status != 0:
@@ -184,6 +185,7 @@ if sys.argv[script] == "import":
#print cmd
print "importing into the keystore...",
+ sys.stdout.flush()
if verbose: print cmd
status = os.system(cmd)
if status != 0:
@@ -234,6 +236,7 @@ if sys.argv[script] == "import":
cmd = "openssl pkcs12 -in " + cert + " -inkey " + key + " -export -out " + pkcs12cert + " -passout pass:"
print "converting to pkcs12 format...",
+ sys.stdout.flush()
if verbose: print cmd
status = os.system(cmd)
if keypassfile1 != None:
@@ -463,6 +466,7 @@ keyUsage = nonRepudiation, digitalSignature, keyEncipherment\n\
print "Generating configuration files... ",
print "ca.cnf",
+ sys.stdout.flush()
temp, cacnfname = tempfile.mkstemp(".cnf", "ca")
os.write(temp, config["ca.cnf"])
for k,v in DNelements.iteritems():
@@ -472,6 +476,7 @@ keyUsage = nonRepudiation, digitalSignature, keyEncipherment\n\
file = 'sign.cnf'
print " " + file,
+ sys.stdout.flush()
cnf = open(os.path.join(caroot, file), "w")
cnf.write(config[file])
cnf.write("[ ca_policy ]\n");
@@ -486,6 +491,7 @@ keyUsage = nonRepudiation, digitalSignature, keyEncipherment\n\
file = "req.cnf"
print file,
+ sys.stdout.flush()
cnf = open(os.path.join(home, file), "w")
cnf.write(config[file])
for k,v in DNelements.iteritems():
@@ -528,71 +534,42 @@ keyUsage = nonRepudiation, digitalSignature, keyEncipherment\n\
if sys.argv[script] == "request":
def usage():
- print "usage: " + sys.argv[script] + " [--overwrite] [--node|--registry|--server|--user] [--no-password]"
+ print "usage: " + sys.argv[script] + " [--overwrite] [--no-password] file common-name [email]"
sys.exit(1)
- def setType(type):
- keyfile = type + "_key.pem"
- reqfile = type + "_req.pem"
- if not overwrite:
- if os.path.exists(keyfile):
- print keyfile + ": exists"
- sys.exit(1)
- if os.path.exists(reqfile):
- print reqfile + ": exists"
- sys.exit(1)
- return type, keyfile, reqfile
-
try:
- opts, args = getopt.getopt(sys.argv[script+1:], "", \
- [ "overwrite", "node", "registry", "server", "user", "no-password" ])
+ opts, args = getopt.getopt(sys.argv[script+1:], "", [ "overwrite", "no-password" ])
except getopt.GetoptError:
usage()
- if args:
- usage()
-
- type = None
- commonName = None
- email = None
nopassphrase = False
overwrite = False
for o, a in opts:
if o == "--overwrite":
overwrite = True
- if o == "--node":
- if type != None:
- usage()
- type, keyfile, reqfile = setType("node")
- while not commonName or len(commonName) == 0:
- commonName = raw_input("Enter the node name: ")
- commonName = "IceGrid Node " + commonName
- elif o == "--registry":
- if type != None:
- usage()
- type, keyfile, reqfile = setType("registry")
- commonName = "IceGrid Registry"
- elif o == "--server":
- if type != None:
- usage()
- type, keyfile, reqfile = setType("server")
- while not commonName or len(commonName) == 0:
- commonName = raw_input("Enter the server name: ")
- commonName = "Ice Server " + commonName
- elif o == "--user":
- if type != None:
- usage()
- type, keyfile, reqfile = setType("user")
- while not commonName or len(commonName) == 0:
- commonName = raw_input("Enter the user's full name: ")
- while not email or len(email) == 0:
- email = raw_input("Enter the user's email address: ")
elif o == "--no-password":
nopassphrase = True
- if not type:
+ if len(args) < 2 or len(args) > 3:
usage()
+ keyfile = args[0] + "_key.pem"
+ reqfile = args[0] + "_req.pem"
+ if not overwrite:
+ if os.path.exists(keyfile):
+ print keyfile + ": exists"
+ sys.exit(1)
+ if os.path.exists(reqfile):
+ print reqfile + ": exists"
+ sys.exit(1)
+
+ commonName = args[1]
+
+ if len(args) == 3:
+ email = args[2]
+ else:
+ email = None
+
#
# Create a temporary configuration file.
#