示例#1
0
        internal static void Decode(AsnReader reader, Asn1Tag expectedTag, out RSAPrivateKeyAsn decoded)
        {
            if (reader == null)
            {
                throw new ArgumentNullException(nameof(reader));
            }

            decoded = default;
            AsnReader sequenceReader = reader.ReadSequence(expectedTag);


            if (!sequenceReader.TryReadUInt8(out decoded.Version))
            {
                sequenceReader.ThrowIfNotEmpty();
            }

            decoded.Modulus         = sequenceReader.GetInteger();
            decoded.PublicExponent  = sequenceReader.GetInteger();
            decoded.PrivateExponent = sequenceReader.GetInteger();
            decoded.Prime1          = sequenceReader.GetInteger();
            decoded.Prime2          = sequenceReader.GetInteger();
            decoded.Exponent1       = sequenceReader.GetInteger();
            decoded.Exponent2       = sequenceReader.GetInteger();
            decoded.Coefficient     = sequenceReader.GetInteger();

            sequenceReader.ThrowIfNotEmpty();
        }
示例#2
0
        internal static void Decode(AsnReader reader, Asn1Tag expectedTag, out RSAPublicKeyAsn decoded)
        {
            if (reader == null)
            {
                throw new ArgumentNullException(nameof(reader));
            }

            decoded = default;
            AsnReader sequenceReader = reader.ReadSequence(expectedTag);

            decoded.Modulus        = sequenceReader.GetInteger();
            decoded.PublicExponent = sequenceReader.GetInteger();

            sequenceReader.ThrowIfNotEmpty();
        }
示例#3
0
        internal static void Decode(AsnReader reader, Asn1Tag expectedTag, out DssParms decoded)
        {
            if (reader == null)
            {
                throw new ArgumentNullException(nameof(reader));
            }

            decoded = default;
            AsnReader sequenceReader = reader.ReadSequence(expectedTag);

            decoded.P = sequenceReader.GetInteger();
            decoded.Q = sequenceReader.GetInteger();
            decoded.G = sequenceReader.GetInteger();

            sequenceReader.ThrowIfNotEmpty();
        }