Commit 1d2fe8dd authored by Brickner_cp's avatar Brickner_cp

Security Option upgraded to RFC 1108.

parent 90639a7b
...@@ -50,32 +50,16 @@ namespace PcapDotNet.Core.Test ...@@ -50,32 +50,16 @@ namespace PcapDotNet.Core.Test
case IpV4OptionType.Security: case IpV4OptionType.Security:
IpV4OptionSecurity securityOption = (IpV4OptionSecurity)option; IpV4OptionSecurity securityOption = (IpV4OptionSecurity)option;
switch (securityOption.Level) switch (securityOption.ClassificationLevel)
{ {
case IpV4OptionSecurityLevel.EncryptedForTransmissionOnly:
yield return "Security: EFTO";
break;
case IpV4OptionSecurityLevel.Mmmm:
yield return "Security: " + securityOption.Level.ToString().ToUpper();
break;
case IpV4OptionSecurityLevel.TopSecret:
yield return "Security: Top secret";
break;
case IpV4OptionSecurityLevel.Prog:
yield return "Security: Unknown (0x" + ((ushort)securityOption.Level).ToString("x4") + ")";
break;
default: default:
yield return "Security: " + securityOption.Level; yield return "Security: " + securityOption.ClassificationLevel;
break; break;
} }
yield return "Compartments: " + securityOption.Compartments; // yield return "Compartments: " + securityOption.Compartments;
yield return "Handling restrictions: "; // yield return "Handling restrictions: ";
yield return "Transmission control code: "; // yield return "Transmission control code: ";
break; break;
case IpV4OptionType.LooseSourceRouting: case IpV4OptionType.LooseSourceRouting:
......
...@@ -308,18 +308,10 @@ namespace PcapDotNet.Core.Test ...@@ -308,18 +308,10 @@ namespace PcapDotNet.Core.Test
break; break;
} }
IpV4Option option = options[currentOptionIndex++]; IpV4Option option = options[currentOptionIndex++];
if (option.OptionType == IpV4OptionType.Security)
continue; // Wireshark doesn't support
field.AssertShow(option.GetWiresharkString()); field.AssertShow(option.GetWiresharkString());
var optionShows = field.Fields().Select( var optionShows = from f in field.Fields() select f.Show();
delegate(XElement optionField)
{
string optionFieldShow = optionField.Show();
if (optionFieldShow.StartsWith("Handling restrictions: "))
optionFieldShow = "Handling restrictions: ";
else if (optionFieldShow.StartsWith("Transmission control code: "))
optionFieldShow = "Transmission control code: ";
return optionFieldShow;
});
Assert.IsTrue(optionShows.SequenceEqual(option.GetWiresharkSubfieldStrings())); Assert.IsTrue(optionShows.SequenceEqual(option.GetWiresharkSubfieldStrings()));
} }
......
...@@ -169,18 +169,6 @@ namespace PcapDotNet.Packets.Test ...@@ -169,18 +169,6 @@ namespace PcapDotNet.Packets.Test
} }
} }
[TestMethod]
public void IpV4OptionsTest()
{
IpV4Options actual = new IpV4Options(new IpV4OptionSecurity(IpV4OptionSecurityLevel.Unclassified, 12345, 54321, (UInt24)123456));
IpV4Options expected = new IpV4Options(new IpV4OptionSecurity(IpV4OptionSecurityLevel.Unclassified, 12345, 54321, (UInt24)123456),
IpV4Option.End);
Assert.AreEqual(expected, actual);
Assert.IsTrue(expected.IsValid);
Assert.IsTrue(actual.IsValid);
}
[TestMethod] [TestMethod]
[ExpectedException(typeof(ArgumentOutOfRangeException))] [ExpectedException(typeof(ArgumentOutOfRangeException))]
public void IpV4OptionTimestampOverflowErrorTest() public void IpV4OptionTimestampOverflowErrorTest()
......
...@@ -92,7 +92,7 @@ namespace PcapDotNet.Packets.TestUtils ...@@ -92,7 +92,7 @@ namespace PcapDotNet.Packets.TestUtils
throw new ArgumentOutOfRangeException("maximumOptionLength", maximumOptionLength, "option length must be positive"); throw new ArgumentOutOfRangeException("maximumOptionLength", maximumOptionLength, "option length must be positive");
List<IpV4OptionType> impossibleOptionTypes = new List<IpV4OptionType>(); List<IpV4OptionType> impossibleOptionTypes = new List<IpV4OptionType>();
if (maximumOptionLength < IpV4OptionSecurity.OptionLength) if (maximumOptionLength < IpV4OptionSecurity.OptionMinimumLength)
impossibleOptionTypes.Add(IpV4OptionType.Security); impossibleOptionTypes.Add(IpV4OptionType.Security);
if (maximumOptionLength < IpV4OptionRoute.OptionMinimumLength) if (maximumOptionLength < IpV4OptionRoute.OptionMinimumLength)
{ {
...@@ -114,8 +114,13 @@ namespace PcapDotNet.Packets.TestUtils ...@@ -114,8 +114,13 @@ namespace PcapDotNet.Packets.TestUtils
return IpV4Option.Nop; return IpV4Option.Nop;
case IpV4OptionType.Security: case IpV4OptionType.Security:
return new IpV4OptionSecurity(random.NextEnum<IpV4OptionSecurityLevel>(), random.NextUShort(), random.NextUShort(), IpV4OptionSecurityProtectionAuthority protectionAuthority = IpV4OptionSecurityProtectionAuthority.None;
random.NextUInt24()); int protectionAuthorityLength = random.Next(maximumOptionLength - IpV4OptionSecurity.OptionMinimumLength);
if (protectionAuthorityLength > 0)
protectionAuthority = random.NextEnum<IpV4OptionSecurityProtectionAuthority>();
return new IpV4OptionSecurity(random.NextEnum<IpV4OptionSecurityClassificationLevel>(), protectionAuthority,
(byte)(IpV4OptionSecurity.OptionMinimumLength + protectionAuthorityLength));
case IpV4OptionType.LooseSourceRouting: case IpV4OptionType.LooseSourceRouting:
case IpV4OptionType.StrictSourceRouting: case IpV4OptionType.StrictSourceRouting:
......
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
<Word>endianity</Word> <Word>endianity</Word>
<Word>prespecified</Word> <Word>prespecified</Word>
<Word>ttl</Word> <Word>ttl</Word>
<Word>mmmm</Word> <!-- Still couldn't find out what this mean -->
<Word>satnet</Word> <Word>satnet</Word>
<Word>bbn</Word> <!-- Probably BBN Technologies (originally Bolt, Beranek and Newman) --> <Word>bbn</Word> <!-- Probably BBN Technologies (originally Bolt, Beranek and Newman) -->
<Word>aris</Word> <Word>aris</Word>
......
namespace PcapDotNet.Packets.IpV4 namespace PcapDotNet.Packets.IpV4
{ {
/// <summary> /// <summary>
/// Security (S field): 16 bits /// This field specifies the (U.S.) classification level at which the datagram must be protected.
/// </summary> /// The information in the datagram must be protected at this level.
public enum IpV4OptionSecurityLevel : ushort /// The bit string values in this table were chosen to achieve a minimum Hamming distance of four (4) between any two valid values.
/// This specific assignment of classification level names to values has been defined for compatibility
/// with security devices which have already been developed and deployed.
/// </summary>
public enum IpV4OptionSecurityClassificationLevel : byte
{ {
/// <summary> /// <summary>
/// Unclassified /// Top Secret
/// </summary>
Unclassified = 0x0000,
/// <summary>
/// Confidential
/// </summary>
Confidential = 0xF135,
/// <summary>
/// Encrypted For Transmission Only (EFTO)
/// </summary>
EncryptedForTransmissionOnly = 0x789A,
/// <summary>
/// MMMM
/// </summary>
Mmmm = 0xBC4D,
/// <summary>
/// PROG
/// </summary> /// </summary>
Prog = 0x5E26, TopSecret = 0x3D,
/// <summary> /// <summary>
/// Restricted /// Secret
/// </summary> /// </summary>
Restricted = 0xAF13, Secret = 0x5A,
/// <summary> /// <summary>
/// Secret /// Confidential
/// </summary> /// </summary>
Secret = 0xD788, Confidential = 0x96,
/// <summary> /// <summary>
/// Top Secret /// Unclassified
/// </summary> /// </summary>
TopSecret = 0x6BC5 Unclassified = 0xAB
} }
} }
\ No newline at end of file
using System;
namespace PcapDotNet.Packets.IpV4
{
/// <summary>
/// This field identifies the National Access Programs or Special Access Programs
/// which specify protection rules for transmission and processing of the information contained in the datagram.
/// Protection authority flags do NOT represent accreditation authorities, though the semantics are superficially similar.
/// </summary>
[Flags]
public enum IpV4OptionSecurityProtectionAuthority : byte
{
/// <summary>
/// No protection authorities.
/// </summary>
None = 0x00,
/// <summary>
/// Designated Approving Authority per DOD 5200.28
/// </summary>
Genser = 0x80,
/// <summary>
/// Single Integrated Operational Plan - Extremely Sensitive Information (SIOP-ESI).
/// Department of Defense Organization of the Joint Chiefs of Staff
/// Attn: J6 Washington, DC 20318-6000
/// </summary>
SingleIntegrationOptionalPlanExtremelySensitiveInformation = 0x40,
/// <summary>
/// Sensitive Compartmented Information (SCI).
/// Director of Central Intelligence
/// Attn: Chairman, Information Handling Committee, Intelligence Community Staff Washington, D.C. 20505
/// </summary>
SensitiveCompartmentedInformation = 0x20,
/// <summary>
/// National Security Agency (NSA).
/// 9800 Savage Road Attn: T03 Ft. Meade, MD 20755-6000
/// </summary>
Nsa = 0x10,
/// <summary>
/// Department of Energy (DOE).
/// Attn: DP343.2 Washington, DC 20545
/// </summary>
DeparmentOfEnergy = 0x08
}
}
\ No newline at end of file
...@@ -31,8 +31,8 @@ namespace PcapDotNet.Packets.IpV4 ...@@ -31,8 +31,8 @@ namespace PcapDotNet.Packets.IpV4
NoOperation = 1, NoOperation = 1,
/// <summary> /// <summary>
/// Security. /// DoD Basic Security:
/// Used to carry Security, Compartmentation, User Group (TCC), and Handling Restriction Codes compatible with DOD requirements. /// Used to carry the classification level and protection authority flags.
/// </summary> /// </summary>
Security = 130, Security = 130,
......
...@@ -75,12 +75,13 @@ ...@@ -75,12 +75,13 @@
<Compile Include="IpV4\IpV4Option.cs" /> <Compile Include="IpV4\IpV4Option.cs" />
<Compile Include="IpV4\IpV4OptionComplex.cs" /> <Compile Include="IpV4\IpV4OptionComplex.cs" />
<Compile Include="IpV4\IpV4OptionLooseSourceRouting.cs" /> <Compile Include="IpV4\IpV4OptionLooseSourceRouting.cs" />
<Compile Include="IpV4\IpV4OptionSecurityProtectionAuthority.cs" />
<Compile Include="IpV4\IpV4OptionSimple.cs" /> <Compile Include="IpV4\IpV4OptionSimple.cs" />
<Compile Include="IpV4\IpV4OptionRecordRoute.cs" /> <Compile Include="IpV4\IpV4OptionRecordRoute.cs" />
<Compile Include="IpV4\IpV4OptionRoute.cs" /> <Compile Include="IpV4\IpV4OptionRoute.cs" />
<Compile Include="IpV4\IpV4Options.cs" /> <Compile Include="IpV4\IpV4Options.cs" />
<Compile Include="IpV4\IpV4OptionSecurity.cs" /> <Compile Include="IpV4\IpV4OptionSecurity.cs" />
<Compile Include="IpV4\IpV4OptionSecurityLevel.cs" /> <Compile Include="IpV4\IpV4OptionSecurityClassificationLevel.cs" />
<Compile Include="IpV4\IpV4OptionStreamIdentifier.cs" /> <Compile Include="IpV4\IpV4OptionStreamIdentifier.cs" />
<Compile Include="IpV4\IpV4OptionStrictSourceRouting.cs" /> <Compile Include="IpV4\IpV4OptionStrictSourceRouting.cs" />
<Compile Include="IpV4\IpV4OptionTimedAddress.cs" /> <Compile Include="IpV4\IpV4OptionTimedAddress.cs" />
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment