Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 15 additions & 15 deletions src/VectorNNTPD.Common/Acme/AcmePaths.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,70 +83,70 @@ internal static void EnsureCertificateIdentityLayout(string stateDir, string fqd
/// <summary>Account directory path.</summary>
/// <param name="stateDir">Shared ACME state root.</param>
/// <returns>The account directory.</returns>
private static string AccountDir(string stateDir) => Path.Combine(stateDir, "account");
private static string AccountDir(string stateDir) => Path.Join(stateDir, "account");

/// <summary>Account PKCS#8 DER private key path.</summary>
/// <param name="stateDir">Shared ACME state root.</param>
/// <returns>The account private-key path.</returns>
internal static string AccountKeyPath(string stateDir) => Path.Combine(AccountDir(stateDir), AccountPrivateKey);
internal static string AccountKeyPath(string stateDir) => Path.Join(AccountDir(stateDir), AccountPrivateKey);

/// <summary>Account registration metadata JSON path.</summary>
/// <param name="stateDir">Shared ACME state root.</param>
/// <returns>The registration metadata path.</returns>
internal static string AccountMetaPath(string stateDir) => Path.Combine(AccountDir(stateDir), "registration.json");
internal static string AccountMetaPath(string stateDir) => Path.Join(AccountDir(stateDir), "registration.json");

/// <summary>Pending account key path (crash recovery).</summary>
/// <param name="stateDir">Shared ACME state root.</param>
/// <returns>The pending account-key path.</returns>
internal static string AccountPendingKeyPath(string stateDir) =>
Path.Combine(AccountDir(stateDir), AccountPrivateKey + ".pending");
Path.Join(AccountDir(stateDir), AccountPrivateKey + ".pending");

/// <summary>Pending registration metadata path.</summary>
/// <param name="stateDir">Shared ACME state root.</param>
/// <returns>The pending registration metadata path.</returns>
internal static string AccountPendingMetaPath(string stateDir) =>
Path.Combine(AccountDir(stateDir), "registration.pending.json");
Path.Join(AccountDir(stateDir), "registration.pending.json");

/// <summary>Common ACME journal root containing one <c>{fqdn}.json</c> file per identity.</summary>
/// <param name="stateDir">Shared ACME state root.</param>
/// <returns>The journal directory.</returns>
internal static string JournalRoot(string stateDir) => Path.Combine(stateDir, Journal);
internal static string JournalRoot(string stateDir) => Path.Join(stateDir, Journal);

/// <summary>Persistent ACME transaction journal file for one FQDN.</summary>
/// <param name="stateDir">Shared ACME state root.</param>
/// <param name="fqdn">Certificate FQDN that owns the journal.</param>
/// <returns>The journal file path <c>journal/{fqdn}.json</c>.</returns>
internal static string TransactionJournalPath(string stateDir, string fqdn) =>
Path.Combine(JournalRoot(stateDir), CertificateIdentities.NormalizeFqdn(fqdn) + ".json");
Path.Join(JournalRoot(stateDir), CertificateIdentities.NormalizeFqdn(fqdn) + ".json");

/// <summary>FQDN-scoped live certificate root.</summary>
/// <param name="stateDir">Shared ACME state root.</param>
/// <param name="fqdn">Certificate FQDN.</param>
/// <returns>The live directory <c>live/{fqdn}</c>.</returns>
internal static string LiveDir(string stateDir, string fqdn) =>
Path.Combine(stateDir, Live, CertificateIdentities.NormalizeFqdn(fqdn));
Path.Join(stateDir, Live, CertificateIdentities.NormalizeFqdn(fqdn));

/// <summary>FQDN-scoped certificate generations directory.</summary>
/// <param name="stateDir">Shared ACME state root.</param>
/// <param name="fqdn">Certificate FQDN.</param>
/// <returns>The generations directory <c>live/{fqdn}/gens</c>.</returns>
internal static string GenerationsDir(string stateDir, string fqdn) =>
Path.Combine(LiveDir(stateDir, fqdn), Gens);
Path.Join(LiveDir(stateDir, fqdn), Gens);

/// <summary>FQDN-scoped current generation pointer file.</summary>
/// <param name="stateDir">Shared ACME state root.</param>
/// <param name="fqdn">Certificate FQDN.</param>
/// <returns>The current-pointer path <c>live/{fqdn}/current</c>.</returns>
internal static string CurrentGenerationPointerPath(string stateDir, string fqdn) =>
Path.Combine(LiveDir(stateDir, fqdn), Current);
Path.Join(LiveDir(stateDir, fqdn), Current);

/// <summary>Directory for one generation id under an FQDN.</summary>
/// <param name="stateDir">Shared ACME state root.</param>
/// <param name="fqdn">Certificate FQDN.</param>
/// <param name="generationId">Generation directory name.</param>
/// <returns>The generation directory.</returns>
internal static string GenerationDir(string stateDir, string fqdn, string generationId) =>
Path.Combine(GenerationsDir(stateDir, fqdn), generationId);
Path.Join(GenerationsDir(stateDir, fqdn), generationId);

/// <summary>Paths for a generation's PKCS#12/PFX material.</summary>
/// <param name="stateDir">Shared ACME state root.</param>
Expand All @@ -156,7 +156,7 @@ internal static string GenerationDir(string stateDir, string fqdn, string genera
internal static CertificatePaths GenerationCertificatePaths(string stateDir, string fqdn, string generationId)
{
var root = GenerationDir(stateDir, fqdn, generationId);
return new CertificatePaths(Path.Combine(root, CertificatePfx), generationId);
return new CertificatePaths(Path.Join(root, CertificatePfx), generationId);
}

/// <summary>Completion marker for a generation.</summary>
Expand All @@ -165,20 +165,20 @@ internal static CertificatePaths GenerationCertificatePaths(string stateDir, str
/// <param name="generationId">Generation directory name.</param>
/// <returns>The <c>complete</c> marker path.</returns>
internal static string GenerationCompleteMarker(string stateDir, string fqdn, string generationId) =>
Path.Combine(GenerationDir(stateDir, fqdn, generationId), Complete);
Path.Join(GenerationDir(stateDir, fqdn, generationId), Complete);

/// <summary>FQDN-scoped transient DNS-01 recovery directory.</summary>
/// <param name="stateDir">Shared ACME state root.</param>
/// <param name="fqdn">Certificate FQDN.</param>
/// <returns>The recovery directory <c>live/{fqdn}/dns01</c>.</returns>
internal static string Dns01RecoveryDir(string stateDir, string fqdn) =>
Path.Combine(LiveDir(stateDir, fqdn), Dns01);
Path.Join(LiveDir(stateDir, fqdn), Dns01);

/// <summary>FQDN-scoped issuance lock file path.</summary>
/// <param name="stateDir">Shared ACME state root.</param>
/// <param name="fqdn">Certificate FQDN.</param>
/// <returns>The lock path <c>live/{fqdn}/.issuance.lock</c>.</returns>
internal static string IssuanceLockPath(string stateDir, string fqdn) =>
Path.Combine(LiveDir(stateDir, fqdn), IssuanceLockFile);
Path.Join(LiveDir(stateDir, fqdn), IssuanceLockFile);
}
}
2 changes: 1 addition & 1 deletion src/VectorNNTPD.Common/Acme/AtomicFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ internal static void WriteBytes(string path, ReadOnlySpan<byte> data)
Directory.CreateDirectory(directory);
}

