Added constructors to PrivateKey, PublicKey, SigningPrivateKey and

SigningPublicKey, which take a single String argument and construct
the object from the Base64 data in that string (where this data is
the product of a .toBase64() call on a prior instance).
This commit is contained in:
aum
2005-04-04 06:13:50 +00:00
committed by zzz
parent 9b8f91c7f9
commit 578301240e
4 changed files with 42 additions and 2 deletions

View File

@@ -33,6 +33,16 @@ public class PrivateKey extends DataStructureImpl {
setData(null); setData(null);
} }
/** constructs from base64
* @param a string of base64 data (the output of .toBase64() called
* on a prior instance of PrivateKey
* @author aum
*/
public PrivateKey(String base64Data) throws DataFormatException {
this();
fromBase64(base64Data);
}
public byte[] getData() { public byte[] getData() {
return _data; return _data;
} }

View File

@@ -32,6 +32,16 @@ public class PublicKey extends DataStructureImpl {
setData(null); setData(null);
} }
/** constructs from base64
* @param a string of base64 data (the output of .toBase64() called
* on a prior instance of PublicKey
* @author aum
*/
public PublicKey(String base64Data) throws DataFormatException {
this();
fromBase64(base64Data);
}
public byte[] getData() { public byte[] getData() {
return _data; return _data;
} }

View File

@@ -30,9 +30,19 @@ public class SigningPrivateKey extends DataStructureImpl {
public final static int KEYSIZE_BYTES = 20; public final static int KEYSIZE_BYTES = 20;
public SigningPrivateKey() { this(null); } public SigningPrivateKey() { this((byte[])null); }
public SigningPrivateKey(byte data[]) { setData(data); } public SigningPrivateKey(byte data[]) { setData(data); }
/** constructs from base64
* @param a string of base64 data (the output of .toBase64() called
* on a prior instance of SigningPrivateKey
* @author aum
*/
public SigningPrivateKey(String base64Data) throws DataFormatException {
this();
fromBase64(base64Data);
}
public byte[] getData() { public byte[] getData() {
return _data; return _data;
} }

View File

@@ -29,9 +29,19 @@ public class SigningPublicKey extends DataStructureImpl {
public final static int KEYSIZE_BYTES = 128; public final static int KEYSIZE_BYTES = 128;
public SigningPublicKey() { this(null); } public SigningPublicKey() { this((byte[])null); }
public SigningPublicKey(byte data[]) { setData(data); } public SigningPublicKey(byte data[]) { setData(data); }
/** constructs from base64
* @param a string of base64 data (the output of .toBase64() called
* on a prior instance of SigningPublicKey
* @author aum
*/
public SigningPublicKey(String base64Data) throws DataFormatException {
this();
fromBase64(base64Data);
}
public byte[] getData() { public byte[] getData() {
return _data; return _data;
} }