/// <summary> /// Encodes a ShroudedKeyBag (§4.2.2 RFC 7292, §6, RFC 5208) /// </summary> /// <param name="Encryption">Encryption algorithm.</param> /// <param name="Algorithm">Algorithm containing private key.</param> public void ShroudedKeyBag(PasswordEncryption Encryption, SignatureAlgorithm Algorithm) { this.StartSafeBag(bagTypes + ".2"); DerEncoder Key = new DerEncoder(); EncodePrivateKeyInfo(Key, Algorithm); byte[] PrivateKey = Key.ToArray(); this.der.StartSEQUENCE(); // EncryptedPrivateKeyInfo Encryption.EncodePkcs5AlgorithmIdentifier(this.der); this.der.OCTET_STRING(Encryption.Encrypt(PrivateKey)); this.der.NULL(); // Attributes this.der.EndSEQUENCE(); // End of EncryptedPrivateKeyInfo this.EndSafeBag(); // TODO: attributes }