Esempio n. 1
0
        public static void ReadNegativeIntegers(PublicEncodingRules ruleSet)
        {
            byte[] inputData = (
                "3007" +
                "0201FE" +
                "0202FEEF").HexToByteArray();

            BigIntegers bigIntegers = AsnSerializer.Deserialize <BigIntegers>(
                inputData,
                (AsnEncodingRules)ruleSet);

            Assert.Equal(-2, (int)bigIntegers.First);
            Assert.Equal("FEEF", bigIntegers.Second.ByteArrayToHex());
        }
Esempio n. 2
0
        // More!
        public static void AlgorithmIdentifier_ECC_WithCurves(
            PublicEncodingRules ruleSet,
            string inputHex,
            string curveOid)
        {
            byte[] inputData = inputHex.HexToByteArray();

            var algorithmIdentifier = AsnSerializer.Deserialize <AlgorithmIdentifier>(
                inputData,
                (AsnEncodingRules)ruleSet);

            Assert.Equal("1.2.840.10045.2.1", algorithmIdentifier.Algorithm.Value);

            var reader  = new AsnReader(algorithmIdentifier.Parameters, (AsnEncodingRules)ruleSet);
            Oid curveId = reader.ReadObjectIdentifier(skipFriendlyName: true);

            Assert.Equal(curveOid, curveId.Value);
        }