mirror of
https://github.com/quamotion/dotnet-packaging.git
synced 2026-02-15 21:35:27 +00:00
- Allow faking the PGP signatures (useful for unit tests) - Allow including the version name in RPM name in the RPM lead - Don't populate prein/postin/preout/postout keys if no scripts are present - Allow passing a compressed payload stream (useful for unit tests)
31 lines
765 B
C#
31 lines
765 B
C#
using Org.BouncyCastle.Bcpg.OpenPgp;
|
|
using System;
|
|
using System.IO;
|
|
|
|
namespace Packaging.Targets.Rpm
|
|
{
|
|
/// <summary>
|
|
/// Generates <see cref="PgpSignature"/> values using a <see cref="Stream"/> and a
|
|
/// <see cref="PgpPrivateKey"/>.
|
|
/// </summary>
|
|
internal class PackageSigner : IPackageSigner
|
|
{
|
|
private readonly PgpPrivateKey privateKey;
|
|
|
|
public PackageSigner(PgpPrivateKey privateKey)
|
|
{
|
|
if (privateKey == null)
|
|
{
|
|
throw new ArgumentNullException(nameof(privateKey));
|
|
}
|
|
|
|
this.privateKey = privateKey;
|
|
}
|
|
|
|
public PgpSignature Sign(Stream payload)
|
|
{
|
|
return PgpSigner.Sign(this.privateKey, payload);
|
|
}
|
|
}
|
|
}
|