diff --git a/core/java/src/net/i2p/data/PrivateKey.java b/core/java/src/net/i2p/data/PrivateKey.java index 146dc76b9..d22a538bf 100644 --- a/core/java/src/net/i2p/data/PrivateKey.java +++ b/core/java/src/net/i2p/data/PrivateKey.java @@ -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; } diff --git a/core/java/src/net/i2p/data/PublicKey.java b/core/java/src/net/i2p/data/PublicKey.java index 86d31177e..8c62ad7f5 100644 --- a/core/java/src/net/i2p/data/PublicKey.java +++ b/core/java/src/net/i2p/data/PublicKey.java @@ -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; } diff --git a/core/java/src/net/i2p/data/SigningPrivateKey.java b/core/java/src/net/i2p/data/SigningPrivateKey.java index 587546db8..9e0a80c58 100644 --- a/core/java/src/net/i2p/data/SigningPrivateKey.java +++ b/core/java/src/net/i2p/data/SigningPrivateKey.java @@ -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; } diff --git a/core/java/src/net/i2p/data/SigningPublicKey.java b/core/java/src/net/i2p/data/SigningPublicKey.java index 9e6c78c1a..72a906868 100644 --- a/core/java/src/net/i2p/data/SigningPublicKey.java +++ b/core/java/src/net/i2p/data/SigningPublicKey.java @@ -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; }