public KeyAgreeRecipientInformation( KeyAgreeRecipientInfo info, AlgorithmIdentifier encAlg, Stream data) : base(encAlg, AlgorithmIdentifier.GetInstance(info.KeyEncryptionAlgorithm), data) { _info = info; // _encAlg = encAlg; try { Asn1Sequence s = _info.RecipientEncryptedKeys; RecipientEncryptedKey id = RecipientEncryptedKey.GetInstance(s[0]); Asn1.Cms.IssuerAndSerialNumber iAnds = id.Identifier.IssuerAndSerialNumber; // byte[] issuerBytes = iAnds.Name.GetEncoded(); _rid = new RecipientID(); // _rid.SetIssuer(issuerBytes); _rid.Issuer = iAnds.Name; _rid.SerialNumber = iAnds.SerialNumber.Value; _encryptedKey = id.EncryptedKey; } catch (IOException e) { throw new ArgumentException("invalid rid in KeyAgreeRecipientInformation", e); } }
internal KeyAgreeRecipientInformation( KeyAgreeRecipientInfo info, RecipientID rid, Asn1OctetString encryptedKey, CmsSecureReadable secureReadable) : base(info.KeyEncryptionAlgorithm, secureReadable) { this.info = info; this.rid = rid; this.encryptedKey = encryptedKey; }
internal static void ReadRecipientInfo(IList infos, KeyAgreeRecipientInfo info, CmsSecureReadable secureReadable) { try { foreach (Asn1Encodable rek in info.RecipientEncryptedKeys) { RecipientEncryptedKey id = RecipientEncryptedKey.GetInstance(rek.ToAsn1Object()); RecipientID rid = new RecipientID(); Asn1.Cms.KeyAgreeRecipientIdentifier karid = id.Identifier; Asn1.Cms.IssuerAndSerialNumber iAndSN = karid.IssuerAndSerialNumber; if (iAndSN != null) { rid.Issuer = iAndSN.Name; rid.SerialNumber = iAndSN.SerialNumber.Value; } else { Asn1.Cms.RecipientKeyIdentifier rKeyID = karid.RKeyID; // Note: 'date' and 'other' fields of RecipientKeyIdentifier appear to be only informational rid.SubjectKeyIdentifier = rKeyID.SubjectKeyIdentifier.GetOctets(); } infos.Add(new KeyAgreeRecipientInformation(info, rid, id.EncryptedKey, secureReadable)); } } catch (IOException e) { throw new ArgumentException("invalid rid in KeyAgreeRecipientInformation", e); } }
public RecipientInfo( KeyAgreeRecipientInfo info) { this.info = new DerTaggedObject(false, 1, info); }
public static KeyAgreeRecipientInfo GetInstance(Asn1TaggedObject obj, bool explicitly) { return(KeyAgreeRecipientInfo.GetInstance(Asn1Sequence.GetInstance(obj, explicitly))); }