File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -46,6 +46,7 @@ public enum Algorithm: CustomStringConvertible {
46
46
47
47
func signHS( _ key: Data , variant: CryptoSwift . HMAC . Variant ) -> String {
48
48
let messageData = message. data ( using: String . Encoding. utf8, allowLossyConversion: false ) !
49
+
49
50
let mac = HMAC ( key: key. bytes, variant: variant)
50
51
let result : [ UInt8 ]
51
52
do {
@@ -58,7 +59,7 @@ public enum Algorithm: CustomStringConvertible {
58
59
59
60
func signRS( _ key: Data , digestType: Signature . DigestType ) throws -> String {
60
61
61
- let keyString = String . init ( data: key , encoding : . utf8 )
62
+ let keyString = message . data ( using : String . Encoding . utf8 , allowLossyConversion : false ) !
62
63
let privateKey = try PrivateKey ( pemEncoded: keyString)
63
64
64
65
let clear = try ClearMessage ( string: message, using: . utf8)
@@ -85,7 +86,7 @@ public enum Algorithm: CustomStringConvertible {
85
86
86
87
case . rs256( let key) :
87
88
return try signRS ( privateKey, digestType: . sha256)
88
-
89
+
89
90
case . rs512( let key) :
90
91
return try signRS ( privateKey, digestType: . sha512)
91
92
You can’t perform that action at this time.
0 commit comments