Skip to content

Commit

Permalink
Merge pull request #28 from qmfrederik/features/propertylist-overloads
Browse files Browse the repository at this point in the history
ProvisionigProfile API enhancements
  • Loading branch information
filipnavara committed Jan 25, 2023
2 parents cae5a25 + a635f02 commit 12e981d
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions Melanzana.CodeSign/ProvisioningProfile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,19 @@ public class ProvisioningProfile
{
private readonly NSDictionary plist;

public ProvisioningProfile(string fileName)
public ProvisioningProfile(byte[] bytes)
{
var signedCms = new SignedCms();
signedCms.Decode(File.ReadAllBytes(fileName));
signedCms.Decode(bytes);
var contentInfo = signedCms.ContentInfo;
var content = contentInfo.Content;

plist = (NSDictionary)XmlPropertyListParser.Parse(content);
}

public ProvisioningProfile(string fileName)
: this(File.ReadAllBytes(fileName))
{
}

public IList<string> TeamIdentifiers => GetStringArray("TeamIdentifier");
Expand Down Expand Up @@ -51,6 +55,8 @@ private IList<string> GetStringArray(string name)

public override string ToString() => this.Name;

public NSDictionary PropertyList => this.PropertyList;

public void Save(string filename)
{
File.WriteAllText(filename, this.plist.ToXmlPropertyList());
Expand Down

0 comments on commit 12e981d

Please sign in to comment.