summary refs log tree commit diff
path: root/crypto/src/openpgp/PGPUserAttributeSubpacketVectorGenerator.cs
blob: c61b95b845ff9bb18fe78a17691c8fcd899115cc (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
using System;
using System.Collections.Generic;

using Org.BouncyCastle.Bcpg.Attr;

namespace Org.BouncyCastle.Bcpg.OpenPgp
{
	public class PgpUserAttributeSubpacketVectorGenerator
	{
		private readonly List<UserAttributeSubpacket> list = new List<UserAttributeSubpacket>();

		public virtual void SetImageAttribute(ImageAttrib.Format imageType, byte[] imageData)
		{
			if (imageData == null)
				throw new ArgumentException("attempt to set null image", "imageData");

			list.Add(new ImageAttrib(imageType, imageData));
		}

        public virtual PgpUserAttributeSubpacketVector Generate()
		{
            return new PgpUserAttributeSubpacketVector(list.ToArray());
		}
	}
}