mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-09 09:34:57 +09:00
LibCrypto: Move ASN1 constants to Crypto::ASN1
Makes more sense to have them in `Crypto::ASN1` rather than in `Crypto::Certificate`.
This commit is contained in:
parent
ab2960e49f
commit
51f69be51f
Notes:
github-actions[bot]
2024-11-30 10:19:16 +00:00
Author: https://github.com/devgianlu
Commit: 51f69be51f
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2648
7 changed files with 271 additions and 255 deletions
|
@ -13,6 +13,7 @@
|
|||
#include <LibCore/StandardPaths.h>
|
||||
#include <LibCore/Timer.h>
|
||||
#include <LibCrypto/ASN1/ASN1.h>
|
||||
#include <LibCrypto/ASN1/Constants.h>
|
||||
#include <LibCrypto/ASN1/PEM.h>
|
||||
#include <LibCrypto/Certificate/Certificate.h>
|
||||
#include <LibCrypto/Curves/Ed25519.h>
|
||||
|
@ -316,25 +317,25 @@ bool Context::verify_certificate_pair(Certificate const& subject, Certificate co
|
|||
|
||||
bool is_rsa = true;
|
||||
|
||||
if (identifier == Crypto::Certificate::rsa_encryption_oid) {
|
||||
if (identifier == Crypto::ASN1::rsa_encryption_oid) {
|
||||
kind = Crypto::Hash::HashKind::None;
|
||||
} else if (identifier == Crypto::Certificate::rsa_md5_encryption_oid) {
|
||||
} else if (identifier == Crypto::ASN1::rsa_md5_encryption_oid) {
|
||||
kind = Crypto::Hash::HashKind::MD5;
|
||||
} else if (identifier == Crypto::Certificate::rsa_sha1_encryption_oid) {
|
||||
} else if (identifier == Crypto::ASN1::rsa_sha1_encryption_oid) {
|
||||
kind = Crypto::Hash::HashKind::SHA1;
|
||||
} else if (identifier == Crypto::Certificate::rsa_sha256_encryption_oid) {
|
||||
} else if (identifier == Crypto::ASN1::rsa_sha256_encryption_oid) {
|
||||
kind = Crypto::Hash::HashKind::SHA256;
|
||||
} else if (identifier == Crypto::Certificate::rsa_sha384_encryption_oid) {
|
||||
} else if (identifier == Crypto::ASN1::rsa_sha384_encryption_oid) {
|
||||
kind = Crypto::Hash::HashKind::SHA384;
|
||||
} else if (identifier == Crypto::Certificate::rsa_sha512_encryption_oid) {
|
||||
} else if (identifier == Crypto::ASN1::rsa_sha512_encryption_oid) {
|
||||
kind = Crypto::Hash::HashKind::SHA512;
|
||||
} else if (identifier == Crypto::Certificate::ecdsa_with_sha256_encryption_oid) {
|
||||
} else if (identifier == Crypto::ASN1::ecdsa_with_sha256_encryption_oid) {
|
||||
kind = Crypto::Hash::HashKind::SHA256;
|
||||
is_rsa = false;
|
||||
} else if (identifier == Crypto::Certificate::ecdsa_with_sha384_encryption_oid) {
|
||||
} else if (identifier == Crypto::ASN1::ecdsa_with_sha384_encryption_oid) {
|
||||
kind = Crypto::Hash::HashKind::SHA384;
|
||||
is_rsa = false;
|
||||
} else if (identifier == Crypto::Certificate::ecdsa_with_sha512_encryption_oid) {
|
||||
} else if (identifier == Crypto::ASN1::ecdsa_with_sha512_encryption_oid) {
|
||||
kind = Crypto::Hash::HashKind::SHA512;
|
||||
is_rsa = false;
|
||||
}
|
||||
|
@ -597,9 +598,9 @@ ErrorOr<Vector<Certificate>> DefaultRootCACertificates::parse_pem_root_certifica
|
|||
|
||||
ErrorOr<SupportedGroup> oid_to_curve(Vector<int> curve)
|
||||
{
|
||||
if (curve == Crypto::Certificate::secp384r1_oid)
|
||||
if (curve == Crypto::ASN1::secp384r1_oid)
|
||||
return SupportedGroup::SECP384R1;
|
||||
if (curve == Crypto::Certificate::secp256r1_oid)
|
||||
if (curve == Crypto::ASN1::secp256r1_oid)
|
||||
return SupportedGroup::SECP256R1;
|
||||
|
||||
return AK::Error::from_string_literal("Unknown curve oid");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue