Class FeedUtils
Helper methods for manipulating Feeds.
Namespace: ZeroInstall.Publish
Assembly: ZeroInstall.Publish.dll
Syntax
public static class FeedUtils : Object
Methods
DeployStylesheet(String, String)
Writes an XSL stylesheet with its accompanying CSS file unless there is already an XSL in place.
Declaration
public static void DeployStylesheet(string path, string name)
Parameters
Type | Name | Description |
---|---|---|
String | path | The directory to write the stylesheet files to. |
String | name | The name of the stylesheet to deploy. Must be "feed" or "catalog". |
Exceptions
Type | Condition |
---|---|
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.
Declaration
public static OpenPgpSecretKey GetKey(string path, IOpenPgp openPgp)
Parameters
Type | Name | Description |
---|---|---|
String | path | The feed or catalog file to check for signatures. |
IOpenPgp | openPgp | The OpenPGP-compatible system used to validate the signatures. |
Returns
Type | Description |
---|---|
OpenPgpSecretKey | The key used to sign the file; |
Exceptions
Type | Condition |
---|---|
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.
Declaration
public static void SignFeed(Stream stream, OpenPgpSecretKey secretKey, string passphrase, IOpenPgp openPgp)
Parameters
Type | Name | Description |
---|---|---|
Stream | stream | The feed or catalog to sign. |
OpenPgpSecretKey | secretKey | The secret key to use for signing the file. |
String | passphrase | The passphrase to use to unlock the key. |
IOpenPgp | openPgp | The 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
Type | Condition |
---|---|
IOException | The file could not be read or written. |
UnauthorizedAccessException | Read or write access to the file is not permitted. |
KeyNotFoundException | The specified |
WrongPassphraseException |
|