Пример #1
0
        internal static void Decode(ref AsnValueReader reader, Asn1Tag expectedTag, ReadOnlyMemory <byte> rebind, out RSAPublicKeyAsn decoded)
        {
            decoded = default;
            AsnValueReader sequenceReader = reader.ReadSequence(expectedTag);

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

            sequenceReader.ThrowIfNotEmpty();
        }
Пример #2
0
        internal static void Decode(ref AsnValueReader reader, Asn1Tag expectedTag, ReadOnlyMemory <byte> rebind, out DssParms decoded)
        {
            decoded = default;
            AsnValueReader sequenceReader = reader.ReadSequence(expectedTag);

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

            sequenceReader.ThrowIfNotEmpty();
        }
        internal static void Decode(ref AsnValueReader reader, Asn1Tag expectedTag, ReadOnlyMemory <byte> rebind, out RSAPrivateKeyAsn decoded)
        {
            decoded = default;
            AsnValueReader sequenceReader = reader.ReadSequence(expectedTag);


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

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

            sequenceReader.ThrowIfNotEmpty();
        }