mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 20:37:34 +00:00
LibCrypto: Use AK::Stream
for pretty printing DER
This commit is contained in:
parent
f5fb1396e8
commit
a6bcad551d
2 changed files with 5 additions and 5 deletions
|
@ -4,7 +4,7 @@
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <AK/DeprecatedStream.h>
|
#include <AK/Stream.h>
|
||||||
#include <AK/Try.h>
|
#include <AK/Try.h>
|
||||||
#include <AK/Utf8View.h>
|
#include <AK/Utf8View.h>
|
||||||
#include <LibCrypto/ASN1/DER.h>
|
#include <LibCrypto/ASN1/DER.h>
|
||||||
|
@ -224,7 +224,7 @@ ErrorOr<void> Decoder::leave()
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
ErrorOr<void> pretty_print(Decoder& decoder, DeprecatedOutputStream& stream, int indent)
|
ErrorOr<void> pretty_print(Decoder& decoder, AK::Stream& stream, int indent)
|
||||||
{
|
{
|
||||||
while (!decoder.eof()) {
|
while (!decoder.eof()) {
|
||||||
auto tag = TRY(decoder.peek());
|
auto tag = TRY(decoder.peek());
|
||||||
|
@ -238,7 +238,7 @@ ErrorOr<void> pretty_print(Decoder& decoder, DeprecatedOutputStream& stream, int
|
||||||
TRY(decoder.enter());
|
TRY(decoder.enter());
|
||||||
|
|
||||||
builder.append('\n');
|
builder.append('\n');
|
||||||
stream.write(builder.string_view().bytes());
|
TRY(stream.write_entire_buffer(builder.string_view().bytes()));
|
||||||
|
|
||||||
TRY(pretty_print(decoder, stream, indent + 2));
|
TRY(pretty_print(decoder, stream, indent + 2));
|
||||||
|
|
||||||
|
@ -314,7 +314,7 @@ ErrorOr<void> pretty_print(Decoder& decoder, DeprecatedOutputStream& stream, int
|
||||||
}
|
}
|
||||||
|
|
||||||
builder.append('\n');
|
builder.append('\n');
|
||||||
stream.write(builder.string_view().bytes());
|
TRY(stream.write_entire_buffer(builder.string_view().bytes()));
|
||||||
}
|
}
|
||||||
|
|
||||||
return {};
|
return {};
|
||||||
|
|
|
@ -214,6 +214,6 @@ private:
|
||||||
Optional<Tag> m_current_tag;
|
Optional<Tag> m_current_tag;
|
||||||
};
|
};
|
||||||
|
|
||||||
ErrorOr<void> pretty_print(Decoder&, DeprecatedOutputStream&, int indent = 0);
|
ErrorOr<void> pretty_print(Decoder&, AK::Stream&, int indent = 0);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue