Skip to content

Commit

Permalink
updated
Browse files Browse the repository at this point in the history
  • Loading branch information
popwarfour committed Jul 30, 2017
1 parent b9de260 commit 51d4ee0
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
Binary file modified .DS_Store
Binary file not shown.
12 changes: 12 additions & 0 deletions Package.pins
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"autoPin": true,
"pins": [
{
"package": "CryptoSwift",
"reason": null,
"repositoryURL": "https://github.com/krzyzanowskim/CryptoSwift",
"version": "0.6.9"
}
],
"version": 1
}
7 changes: 3 additions & 4 deletions Sources/JWT.swift
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,7 @@ public enum Algorithm: CustomStringConvertible {

func signRS(_ key: Data, digestType: Signature.DigestType) throws -> String {

let keyString = message.data(using: String.Encoding.utf8, allowLossyConversion: false)!
let privateKey = try PrivateKey(pemEncoded: keyString)
let privateKey = try PrivateKey(data: data)

let clear = try ClearMessage(string: message, using: .utf8)

Expand All @@ -85,10 +84,10 @@ public enum Algorithm: CustomStringConvertible {
return signHS(key, variant: .sha512)

case .rs256(let key):
return try signRS(privateKey, digestType: .sha256)
return try signRS(key, digestType: .sha256)

case .rs512(let key):
return try signRS(privateKey, digestType: .sha512)
return try signRS(key, digestType: .sha512)

}
}
Expand Down

0 comments on commit 51d4ee0

Please sign in to comment.