GithubHelp home page GithubHelp logo

isabella232 / webhooks-sign-package Goto Github PK

View Code? Open in Web Editor NEW

This project forked from myget/webhooks-sign-package

0.0 0.0 0.0 69 KB

Library and web project that can sign NuGet packages, for example triggered by MyGet Webhooks

License: Apache License 2.0

C# 99.23% ASP 0.77%

webhooks-sign-package's Introduction

NuGet Signature

Library and web project that can sign NuGet packages, for example triggered by MyGet Webhooks. Read my blog post for more information.

The project makes use of the excellent work by Werner van Deventer described in his blog post ".NET Assembly Strong-Name Signer".

Using the library

NuGet: https://www.nuget.org/packages/Signature.Core

The Signature.Core comes with a class (PackageSigner) that can sign a NuGet package. Here's an example:

PackageSigner signer = new PackageSigner();
signer.SignPackage("MyPackage.1.0.0.nupkg", "MyPackage.Signed.1.0.0.nupkg", "SampleKey.pfx", "password", "MyPackage.Signed");

Note: While the PackageSigner does not require a PFX file to be specified, it is recommended to use one. NuGet will get very confused for packages with the same id but different versions if the signature uses a different key.

Integrating NuGet Signature with MyGet

A nice use case for this repository is automatically signing unsigned NuGet packages that are pushed to a MyGet feed.

Deploy and configure NuGet Signature

First of all, deploy NuGet Signature to a web server, for example Microsoft Azure Websites. Then, configure the application using the management dashboard. The following settings must be provided:

  • Signature:KeyFile - path to the PFX file to use when signing
  • Signature:KeyFilePassword - private key/password for using the PFX file
  • Signature:PackageIdSuffix - suffix for signed package id's. Can be empty or something like .Signed
  • Signature:NuGetFeedUrl - NuGet feed to push signed packages to
  • Signature:NuGetFeedApiKey - API key for pushing packages to the above feed

The configuration in the Microsoft Azure Management Dashboard could look like the following:

Azure Websites configuration

Setup a MyGet Webhook

For the MyGet feed you wish to sign packages, configure a new HTTP Post webhook. The following options must be configured:

  • URL to POST JSON data to - URL to the deployed NuGet Signature API, for example http://signpackage.azurewebsites.net/api/sign (do not forget the /api/sign)
  • Content type - set to application/json
  • Events that trigger this web hook - make sure that only Package Added is selected

MyGet webhook configuration

From now on, all packages that are added to your feed will be signed when the webhook is triggered. To sign existing packages, you'll have to use the library itself.

webhooks-sign-package's People

Contributors

codekaizen avatar maartenba avatar nathanpickett avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.