internal static void Decode(AsnReader reader, out RecipientInfoAsn decoded) { if (reader == null) { throw new ArgumentNullException(nameof(reader)); } decoded = default; Asn1Tag tag = reader.PeekTag(); if (tag.HasSameClassAndValue(Asn1Tag.Sequence)) { System.Security.Cryptography.Pkcs.Asn1.KeyTransRecipientInfoAsn tmpKtri; System.Security.Cryptography.Pkcs.Asn1.KeyTransRecipientInfoAsn.Decode(reader, out tmpKtri); decoded.Ktri = tmpKtri; } else if (tag.HasSameClassAndValue(new Asn1Tag(TagClass.ContextSpecific, 1))) { System.Security.Cryptography.Pkcs.Asn1.KeyAgreeRecipientInfoAsn tmpKari; System.Security.Cryptography.Pkcs.Asn1.KeyAgreeRecipientInfoAsn.Decode(reader, new Asn1Tag(TagClass.ContextSpecific, 1), out tmpKari); decoded.Kari = tmpKari; } else { throw new CryptographicException(); } }
internal static void Decode(ref AsnValueReader reader, ReadOnlyMemory <byte> rebind, out RecipientInfoAsn decoded) { decoded = default; Asn1Tag tag = reader.PeekTag(); if (tag.HasSameClassAndValue(Asn1Tag.Sequence)) { System.Security.Cryptography.Pkcs.Asn1.KeyTransRecipientInfoAsn tmpKtri; System.Security.Cryptography.Pkcs.Asn1.KeyTransRecipientInfoAsn.Decode(ref reader, rebind, out tmpKtri); decoded.Ktri = tmpKtri; } else if (tag.HasSameClassAndValue(new Asn1Tag(TagClass.ContextSpecific, 1))) { System.Security.Cryptography.Pkcs.Asn1.KeyAgreeRecipientInfoAsn tmpKari; System.Security.Cryptography.Pkcs.Asn1.KeyAgreeRecipientInfoAsn.Decode(ref reader, new Asn1Tag(TagClass.ContextSpecific, 1), rebind, out tmpKari); decoded.Kari = tmpKari; } else { throw new CryptographicException(); } }
internal static void Decode(ref AsnValueReader reader, ReadOnlyMemory <byte> rebind, out RecipientInfoAsn decoded) { try { DecodeCore(ref reader, rebind, out decoded); } catch (AsnContentException e) { throw new CryptographicException(SR.Cryptography_Der_Invalid_Encoding, e); } }