Ejemplo n.º 1
0
		public ITestResult Perform()
		{
			SmimeCapabilityVector caps = new SmimeCapabilityVector();

			caps.AddCapability(SmimeCapability.DesEde3Cbc);
			caps.AddCapability(SmimeCapability.RC2Cbc, 128);
			caps.AddCapability(SmimeCapability.DesCbc);

			SmimeCapabilitiesAttribute attr = new SmimeCapabilitiesAttribute(caps);

			SmimeEncryptionKeyPreferenceAttribute pref = new SmimeEncryptionKeyPreferenceAttribute(
				new RecipientKeyIdentifier(new DerOctetString(new byte[8]),
				new DerGeneralizedTime("20070315173729Z"),
				null));

			try
			{
				if (!Arrays.AreEqual(attr.GetEncoded(), attrBytes))
				{
					return new SimpleTestResult(false, Name + ": Failed attr data check");
				}

				Asn1Object o = Asn1Object.FromByteArray(attrBytes);
				if (!attr.Equals(o))
				{
					return new SimpleTestResult(false, Name + ": Failed equality test for attr");
				}

				if (!Arrays.AreEqual(pref.GetEncoded(), prefBytes))
				{
					return new SimpleTestResult(false, Name + ": Failed attr data check");
				}

				o = Asn1Object.FromByteArray(prefBytes);
				if (!pref.Equals(o))
				{
					return new SimpleTestResult(false, Name + ": Failed equality test for pref");
				}

				return new SimpleTestResult(true, Name + ": Okay");
			}
			catch (Exception e)
			{
				return new SimpleTestResult(false, Name + ": Failed - exception " + e.ToString(), e);
			}
		}
 public SmimeCapabilitiesAttribute(
     SmimeCapabilityVector capabilities)
     : base(SmimeAttributes.SmimeCapabilities,
            new DerSet(new DerSequence(capabilities.ToAsn1EncodableVector())))
 {
 }
 public SmimeCapabilitiesAttribute(
     SmimeCapabilityVector capabilities)
     : base(SmimeAttributes.SmimeCapabilities,
             new DerSet(new DerSequence(capabilities.ToAsn1EncodableVector())))
 {
 }