public void CanCreateASignedCommit() { string repoPath = SandboxStandardTestRepo(); using (var repo = new Repository(repoPath)) { var odb = repo.ObjectDatabase; var signedId = odb.Write <Commit>(Encoding.UTF8.GetBytes(signedCommit)); var signedId2 = odb.CreateCommitWithSignature(signedData, signatureData); Assert.Equal(signedId, signedId2); var signatureInfo = Commit.ExtractSignature(repo, signedId2); Assert.Equal(signedData, signatureInfo.SignedData); Assert.Equal(signatureData, signatureInfo.Signature); } }
public void CanExtractSignatureFromCommit() { string repoPath = InitNewRepository(); using (var repo = new Repository(repoPath)) { var odb = repo.ObjectDatabase; var signedId = odb.Write <Commit>(Encoding.UTF8.GetBytes(signedCommit)); // Look up the commit to make sure we wrote something valid var commit = repo.Lookup <Commit>(signedId); Assert.Equal("a simple commit which works\n", commit.Message); var signatureInfo = Commit.ExtractSignature(repo, signedId, "gpgsig"); Assert.Equal(signedData, signatureInfo.SignedData); Assert.Equal(signatureData, signatureInfo.Signature); signatureInfo = Commit.ExtractSignature(repo, signedId); Assert.Equal(signedData, signatureInfo.SignedData); Assert.Equal(signatureData, signatureInfo.Signature); } }