コード例 #1
0
        internal static void Decode(AsnReader reader, out OtherKeyAttributeAsn decoded)
        {
            if (reader == null)
            {
                throw new ArgumentNullException(nameof(reader));
            }

            Decode(reader, Asn1Tag.Sequence, out decoded);
        }
コード例 #2
0
        internal static void Decode(AsnReader reader, Asn1Tag expectedTag, out OtherKeyAttributeAsn decoded)
        {
            if (reader == null)
            {
                throw new ArgumentNullException(nameof(reader));
            }

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

            decoded.KeyAttrId = sequenceReader.ReadObjectIdentifierAsString();

            if (sequenceReader.HasData)
            {
                decoded.KeyAttr = sequenceReader.GetEncodedValue();
            }


            sequenceReader.ThrowIfNotEmpty();
        }
コード例 #3
0
 internal static void Decode(ref AsnValueReader reader, Asn1Tag expectedTag, ReadOnlyMemory <byte> rebind, out OtherKeyAttributeAsn decoded)
 {
     try
     {
         DecodeCore(ref reader, expectedTag, rebind, out decoded);
     }
     catch (AsnContentException e)
     {
         throw new CryptographicException(SR.Cryptography_Der_Invalid_Encoding, e);
     }
 }
コード例 #4
0
        private static void DecodeCore(ref AsnValueReader reader, Asn1Tag expectedTag, ReadOnlyMemory <byte> rebind, out OtherKeyAttributeAsn decoded)
        {
            decoded = default;
            AsnValueReader      sequenceReader = reader.ReadSequence(expectedTag);
            ReadOnlySpan <byte> rebindSpan     = rebind.Span;
            int offset;
            ReadOnlySpan <byte> tmpSpan;

            decoded.KeyAttrId = sequenceReader.ReadObjectIdentifier();

            if (sequenceReader.HasData)
            {
                tmpSpan         = sequenceReader.ReadEncodedValue();
                decoded.KeyAttr = rebindSpan.Overlaps(tmpSpan, out offset) ? rebind.Slice(offset, tmpSpan.Length) : tmpSpan.ToArray();
            }


            sequenceReader.ThrowIfNotEmpty();
        }
コード例 #5
0
 internal static void Decode(ref AsnValueReader reader, ReadOnlyMemory <byte> rebind, out OtherKeyAttributeAsn decoded)
 {
     Decode(ref reader, Asn1Tag.Sequence, rebind, out decoded);
 }