Ejemplo n.º 1
0
		public static AbstractBlob CreateFromStream(ReadingContext SR)
		{
			// Read the magic and length (common to all blobs)
			UInt32 Magic = SR.ReadUInt32();
			UInt32 Length = SR.ReadUInt32();

			AbstractBlob Result;

			switch (Magic)
			{
				case CSMAGIC_CODEDIRECTORY:
					Result = new CodeDirectoryBlob();
					break;
				case CSMAGIC_CODEDIR_SIGNATURE:
					Result = new CodeDirectorySignatureBlob();
					break;
				case CSMAGIC_ENTITLEMENTS:
					Result = new EntitlementsBlob();
					break;
				case CSMAGIC_REQUIREMENTS_TABLE:
					Result = new RequirementsBlob();
					break;
				case CSMAGIC_EMBEDDED_SIGNATURE:
					Result = new CodeSigningTableBlob();
					break;
				case CSMAGIC_REQUIREMENT:
				default:
					Result = new OpaqueBlob();
					break;
			}
			Result.MyMagic = Magic;
			Result.UnpackageData(SR, Length);

			if (Config.bCodeSignVerbose)
			{
				Console.WriteLine("[Read blob with magic 0x{0:X} and length={1}]\n{2}", Magic, Length, Result.ToString());
			}

			return Result;
		}
Ejemplo n.º 2
0
		public static EntitlementsBlob Create(string EntitlementsText)
		{
			EntitlementsBlob Result = new EntitlementsBlob();
			Result.MyData = Encoding.UTF8.GetBytes(EntitlementsText);
			return Result;
		}