-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add first version of StrongNameSigner
- Loading branch information
Showing
66 changed files
with
9,996 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,13 @@ | ||
using System.IO; | ||
using System.IO.Packaging; | ||
using System.Security.Cryptography; | ||
using System.Threading.Tasks; | ||
|
||
namespace SigningService | ||
{ | ||
internal interface IPackagePartSigner | ||
{ | ||
Task<bool> TrySign(PackagePart packagePart); | ||
Task<bool> TrySignAsync(Stream peStream); | ||
bool CanSign(Stream peStream); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
using SigningService.Agents; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Security.Cryptography; | ||
using System.Threading.Tasks; | ||
using System.Web; | ||
|
||
namespace SigningService | ||
{ | ||
public class StrongNameSignerService : IPackagePartSigner | ||
{ | ||
private IKeyVaultAgent _keyVaultAgent; | ||
|
||
public StrongNameSignerService(IKeyVaultAgent keyVaultAgent) | ||
{ | ||
_keyVaultAgent = keyVaultAgent; | ||
} | ||
|
||
public Task<bool> TrySignAsync(Stream peStream) | ||
{ | ||
StrongNameSigner strongNameSigner = new StrongNameSigner(_keyVaultAgent, peStream, SHA256.Create()); | ||
return strongNameSigner.TrySignAsync(); | ||
} | ||
|
||
public bool CanSign(Stream peStream) | ||
{ | ||
StrongNameSigner strongNameSigner = new StrongNameSigner(_keyVaultAgent, peStream, SHA256.Create()); | ||
return strongNameSigner.CanSign(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
using System; | ||
|
||
namespace SigningService | ||
{ | ||
public struct DataBlock : IComparable<DataBlock> | ||
{ | ||
public DataBlock(DataBlockHashing hashing, string name, int offset, int size) | ||
{ | ||
Hashing = hashing; | ||
Name = name; | ||
Offset = offset; | ||
Size = size; | ||
} | ||
|
||
public DataBlockHashing Hashing; | ||
public string Name; | ||
public int Offset; | ||
public int Size; | ||
|
||
public int CompareTo(DataBlock other) | ||
{ | ||
return Offset.CompareTo(other.Offset); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
namespace SigningService | ||
{ | ||
public enum DataBlockHashing | ||
{ | ||
Hash, | ||
Skip, | ||
HashZeros | ||
} | ||
} |
Oops, something went wrong.