var tempPath = Path.Combine(
var tempPath = Path.Join(
directory ?? ".",
$".{Path.GetFileName(path)}.{Guid.NewGuid():N}.tmp");

Expand Down
4 changes: 2 additions & 2 deletions src/VectorNNTPD.Common/Acme/Dns01Solver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,7 @@ private static void WriteJournalEntry(string journalDir, JournalEntry entry)
Fqdn = entry.Fqdn,
TransactionId = entry.TransactionId,
};
var path = Path.Combine(journalDir, entry.EntryId + ".json");
var path = Path.Join(journalDir, entry.EntryId + ".json");
AtomicFile.WriteText(
path,
System.Text.Json.JsonSerializer.Serialize(
Expand All @@ -532,7 +532,7 @@ private static void WriteJournalEntry(string journalDir, JournalEntry entry)
/// <param name="journalDir">FQDN recovery directory.</param>
/// <param name="entryId">Recovery file id.</param>
private static void RemoveJournalFile(string journalDir, string entryId) =>
AtomicFile.TryDelete(Path.Combine(journalDir, entryId + ".json"));
AtomicFile.TryDelete(Path.Join(journalDir, entryId + ".json"));

/// <summary>Reads every <c>*.json</c> file in ordinal path order. A missing directory returns an empty list.</summary>
/// <param name="journalDir">FQDN recovery directory.</param>
Expand Down
Loading
Loading