1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 08:58:11 +00:00

LibCrypto: Change the signature of RSA::parse_rsa_key to use Span.

This commit is contained in:
asynts 2020-07-27 15:14:44 +02:00 committed by Andreas Kling
parent 21de20825a
commit 0d782e1dfb
2 changed files with 5 additions and 4 deletions

View file

@ -33,7 +33,7 @@
namespace Crypto {
namespace PK {
RSA::KeyPairType RSA::parse_rsa_key(const ByteBuffer& in)
RSA::KeyPairType RSA::parse_rsa_key(ReadonlyBytes in)
{
// we are going to assign to at least one of these
KeyPairType keypair;
@ -167,7 +167,7 @@ void RSA::import_private_key(const ByteBuffer& buffer, bool pem)
{
// so gods help me, I hate DER
auto decoded_buffer = pem ? decode_pem(buffer) : buffer;
auto key = parse_rsa_key(decoded_buffer);
auto key = parse_rsa_key(decoded_buffer.span());
if (!key.private_key.length()) {
dbg() << "We expected to see a private key, but we found none";
ASSERT_NOT_REACHED();
@ -179,7 +179,7 @@ void RSA::import_public_key(const ByteBuffer& buffer, bool pem)
{
// so gods help me, I hate DER
auto decoded_buffer = pem ? decode_pem(buffer) : buffer;
auto key = parse_rsa_key(decoded_buffer);
auto key = parse_rsa_key(decoded_buffer.span());
if (!key.public_key.length()) {
dbg() << "We expected to see a public key, but we found none";
ASSERT_NOT_REACHED();