Section:
HIPAAsuite.AuroraParser.Security
Class
Class Reference
8 Items
Type Description
Exception thrown when a high-level PGP encryption or decryption operation fails.
Detailed Remarks
This exception wraps lower-level PGP or IO failures to provide a consistent
error surface to the calling application.
Usage Example
try
{
crypto.EncryptFile("in.edi", "out.edi.pgp", "partner@company.com");
}
catch (PgpCryptoException ex)
{
// handle failure
}
Type Description
High-level PGP encryption and decryption service using a configured PgpKeyStore.
Detailed Remarks
This class is responsible for file-level operations (encrypt/decrypt) and stream-based operations. It does not manage keys itself; keys must be configured in a PgpKeyStore.
Methods wrap BouncyCastle exceptions in PgpCryptoException where appropriate to provide consistent error handling for application code.
Usage Example
var keyStore = new PgpKeyStore();
keyStore.AddPublicKeyRingFromFile(@"C:\\\\keys\\\\partner-public.asc");
keyStore.AddSecretKeyRingFromFile(@"C:\\\\keys\\\\my-private.asc");
var settings = new PgpEncryptionSettings("edi@your-company.com", "MyPassphrase");
var crypto = new PgpCryptoService(keyStore, settings);
// Encrypt an outbound file for trading partner
crypto.EncryptFile(@"C:\\\\outbox\\\\file.edi", @"C:\\\\outbox\\\\file.edi.pgp", "partner@company.com");
// Decrypt an inbound file
crypto.DecryptFile(@"C:\\\\inbox\\\\inbound.edi.pgp", @"C:\\\\inbox\\\\inbound.edi");
Type Description
Adapter around PgpCryptoService that implements the application-level
IEncryptionService interface.
Detailed Remarks
This allows the rest of the application to depend on IEncryptionService
without referencing BouncyCastle directly.
Usage Example
var keyStore = new PgpKeyStore();
keyStore.AddPublicKeyRingFromFile(@"C:\\\\keys\\\\partner-public.asc");
keyStore.AddSecretKeyRingFromFile(@"C:\\\\keys\\\\my-private.asc");
var settings = new PgpEncryptionSettings("edi@your-company.com", "MyPassphrase");
var crypto = new PgpCryptoService(keyStore, settings);
IEncryptionService encryptionService = new PgpEncryptionService(crypto);
encryptionService.EncryptFile("in.edi", "out.edi.pgp", "partner@company.com");
encryptionService.DecryptFile("inbound.edi.pgp", "inbound.edi");
Type Description
Settings for the local PGP identity (your private key and basic encryption options).
Detailed Remarks
This type is immutable and thread-safe. It captures the local identity used
to locate secret keys during decryption and configures how outbound encrypted
payloads are formatted for transport.
Usage Example
var settings = new PgpEncryptionSettings(
localUserId: "edi@your-company.com",
localPrivateKeyPassphrase: "YourPassphrase",
useAsciiArmor: true,
useIntegrityCheck: true);
Type Description
Generates OpenPGP RSA key pairs (public and secret key rings) in ASCII-armored format.
Detailed Remarks
This helper is intended for setup and testing scenarios where you need to
bootstrap PGP keys without invoking external tooling.
Usage Example
var (publicKey, privateKey) = PgpKeyGenerator.GenerateRsaKeyPair(
userId: "edi@your-company.com",
passphrase: "MyStrongPassphrase");
File.WriteAllText(@"C:\\\\keys\\\\edi-public.asc", publicKey);
File.WriteAllText(@"C:\\\\keys\\\\edi-private.asc", privateKey);
Type Description
Exception thrown when a requested PGP key cannot be found in the PgpKeyStore.
Detailed Remarks
This exception indicates that the key store has not been populated with
the expected public or secret key for a given user ID or key ID.
Usage Example
var key = store.GetEncryptionKey("partner@company.com");
// Throws PgpKeyNotFoundException if the key is missing.
Type Description
Aggregates public and secret key rings from multiple sources (files, strings, streams)
and provides lookup by user ID (email/name) or key ID.
Detailed Remarks
This class is not thread-safe for concurrent mutations. The intended pattern is: configure an instance (add all needed keys) at application startup, then use it in a read-only fashion across threads.
Lookup methods return the first matching key discovered in the loaded key rings. When multiple key rings contain overlapping user IDs, order of registration can influence which key is selected.
Usage Example
var store = new PgpKeyStore();
store.AddPublicKeyRingFromFile(@"C:\\\\keys\\\\partner-public.asc");
store.AddSecretKeyRingFromFile(@"C:\\\\keys\\\\my-private.asc");
var partnerKey = store.GetEncryptionKey("partner@company.com");
var mySigningKey = store.GetSigningSecretKey("edi@your-company.com");
Type Description
Helper for loading SSH private keys (in PEM format) from various sources for use with SSH.NET.
Detailed Remarks
This class is independent from PGP/OpenPGP; it is intended for SFTP or SSH-based
"certificate-based" authentication using SshNet.
Usage Example
var provider = new SshPrivateKeyProvider();
var privateKey = provider.FromFile(@"C:\\\\keys\\\\sftp-key.pem", "optional-passphrase");
using (var client = new SftpClient("host", 22, "user", privateKey))
{
client.Connect();
// ...
}