summaryrefslogtreecommitdiffstats
path: root/pki/base/common/src/com/netscape/certsrv/base/KeyGenInfo.java
diff options
context:
space:
mode:
Diffstat (limited to 'pki/base/common/src/com/netscape/certsrv/base/KeyGenInfo.java')
-rw-r--r--pki/base/common/src/com/netscape/certsrv/base/KeyGenInfo.java87
1 files changed, 44 insertions, 43 deletions
diff --git a/pki/base/common/src/com/netscape/certsrv/base/KeyGenInfo.java b/pki/base/common/src/com/netscape/certsrv/base/KeyGenInfo.java
index 17efca77..5fc41717 100644
--- a/pki/base/common/src/com/netscape/certsrv/base/KeyGenInfo.java
+++ b/pki/base/common/src/com/netscape/certsrv/base/KeyGenInfo.java
@@ -17,7 +17,6 @@
// --- END COPYRIGHT BLOCK ---
package com.netscape.certsrv.base;
-
import java.io.IOException;
import netscape.security.util.DerInputStream;
@@ -25,35 +24,36 @@ import netscape.security.util.DerValue;
import netscape.security.x509.AlgorithmId;
import netscape.security.x509.X509Key;
-
/**
- *
- * The <code>KeyGenInfo</code> represents the information generated by
- * the KeyGen tag of the HTML forms. It provides the parsing and accessing
- * mechanisms.<p>
- *
+ *
+ * The <code>KeyGenInfo</code> represents the information generated by the
+ * KeyGen tag of the HTML forms. It provides the parsing and accessing
+ * mechanisms.
+ * <p>
+ *
* <pre>
* SignedPublicKeyAndChallenge ::= SEQUENCE {
* publicKeyAndChallenge PublicKeyAndChallenge,
* signatureAlgorithm AlgorithmIdentifier,
* signature BIT STRING
* }
- *
+ *
* PublicKeyAndChallenge ::= SEQUENCE {
* spki SubjectPublicKeyInfo,
* challenge IA5STRING
* }
- *</pre>
- *
- *
+ * </pre>
+ *
+ *
* @version $Revision$, $Date$
*/
public class KeyGenInfo {
- /*==========================================================
- * variables
- *==========================================================*/
+ /*
+ * ========================================================== variables
+ * ==========================================================
+ */
private String mSPKACString;
private byte mPKAC[];
private byte mSPKAC[];
@@ -64,36 +64,37 @@ public class KeyGenInfo {
private byte mSignature[];
private AlgorithmId mAlgId;
- /*==========================================================
- * constructors
- *==========================================================*/
+ /*
+ * ========================================================== constructors
+ * ==========================================================
+ */
/**
- * Construct empty KeyGenInfo. Need to call decode function
- * later to initialize.
+ * Construct empty KeyGenInfo. Need to call decode function later to
+ * initialize.
*/
public KeyGenInfo() {
}
/**
- * Construct KeyGenInfo using the SignedPublicKeyAndChallenge
- * string representation.
- *
+ * Construct KeyGenInfo using the SignedPublicKeyAndChallenge string
+ * representation.
+ *
* @param spkac SignedPublicKeyAndChallenge string representation
*/
- public KeyGenInfo(String spkac)
- throws IOException {
+ public KeyGenInfo(String spkac) throws IOException {
decode(spkac);
}
- /*==========================================================
- * public methods
- *==========================================================*/
+ /*
+ * ========================================================== public methods
+ * ==========================================================
+ */
/**
* Initialize using the SPKAC string
- *
+ *
* @param spkac SPKAC string from the end user
*/
public void decode(String spkac) throws IOException {
@@ -104,7 +105,7 @@ public class KeyGenInfo {
/**
* Der encoded into buffer
- *
+ *
* @return Der encoded buffer
*/
public byte[] encode() {
@@ -113,7 +114,7 @@ public class KeyGenInfo {
/**
* Get SPKI in DerValue form
- *
+ *
* @return SPKI in DerValue form
*/
public DerValue getDerSPKI() {
@@ -122,7 +123,7 @@ public class KeyGenInfo {
/**
* Get SPKI as X509Key
- *
+ *
* @return SPKI in X509Key form
*/
public X509Key getSPKI() {
@@ -131,7 +132,7 @@ public class KeyGenInfo {
/**
* Get Challenge phrase in DerValue form
- *
+ *
* @return Challenge in DerValue form. null if none.
*/
public DerValue getDerChallenge() {
@@ -140,7 +141,7 @@ public class KeyGenInfo {
/**
* Get Challenge phrase in string format
- *
+ *
* @return challenge phrase. null if none.
*/
public String getChallenge() {
@@ -149,6 +150,7 @@ public class KeyGenInfo {
/**
* Get Signature
+ *
* @return signature
*/
public byte[] getSignature() {
@@ -157,6 +159,7 @@ public class KeyGenInfo {
/**
* Get Algorithm ID
+ *
* @return the algorithm id
*/
public AlgorithmId getAlgorithmId() {
@@ -165,7 +168,7 @@ public class KeyGenInfo {
/**
* Validate Signature and Challenge Phrase
- *
+ *
* @param challenge phrase; null if none
* @return true if validated; otherwise, false
*/
@@ -180,7 +183,7 @@ public class KeyGenInfo {
/**
* String representation of KenGenInfo
- *
+ *
* @return string representation of KeGenInfo
*/
public String toString() {
@@ -189,18 +192,17 @@ public class KeyGenInfo {
return "";
}
- /*==========================================================
- * private methods
- *==========================================================*/
+ /*
+ * ========================================================== private
+ * methods==========================================================
+ */
- private byte[] base64Decode(String spkac)
- throws IOException {
+ private byte[] base64Decode(String spkac) throws IOException {
return com.netscape.osutil.OSUtil.AtoB(spkac);
}
- private void derDecode(byte spkac[])
- throws IOException {
+ private void derDecode(byte spkac[]) throws IOException {
DerInputStream derIn = new DerInputStream(spkac);
/* get SPKAC Algorithm & Signature */
@@ -224,4 +226,3 @@ public class KeyGenInfo {
}
}
-