Skip to content

Commit

Permalink
fix: no more use qclass qtype
Browse files Browse the repository at this point in the history
  • Loading branch information
joalopez1206 committed Jul 14, 2024
1 parent ac12650 commit 1a42a35
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 14 deletions.
13 changes: 6 additions & 7 deletions src/dnssec.rs
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
pub mod dnssec_encryption;
pub mod dnssec_decryption;
pub mod dnssec;



use std::str::FromStr;
use crate::domain_name::DomainName;
use crate::message::class_qclass::Qclass;
use crate::message::class_rclass::Rclass;
use crate::message::rclass::Rclass;
use crate::message::DnsMessage;
use crate::message::rdata::opt_rdata::OptRdata;
use crate::message::rdata::Rdata;
use crate::message::resource_record::{FromBytes, ResourceRecord, ToBytes};
use crate::message::type_qtype::Qtype;
use crate::message::rcode;
use crate::message::rcode::Rcode;
use crate::message::rrtype::Rrtype;

const EDNS_VERSION: u8 = 0;
const REQUESTED_UDP_LEN: u16 = 4096;
Expand Down Expand Up @@ -76,8 +75,8 @@ fn create_dns_message_with_dnssec(mut msg: DnsMessage) -> DnsMessage {
fn see_dnssec_message() {
let query = DnsMessage::new_query_message(
DomainName::new_from_str("example.com"),
Qtype::A,
Qclass::UNKNOWN(4096),
Rrtype::A,
Rclass::UNKNOWN(4096),
1,
true,
2000
Expand Down
16 changes: 9 additions & 7 deletions src/tsig.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,19 @@ use std::fmt::{self,Display,Debug};
//aquí debe ir todo lo relacionado a la implementación de tsig como módulo
use crypto::mac::MacResult;
use crate::domain_name::DomainName;
use crate::message::class_qclass::{Qclass};
use crate::message::class_rclass::Rclass;

use crate::message::rclass::Rclass;
use crate::message::resource_record::{ResourceRecord, ToBytes};
use crate::message::type_qtype::Qtype;
use crate::message::{rdata::tsig_rdata::TSigRdata, DnsMessage, class_rclass};

use crate::message::{rdata::tsig_rdata::TSigRdata, DnsMessage,};
use crate::message::rdata::{tsig_rdata, Rdata};
use crypto::hmac::Hmac as crypto_hmac;
use crypto::mac::Mac as crypto_mac;
use hmac::{Hmac, Mac};
use crypto::{sha1::Sha1,sha2::Sha256};
use crate::message::rdata::a_rdata::ARdata;
use crate::message::rrtype::Rrtype;

type HmacSha256 = Hmac<Sha256>;


Expand Down Expand Up @@ -83,7 +85,7 @@ pub fn get_digest_request(mac: Vec<u8> ,dns_msg: Vec<u8>, tsig_rr: ResourceRecor
res.extend(tsig_rr.get_name().to_bytes());
//The below shifts are meant to correctly retreive theby
//processing TSIG RR
let rclass_bytes: u16 = class_rclass::Rclass::from_rclass_to_int(tsig_rr.get_rclass());
let rclass_bytes: u16 = Rclass::from_rclass_to_int(tsig_rr.get_rclass());
let rclass_ubyte = (rclass_bytes >> 8) as u8;
let rclass_lbyte = rclass_bytes as u8;
res.push(rclass_ubyte);
Expand Down Expand Up @@ -601,8 +603,8 @@ fn check_signed_tsig() {
//DNS message
let mut q = DnsMessage::new_query_message(
domain.clone(),
Qtype::A,
Qclass::ANY,
Rrtype::A,
Rclass::ANY,
0,
false,
id
Expand Down

0 comments on commit 1a42a35

Please sign in to comment.