-
-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #99 from vapor/jwt-kit
JWTKit
- Loading branch information
Showing
32 changed files
with
986 additions
and
484 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,4 +5,5 @@ Packages | |
Package.pins | ||
Package.resolved | ||
DerivedData | ||
.swiftpm | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,23 @@ | ||
// swift-tools-version:4.0 | ||
// swift-tools-version:5.0 | ||
import PackageDescription | ||
|
||
let package = Package( | ||
name: "JWT", | ||
name: "jwt-kit", | ||
products: [ | ||
.library(name: "JWT", targets: ["JWT"]), | ||
], | ||
dependencies: [ | ||
// 🌎 Utility package containing tools for byte manipulation, Codable, OS APIs, and debugging. | ||
.package(url: "https://github.com/vapor/core.git", from: "3.0.0"), | ||
|
||
// 🔑 Hashing (BCrypt, SHA, HMAC, etc), encryption, and randomness. | ||
.package(url: "https://github.com/vapor/crypto.git", from: "3.0.0"), | ||
.library(name: "JWTKit", targets: ["JWTKit"]), | ||
], | ||
dependencies: [ ], | ||
targets: [ | ||
.target(name: "JWT", dependencies: ["Core", "Crypto"]), | ||
.testTarget(name: "JWTTests", dependencies: ["JWT"]), | ||
.systemLibrary( | ||
name: "CJWTKitOpenSSL", | ||
pkgConfig: "openssl", | ||
providers: [ | ||
.apt(["openssl libssl-dev"]), | ||
.brew(["openssl"]) | ||
] | ||
), | ||
.target(name: "CJWTKitCrypto", dependencies: ["CJWTKitOpenSSL"]), | ||
.target(name: "JWTKit", dependencies: ["CJWTKitCrypto"]), | ||
.testTarget(name: "JWTKitTests", dependencies: ["JWTKit"]), | ||
] | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#include "include/c_jwtkit_crypto.h" | ||
|
||
#if (OPENSSL_VERSION_NUMBER < 0x10100000L) || defined(LIBRESSL_VERSION_NUMBER) | ||
EVP_MD_CTX *EVP_MD_CTX_new(void) { | ||
return EVP_MD_CTX_create(); | ||
}; | ||
|
||
void EVP_MD_CTX_free(EVP_MD_CTX *ctx) { | ||
EVP_MD_CTX_cleanup(ctx); | ||
free(ctx); | ||
}; | ||
|
||
int RSA_set0_key(RSA *r, BIGNUM *n, BIGNUM *e, BIGNUM *d) { | ||
r->n = n; | ||
r->e = e; | ||
r->d = d; | ||
return 0; | ||
}; | ||
|
||
HMAC_CTX *HMAC_CTX_new(void) { | ||
HMAC_CTX *ptr = malloc(sizeof(HMAC_CTX)); | ||
HMAC_CTX_init(ptr); | ||
return ptr; | ||
}; | ||
|
||
void HMAC_CTX_free(HMAC_CTX *ctx) { | ||
HMAC_CTX_cleanup(ctx); | ||
free(ctx); | ||
}; | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#ifndef C_JWTKIT_OPENSSL_H | ||
#define C_JWTKIT_OPENSSL_H | ||
|
||
#include <openssl/conf.h> | ||
#include <openssl/evp.h> | ||
#include <openssl/err.h> | ||
#include <openssl/bio.h> | ||
#include <openssl/ssl.h> | ||
#include <openssl/sha.h> | ||
#include <openssl/md5.h> | ||
#include <openssl/hmac.h> | ||
#include <openssl/rand.h> | ||
#include <openssl/rsa.h> | ||
#include <openssl/pkcs12.h> | ||
#include <openssl/x509v3.h> | ||
|
||
#if (OPENSSL_VERSION_NUMBER < 0x10100000L) || defined(LIBRESSL_VERSION_NUMBER) | ||
EVP_MD_CTX *EVP_MD_CTX_new(void); | ||
void EVP_MD_CTX_free(EVP_MD_CTX *ctx); | ||
int RSA_set0_key(RSA *r, BIGNUM *n, BIGNUM *e, BIGNUM *d); | ||
HMAC_CTX *HMAC_CTX_new(void); | ||
void HMAC_CTX_free(HMAC_CTX *ctx); | ||
#endif | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
module CJWTKitOpenSSL [system] { | ||
link "ssl" | ||
link "crypto" | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.