|
@@ -42,15 +42,20 @@ public class DelegationKey implements Writable {
|
|
|
@Nullable
|
|
|
private byte[] keyBytes = null;
|
|
|
|
|
|
+ /** Default constructore required for Writable */
|
|
|
public DelegationKey() {
|
|
|
- this(0, 0L, null);
|
|
|
+ this(0, 0L, (SecretKey)null);
|
|
|
}
|
|
|
|
|
|
public DelegationKey(int keyId, long expiryDate, SecretKey key) {
|
|
|
+ this(keyId, expiryDate, key != null ? key.getEncoded() : null);
|
|
|
+ }
|
|
|
+
|
|
|
+ public DelegationKey(int keyId, long expiryDate, byte[] encodedKey) {
|
|
|
this.keyId = keyId;
|
|
|
this.expiryDate = expiryDate;
|
|
|
- if (key!=null) {
|
|
|
- this.keyBytes = key.getEncoded();
|
|
|
+ if (encodedKey != null) {
|
|
|
+ this.keyBytes = encodedKey;
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -70,6 +75,10 @@ public class DelegationKey implements Writable {
|
|
|
return key;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ public byte[] getEncodedKey() {
|
|
|
+ return keyBytes;
|
|
|
+ }
|
|
|
|
|
|
public void setExpiryDate(long expiryDate) {
|
|
|
this.expiryDate = expiryDate;
|