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
pathstringThe directory to write the stylesheet files to.
namestringThe 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
pathstringThe feed or catalog file to check for signatures.
openPgpIOpenPgpThe OpenPGP-compatible system used to validate the signatures.
Returns
- OpenPgpSecretKey
The key used to sign the file;
nullif 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
streamStreamThe feed or catalog to sign.
secretKeyOpenPgpSecretKeyThe secret key to use for signing the file.
passphrasestringThe passphrase to use to unlock the key.
openPgpIOpenPgpThe 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
secretKeycould not be found on the system.- WrongPassphraseException
passphrasewas incorrect.