Bug 243906. Base64 encode binary values when persisting them.
This commit is contained in:
parent
8f70c27fb2
commit
0778dad12d
15
CASA/micasad/cache/Secret.cs
vendored
15
CASA/micasad/cache/Secret.cs
vendored
@ -219,9 +219,14 @@ namespace sscs.cache
|
||||
{
|
||||
this.ModifiedTime = DateTime.Now;
|
||||
}
|
||||
}
|
||||
|
||||
public void SetKeyValue(string key, byte[] baValue)
|
||||
{
|
||||
SetKeyValue(key, baValue, true);
|
||||
}
|
||||
|
||||
public void SetKeyValue(string key, byte[] baValue)
|
||||
public void SetKeyValue(string key, byte[] baValue, bool bUpdateModifiedTime)
|
||||
{
|
||||
KeyValue kv;
|
||||
if (htKeyValues.Contains(key))
|
||||
@ -233,8 +238,12 @@ namespace sscs.cache
|
||||
{
|
||||
kv = new KeyValue(key, baValue);
|
||||
htKeyValues.Add(key, kv);
|
||||
}
|
||||
this.ModifiedTime = DateTime.Now;
|
||||
}
|
||||
|
||||
if (bUpdateModifiedTime)
|
||||
{
|
||||
this.ModifiedTime = DateTime.Now;
|
||||
}
|
||||
}
|
||||
|
||||
public KeyValue GetKeyValue(string key)
|
||||
|
@ -502,15 +502,21 @@ namespace sscs.lss
|
||||
|
||||
xpath = "descendant::" + XmlConsts.keyValueNode;
|
||||
XmlNode keyValNode = keyNode.SelectSingleNode(xpath);
|
||||
string keyValue = keyValNode.InnerText;
|
||||
secret.SetKeyValue(key, keyValue, false);
|
||||
string keyValue = keyValNode.InnerText;
|
||||
|
||||
// set binary type if set
|
||||
if ((sIsBinary != null) && (sIsBinary.Equals("true")))
|
||||
{
|
||||
{
|
||||
byte[] baDec = Convert.FromBase64String(keyValue);
|
||||
secret.SetKeyValue(key, baDec, false);
|
||||
|
||||
KeyValue kv = secret.GetKeyValue(key);
|
||||
kv.SetValueType(KeyValue.VALUE_TYPE_BINARY);
|
||||
}
|
||||
else
|
||||
{
|
||||
secret.SetKeyValue(key, keyValue, false);
|
||||
}
|
||||
|
||||
// get time attributes on this key/value
|
||||
XmlNode timeNodeKey = keyNode.SelectSingleNode("descendant::" + XmlConsts.timeNode);
|
||||
@ -799,7 +805,16 @@ namespace sscs.lss
|
||||
writer.WriteStartElement(XmlConsts.keyValueNode);
|
||||
|
||||
if (bSaveValues)
|
||||
writer.WriteString(value);
|
||||
{
|
||||
if (kv.GetValueType() == KeyValue.VALUE_TYPE_BINARY)
|
||||
{
|
||||
writer.WriteString(Convert.ToBase64String(kv.GetValueAsBytes()));
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.WriteString(value);
|
||||
}
|
||||
}
|
||||
else
|
||||
writer.WriteString("");
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user