Esempio n. 1
0
        /// <summary>
        /// Determines whether [is the same] [the specified keyto test].
        /// </summary>
        /// <param name="KeytoTest">The keyto test.</param>
        /// <returns></returns>
        public bool IsTheSame(SubjectPublicKeyInfo KeytoTest)
        {
            SubjectKeyIdentifier key = SubjectKeyIdentifier.CreateSha1KeyIdentifier(KeytoTest);

            if (keyIdentifier.SequenceEqual(key.GetKeyIdentifier()))
            {
                return(true);
            }
            return(false);
        }
Esempio n. 2
0
        public override void PerformTest()
        {
            SubjectPublicKeyInfo pubInfo = SubjectPublicKeyInfo.GetInstance(
                Asn1Object.FromByteArray(pubKeyInfo));
            SubjectKeyIdentifier ski = SubjectKeyIdentifier.CreateSha1KeyIdentifier(pubInfo);

            if (!Arrays.AreEqual(shaID, ski.GetKeyIdentifier()))
            {
                Fail("SHA-1 ID does not match");
            }

            ski = SubjectKeyIdentifier.CreateTruncatedSha1KeyIdentifier(pubInfo);

            if (!Arrays.AreEqual(shaTruncID, ski.GetKeyIdentifier()))
            {
                Fail("truncated SHA-1 ID does not match");
            }
        }