Наследование: Asn1Encodable
Пример #1
0
		public override void PerformTest()
		{
			AlgorithmIdentifier algId = new AlgorithmIdentifier(new DerObjectIdentifier("1.2.2.3"));
			byte[] digest = new byte[20];

			CertHash certID = new CertHash(algId, digest);

			checkConstruction(certID, algId, digest);

			certID = CertHash.GetInstance(null);

			if (certID != null)
			{
				Fail("null GetInstance() failed.");
			}

			try
			{
				CertHash.GetInstance(new Object());

				Fail("GetInstance() failed to detect bad object.");
			}
			catch (ArgumentException)
			{
				// expected
			}
		}
Пример #2
0
		private void checkValues(
			CertHash certHash,
			AlgorithmIdentifier algId,
			byte[] digest)
		{
			checkMandatoryField("algorithmHash", algId, certHash.HashAlgorithm);

			checkMandatoryField("certificateHash", digest, certHash.CertificateHash);
		}
Пример #3
0
		private void checkConstruction(
			CertHash			certHash,
			AlgorithmIdentifier	algId,
			byte[]				digest)
		{
			checkValues(certHash, algId, digest);

			certHash = CertHash.GetInstance(certHash);

			checkValues(certHash, algId, digest);

			Asn1InputStream aIn = new Asn1InputStream(certHash.ToAsn1Object().GetEncoded());

			Asn1Sequence seq = (Asn1Sequence) aIn.ReadObject();

			certHash = CertHash.GetInstance(seq);

			checkValues(certHash, algId, digest);
		}