Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
P
Pcap-Net
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Pcap-Net
Commits
9a460573
Commit
9a460573
authored
Nov 05, 2011
by
Brickner_cp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
DNS
parent
31d31dec
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
106 additions
and
1 deletion
+106
-1
RandomDnsExtensions.cs
...t/src/PcapDotNet.Packets.TestUtils/RandomDnsExtensions.cs
+4
-0
DnsResourceData.cs
PcapDotNet/src/PcapDotNet.Packets/Dns/DnsResourceData.cs
+100
-1
DnsType.cs
PcapDotNet/src/PcapDotNet.Packets/Dns/DnsType.cs
+2
-0
No files found.
PcapDotNet/src/PcapDotNet.Packets.TestUtils/RandomDnsExtensions.cs
View file @
9a460573
...
...
@@ -257,6 +257,10 @@ namespace PcapDotNet.Packets.TestUtils
return
new
DnsResourceDataDelegationSigner
(
random
.
NextUShort
(),
random
.
NextEnum
<
DnsAlgorithm
>(),
random
.
NextEnum
<
DnsDigestType
>(),
random
.
NextDataSegment
(
random
.
Next
(
50
)));
case
DnsType
.
SshFp
:
return
new
DnsResourceDataSshFingerprint
(
random
.
NextEnum
<
DnsAlgorithm
>(),
random
.
NextEnum
<
DnsFingerprintType
>(),
random
.
NextDataSegment
(
random
.
Next
(
20
)));
default
:
return
new
DnsResourceDataAnything
(
random
.
NextDataSegment
(
random
.
Next
(
100
)));
}
...
...
PcapDotNet/src/PcapDotNet.Packets/Dns/DnsResourceData.cs
View file @
9a460573
...
...
@@ -1272,7 +1272,7 @@ namespace PcapDotNet.Packets.Dns
/// <summary>
/// RFCs 2536, 3755.
/// DSA.
/// DSA
- Digital Signature Algorithm
.
/// Implementation is mandatory.
/// </summary>
Dsa
=
3
,
...
...
@@ -4583,4 +4583,103 @@ namespace PcapDotNet.Packets.Dns
return
new
DnsResourceDataDelegationSigner
(
keyTag
,
algorithm
,
digestType
,
digest
);
}
}
/// <summary>
/// RFC 4255.
/// </summary>
public
enum
DnsFingerprintType
:
byte
{
/// <summary>
/// RFC 4255.
/// </summary>
Sha1
=
1
,
}
/// <summary>
/// RFC 4255.
/// <pre>
/// +-----+-----------+-----------+
/// | bit | 0-7 | 8-15 |
/// +-----+-----------+-----------+
/// | 0 | algorithm | fp type |
/// +-----+-----------+-----------+
/// | 16 | fingerprint |
/// | ... | |
/// +-----+-----------------------+
/// </pre>
/// </summary>
[
DnsTypeRegistration
(
Type
=
DnsType
.
SshFp
)]
public
sealed
class
DnsResourceDataSshFingerprint
:
DnsResourceDataSimple
,
IEquatable
<
DnsResourceDataSshFingerprint
>
{
public
static
class
Offset
{
public
const
int
Algorithm
=
0
;
public
const
int
FingerprintType
=
Algorithm
+
sizeof
(
byte
);
public
const
int
Fingerprint
=
FingerprintType
+
sizeof
(
byte
);
}
public
const
int
ConstPartLength
=
Offset
.
Fingerprint
;
public
DnsResourceDataSshFingerprint
(
DnsAlgorithm
algorithm
,
DnsFingerprintType
fingerprintType
,
DataSegment
fingerprint
)
{
Algorithm
=
algorithm
;
FingerprintType
=
fingerprintType
;
Fingerprint
=
fingerprint
;
}
/// <summary>
/// Describes the algorithm of the public key.
/// </summary>
public
DnsAlgorithm
Algorithm
{
get
;
private
set
;
}
/// <summary>
/// Describes the message-digest algorithm used to calculate the fingerprint of the public key.
/// </summary>
public
DnsFingerprintType
FingerprintType
{
get
;
private
set
;
}
/// <summary>
/// The fingerprint is calculated over the public key blob.
/// The message-digest algorithm is presumed to produce an opaque octet string output, which is placed as-is in the RDATA fingerprint field.
/// </summary>
public
DataSegment
Fingerprint
{
get
;
private
set
;
}
public
bool
Equals
(
DnsResourceDataSshFingerprint
other
)
{
return
other
!=
null
&&
Algorithm
.
Equals
(
other
.
Algorithm
)
&&
FingerprintType
.
Equals
(
other
.
FingerprintType
)
&&
Fingerprint
.
Equals
(
other
.
Fingerprint
);
}
public
override
bool
Equals
(
DnsResourceData
other
)
{
return
Equals
(
other
as
DnsResourceDataSshFingerprint
);
}
internal
DnsResourceDataSshFingerprint
()
:
this
(
DnsAlgorithm
.
None
,
DnsFingerprintType
.
Sha1
,
DataSegment
.
Empty
)
{
}
internal
override
int
GetLength
()
{
return
ConstPartLength
+
Fingerprint
.
Length
;
}
internal
override
void
WriteDataSimple
(
byte
[]
buffer
,
int
offset
)
{
buffer
.
Write
(
offset
+
Offset
.
Algorithm
,
(
byte
)
Algorithm
);
buffer
.
Write
(
offset
+
Offset
.
FingerprintType
,
(
byte
)
FingerprintType
);
Fingerprint
.
Write
(
buffer
,
offset
+
Offset
.
Fingerprint
);
}
internal
override
DnsResourceData
CreateInstance
(
DataSegment
data
)
{
DnsAlgorithm
algorithm
=
(
DnsAlgorithm
)
data
[
Offset
.
Algorithm
];
DnsFingerprintType
fingerprintType
=
(
DnsFingerprintType
)
data
[
Offset
.
FingerprintType
];
DataSegment
fingerprint
=
data
.
SubSegment
(
Offset
.
Fingerprint
,
data
.
Length
-
ConstPartLength
);
return
new
DnsResourceDataSshFingerprint
(
algorithm
,
fingerprintType
,
fingerprint
);
}
}
}
PcapDotNet/src/PcapDotNet.Packets/Dns/DnsType.cs
View file @
9a460573
...
...
@@ -313,6 +313,8 @@
/// <summary>
/// RFC 4255.
/// SSH Key Fingerprint.
/// Used to store a fingerprint of an SSH public host key that is associated with a Domain Name System (DNS) name.
/// Payload type: DnsResourceDataSshFingerprint.
/// </summary>
SshFp
=
44
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment