internal static void Decode(AsnReader reader, out SigningCertificateV2Asn decoded) { if (reader == null) { throw new ArgumentNullException(nameof(reader)); } Decode(reader, Asn1Tag.Sequence, out decoded); }
internal static void Decode(AsnReader reader, Asn1Tag expectedTag, out SigningCertificateV2Asn decoded) { if (reader == null) { throw new ArgumentNullException(nameof(reader)); } decoded = default; AsnReader sequenceReader = reader.ReadSequence(expectedTag); AsnReader collectionReader; // Decode SEQUENCE OF for Certs { collectionReader = sequenceReader.ReadSequence(); var tmpList = new List <System.Security.Cryptography.Pkcs.Asn1.EssCertIdV2>(); System.Security.Cryptography.Pkcs.Asn1.EssCertIdV2 tmpItem; while (collectionReader.HasData) { System.Security.Cryptography.Pkcs.Asn1.EssCertIdV2.Decode(collectionReader, out tmpItem); tmpList.Add(tmpItem); } decoded.Certs = tmpList.ToArray(); } if (sequenceReader.HasData && sequenceReader.PeekTag().HasSameClassAndValue(Asn1Tag.Sequence)) { // Decode SEQUENCE OF for Policies { collectionReader = sequenceReader.ReadSequence(); var tmpList = new List <System.Security.Cryptography.Pkcs.Asn1.PolicyInformation>(); System.Security.Cryptography.Pkcs.Asn1.PolicyInformation tmpItem; while (collectionReader.HasData) { System.Security.Cryptography.Pkcs.Asn1.PolicyInformation.Decode(collectionReader, out tmpItem); tmpList.Add(tmpItem); } decoded.Policies = tmpList.ToArray(); } } sequenceReader.ThrowIfNotEmpty(); }
private static void DecodeCore(ref AsnValueReader reader, Asn1Tag expectedTag, ReadOnlyMemory <byte> rebind, out SigningCertificateV2Asn decoded) { decoded = default; AsnValueReader sequenceReader = reader.ReadSequence(expectedTag); AsnValueReader collectionReader; // Decode SEQUENCE OF for Certs { collectionReader = sequenceReader.ReadSequence(); var tmpList = new List <System.Security.Cryptography.Pkcs.Asn1.EssCertIdV2>(); System.Security.Cryptography.Pkcs.Asn1.EssCertIdV2 tmpItem; while (collectionReader.HasData) { System.Security.Cryptography.Pkcs.Asn1.EssCertIdV2.Decode(ref collectionReader, rebind, out tmpItem); tmpList.Add(tmpItem); } decoded.Certs = tmpList.ToArray(); } if (sequenceReader.HasData && sequenceReader.PeekTag().HasSameClassAndValue(Asn1Tag.Sequence)) { // Decode SEQUENCE OF for Policies { collectionReader = sequenceReader.ReadSequence(); var tmpList = new List <System.Security.Cryptography.Pkcs.Asn1.PolicyInformation>(); System.Security.Cryptography.Pkcs.Asn1.PolicyInformation tmpItem; while (collectionReader.HasData) { System.Security.Cryptography.Pkcs.Asn1.PolicyInformation.Decode(ref collectionReader, rebind, out tmpItem); tmpList.Add(tmpItem); } decoded.Policies = tmpList.ToArray(); } } sequenceReader.ThrowIfNotEmpty(); }
internal static void Decode(ref AsnValueReader reader, Asn1Tag expectedTag, ReadOnlyMemory <byte> rebind, out SigningCertificateV2Asn decoded) { try { DecodeCore(ref reader, expectedTag, rebind, out decoded); } catch (AsnContentException e) { throw new CryptographicException(SR.Cryptography_Der_Invalid_Encoding, e); } }
internal static void Decode(ref AsnValueReader reader, ReadOnlyMemory <byte> rebind, out SigningCertificateV2Asn decoded) { Decode(ref reader, Asn1Tag.Sequence, rebind, out decoded); }