Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
1da9b5f
Enhance RSA Key Management and OpenSSH Representation
nedithgar Jul 29, 2025
8453b16
feat: add support for multiple RSA signature hash algorithms and corr…
nedithgar Jul 29, 2025
fe8327c
feat: add support for RSA certificate types and corresponding key det…
nedithgar Jul 30, 2025
2434b17
Add Ed25519 certificate support and related tests
nedithgar Jul 30, 2025
65234f8
feat: enhance RSA certificate handling and add backward compatibility…
nedithgar Jul 30, 2025
c942462
feat: add SSH key generation and export functionality with tests
nedithgar Jul 30, 2025
1210069
feat: add passphrase protection and cipher options for private key ex…
nedithgar Jul 30, 2025
c496f7c
refactor: remove unused authentication method and related tests from …
nedithgar Jul 30, 2025
111d52d
feat: implement OpenSSH format export for RSA keys with support for c…
nedithgar Jul 30, 2025
368a3aa
feat: add PEM and DER support for RSA and Ed25519 keys
nedithgar Jul 30, 2025
af928c4
feat: add PEM export functionality for public keys in SSHKeyGenerator
nedithgar Jul 30, 2025
e7591ce
feat: add SSH certificate authentication tests and utilities for mult…
nedithgar Jul 30, 2025
d395162
feat: enhance certificate authentication tests with additional key ty…
nedithgar Jul 30, 2025
801e8d1
feat: implement certificate authentication tests for Ed25519, RSA, an…
nedithgar Jul 30, 2025
226f9c6
feat: enhance SSH certificate handling for different key types and ad…
nedithgar Jul 30, 2025
e777e51
fix: replace macOS-specific Security framework with cross-platform ra…
nedithgar Jul 30, 2025
b32c29b
fix: completely remove Security framework dependency for cross-platfo…
nedithgar Jul 30, 2025
4e1b843
fix: add 'any' keyword for OpenSSHPrivateKey protocol usage (Swift 6 …
nedithgar Jul 30, 2025
0b33865
fix: remove upstream-citadel subproject reference
nedithgar Jul 30, 2025
fe859dd
feat: add support for SSH certificate authentication methods and util…
nedithgar Jul 30, 2025
edf635b
Update dependencies and enhance SSH certificate handling
nedithgar Jul 31, 2025
1da0ad6
Refactor/security (#8)
nedithgar Aug 1, 2025
93cc9ca
refactor: improve SSH certificate setup handling in tests (#9)
nedithgar Aug 2, 2025
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
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@ jobs:
SSH_HOST: ssh-server
SSH_PORT: 2222
SSH_USERNAME: citadel
SSH_PASSWORD: hunter2
SSH_PASSWORD: hunter2
46 changes: 23 additions & 23 deletions Package.resolved

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 3 additions & 4 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ let package = Package(
),
],
dependencies: [
// .package(path: "/Users/joannisorlandos/git/joannis/swift-nio-ssh"),
.package(name: "swift-nio-ssh", url: "https://github.com/Joannis/swift-nio-ssh.git", "0.3.4" ..< "0.4.0"),
.package(url: "https://github.com/nedithgar/Joannis-swift-nio-ssh.git", from: "0.3.5"),
.package(url: "https://github.com/apple/swift-log.git", from: "1.0.0"),
.package(url: "https://github.com/attaswift/BigInt.git", from: "5.2.0"),
.package(url: "https://github.com/apple/swift-crypto.git", from: "3.12.3"),
Expand All @@ -29,7 +28,7 @@ let package = Package(
name: "Citadel",
dependencies: [
.target(name: "CCitadelBcrypt"),
.product(name: "NIOSSH", package: "swift-nio-ssh"),
.product(name: "NIOSSH", package: "Joannis-swift-nio-ssh"),
.product(name: "Crypto", package: "swift-crypto"),
.product(name: "_CryptoExtras", package: "swift-crypto"),
.product(name: "BigInt", package: "BigInt"),
Expand All @@ -46,7 +45,7 @@ let package = Package(
name: "CitadelTests",
dependencies: [
"Citadel",
.product(name: "NIOSSH", package: "swift-nio-ssh"),
.product(name: "NIOSSH", package: "Joannis-swift-nio-ssh"),
.product(name: "BigInt", package: "BigInt"),
.product(name: "Logging", package: "swift-log"),
]
Expand Down
58 changes: 57 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,63 @@ let settings = SSHClientSettings(
let client = try await SSHClient.connect(to: settings)
```

### Authentication Methods

Citadel supports multiple authentication methods:

#### Password Authentication

```swift
let settings = SSHClientSettings(
host: "example.com",
authenticationMethod: { .passwordBased(username: "user", password: "pass") },
hostKeyValidator: .acceptAnything()
)
```

#### Public Key Authentication

```swift
let privateKey = try Curve25519.Signing.PrivateKey(
rawRepresentation: privateKeyData
)
let settings = SSHClientSettings(
host: "example.com",
authenticationMethod: { .ed25519(username: "user", privateKey: privateKey) },
hostKeyValidator: .acceptAnything()
)
```

#### Certificate Authentication

Citadel supports SSH certificate authentication for enhanced security:

```swift
// Load private key and certificate
let privateKey = try Curve25519.Signing.PrivateKey(
rawRepresentation: privateKeyData
)
let certificate = try Ed25519.CertificatePublicKey(
certificateData: certificateData
)

// Use certificate authentication
let settings = SSHClientSettings(
host: "example.com",
authenticationMethod: {
.ed25519Certificate(username: "user", privateKey: privateKey, certificate: certificate)
},
hostKeyValidator: .acceptAnything()
)
```

Supported certificate types:
- ✅ Ed25519 certificates (full authentication support)
- ✅ RSA certificates (parsing only, no NIOSSH authentication support)
- ✅ ECDSA certificates (P256, P384, P521 - full authentication support)

For more details on certificate authentication, see the [Certificate Authentication Documentation](Documentation/CertificateAuthentication.md).

Using that client, we support a couple types of operations:

### Executing Commands
Expand Down Expand Up @@ -323,7 +380,6 @@ When you implement SFTP in Citadel, you're responsible for taking care of logist
## Helpers

The most important helper most people need is OpenSSH key parsing. We support extensions on PrivateKey types such as our own `Insecure.RSA.PrivateKey`, as well as existing SwiftCrypto types like `Curve25519.Signing.PrivateKey`:

```swift
// Parse an OpenSSH RSA private key. This is the same format as the one used by OpenSSH
let sshFile = try String(contentsOf: ..)
Expand Down
Loading