Skip to content

Commit

Permalink
Merge branch 'master' of github.com:maxgoedjen/secretive
Browse files Browse the repository at this point in the history
  • Loading branch information
maxgoedjen committed Apr 2, 2020
2 parents 5b38ef0 + ccbf927 commit 9c60a0b
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions SecretAgentKit/Agent.swift
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,17 @@ extension Agent {


let rawLength = rawRepresentation.count/2
let r = rawRepresentation[0..<rawLength]
let s = rawRepresentation[rawLength...]
// Check if we need to pad with 0x00 to prevent certain
// ssh servers from thinking r or s is negative
let paddingRange: ClosedRange<UInt8> = 0x80...0xFF
var r = Data(rawRepresentation[0..<rawLength])
if paddingRange ~= r.first! {
r.insert(0x00, at: 0)
}
var s = Data(rawRepresentation[rawLength...])
if paddingRange ~= s.first! {
s.insert(0x00, at: 0)
}

var signatureChunk = Data()
signatureChunk.append(writer.lengthAndData(of: r))
Expand Down

0 comments on commit 9c60a0b

Please sign in to comment.