本文整理汇总了C#中KeePassLib.Security.ProtectedBinary.ReadXorredData方法的典型用法代码示例。如果您正苦于以下问题:C# ProtectedBinary.ReadXorredData方法的具体用法?C# ProtectedBinary.ReadXorredData怎么用?C# ProtectedBinary.ReadXorredData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KeePassLib.Security.ProtectedBinary
的用法示例。
在下文中一共展示了ProtectedBinary.ReadXorredData方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SubWriteValue
private void SubWriteValue(ProtectedBinary value)
{
if(value.IsProtected && (m_format != KdbxFormat.PlainXml))
{
m_xmlWriter.WriteAttributeString(AttrProtected, ValTrue);
byte[] pbEncoded = value.ReadXorredData(m_randomStream);
if(pbEncoded.Length > 0)
m_xmlWriter.WriteBase64(pbEncoded, 0, pbEncoded.Length);
}
else
{
if(m_pwDatabase.Compression == PwCompressionAlgorithm.GZip)
{
m_xmlWriter.WriteAttributeString(AttrCompressed, ValTrue);
byte[] pbRaw = value.ReadData();
byte[] pbCmp = MemUtil.Compress(pbRaw);
m_xmlWriter.WriteBase64(pbCmp, 0, pbCmp.Length);
}
else
{
byte[] pbRaw = value.ReadData();
m_xmlWriter.WriteBase64(pbRaw, 0, pbRaw.Length);
}
}
}
示例2: WriteObject
private void WriteObject(string name, ProtectedBinary value)
{
Debug.Assert(name != null);
Debug.Assert(value != null); if(value == null) throw new ArgumentNullException("value");
m_xmlWriter.WriteStartElement(ElemBinary);
m_xmlWriter.WriteStartElement(ElemKey);
m_xmlWriter.WriteString(StrUtil.SafeXmlString(name));
m_xmlWriter.WriteEndElement();
m_xmlWriter.WriteStartElement(ElemValue);
if((value.IsProtected) && (m_format != Kdb4Format.PlainXml))
{
m_xmlWriter.WriteAttributeString(AttrProtected, ValTrue);
byte[] pbEncoded = value.ReadXorredData(m_randomStream);
if(pbEncoded.Length > 0)
m_xmlWriter.WriteBase64(pbEncoded, 0, pbEncoded.Length);
}
else
{
byte[] pbRaw = value.ReadData();
m_xmlWriter.WriteBase64(pbRaw, 0, pbRaw.Length);
}
m_xmlWriter.WriteEndElement(); // ElemValue
m_xmlWriter.WriteEndElement(); // ElemBinary
}