Class FeedUtils
- Namespace
- ZeroInstall.Publish
- Assembly
- ZeroInstall.Publish.dll
Helper methods for manipulating Feeds.
public static class FeedUtils
- Inheritance
-
FeedUtils
- Inherited Members
Methods
DeployStylesheet(string, string)
Writes an XSL stylesheet with its accompanying CSS file unless there is already an XSL in place.
public static void DeployStylesheet(string path, string name)
Parameters
path
stringThe directory to write the stylesheet files to.
name
stringThe name of the stylesheet to deploy. Must be "feed" or "catalog".
Exceptions
- IOException
Failed to write the stylesheet files.
- UnauthorizedAccessException
Write access to the directory is not permitted.
GetKey(string, IOpenPgp)
Determines the key used to sign a feed or catalog file. Only uses the first signature if more than one is present.
public static OpenPgpSecretKey? GetKey(string path, IOpenPgp openPgp)
Parameters
path
stringThe feed or catalog file to check for signatures.
openPgp
IOpenPgpThe OpenPGP-compatible system used to validate the signatures.
Returns
- OpenPgpSecretKey
The key used to sign the file;
null
if the file was not signed.
Exceptions
- FileNotFoundException
The file file could not be found.
- IOException
The file could not be read.
- UnauthorizedAccessException
Read access to the file is not permitted.
SignFeed(Stream, OpenPgpSecretKey, string?, IOpenPgp)
Adds a Base64 signature to a feed or catalog stream.
public static void SignFeed(Stream stream, OpenPgpSecretKey secretKey, string? passphrase, IOpenPgp openPgp)
Parameters
stream
StreamThe feed or catalog to sign.
secretKey
OpenPgpSecretKeyThe secret key to use for signing the file.
passphrase
stringThe passphrase to use to unlock the key.
openPgp
IOpenPgpThe OpenPGP-compatible system used to create signatures.
Remarks
The file is not parsed before signing; invalid XML files are signed as well. The existing file must end with a line break. Old signatures are not removed.
Exceptions
- IOException
The file could not be read or written.
- UnauthorizedAccessException
Read or write access to the file is not permitted.
- KeyNotFoundException
The specified
secretKey
could not be found on the system.- WrongPassphraseException
passphrase
was incorrect.