Files
dotnet-packaging/Packaging.Targets/Rpm/PackageSigner.cs
Frederik Carlier 6fd0493a5b Make package creation more flexible:
- 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)
2017-10-13 00:17:03 +02:00

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);
}
}
}