Added a more helpful error message for key import failure.
authorwassa <wassa@ab3bd59b-922f-494d-bb5f-6f0a3c29deca>
Thu, 26 Sep 2002 21:01:33 +0000 (21:01 +0000)
committerwassa <wassa@ab3bd59b-922f-494d-bb5f-6f0a3c29deca>
Thu, 26 Sep 2002 21:01:33 +0000 (21:01 +0000)
Fixed wrapper on base64 encoding.  (Tool outputs pkcs8 for rsa and dsa keys).

git-svn-id: https://subversion.switch.ch/svn/shibboleth/java-idp/trunk@309 ab3bd59b-922f-494d-bb5f-6f0a3c29deca

src/edu/internet2/middleware/shibboleth/utils/ExtKeyTool.java

index daadea9..020ac16 100755 (executable)
@@ -206,10 +206,10 @@ public class ExtKeyTool {
 
                        if (rfc) {
                                log.debug("Dumping with rfc encoding");
-                               outStream.println("-----BEGIN " + key.getAlgorithm() + " PRIVATE KEY-----");
+                               outStream.println("-----BEGIN PRIVATE KEY-----");
                                BASE64Encoder encoder = new BASE64Encoder();
                                encoder.encodeBuffer(key.getEncoded(), outStream);
-                               outStream.println("-----END " + key.getAlgorithm() + " PRIVATE KEY-----");
+                               outStream.println("-----END PRIVATE KEY-----");
                        } else {
                                log.debug("Dumping with default encoding.");
                                outStream.write(key.getEncoded());
@@ -288,7 +288,7 @@ public class ExtKeyTool {
 
                } catch (Exception e) {
                        log.error("Problem reading private key: " + e.getMessage());
-                       throw new ExtKeyToolException("Problem reading private key: " + e.getMessage());
+                       throw new ExtKeyToolException("Problem reading private key.  Keys should be DER encoded pkcs8 or DER encoded native format.");
                }
        }