forked from I2P_Developers/i2p.i2p
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:
@@ -33,6 +33,16 @@ public class PrivateKey extends DataStructureImpl {
|
||||
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() {
|
||||
return _data;
|
||||
}
|
||||
|
@@ -32,6 +32,16 @@ public class PublicKey extends DataStructureImpl {
|
||||
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() {
|
||||
return _data;
|
||||
}
|
||||
|
@@ -30,9 +30,19 @@ public class SigningPrivateKey extends DataStructureImpl {
|
||||
|
||||
public final static int KEYSIZE_BYTES = 20;
|
||||
|
||||
public SigningPrivateKey() { this(null); }
|
||||
public SigningPrivateKey() { this((byte[])null); }
|
||||
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() {
|
||||
return _data;
|
||||
}
|
||||
|
@@ -29,9 +29,19 @@ public class SigningPublicKey extends DataStructureImpl {
|
||||
|
||||
public final static int KEYSIZE_BYTES = 128;
|
||||
|
||||
public SigningPublicKey() { this(null); }
|
||||
public SigningPublicKey() { this((byte[])null); }
|
||||
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() {
|
||||
return _data;
|
||||
}
|
||||
|
Reference in New Issue
Block a user