-
Notifications
You must be signed in to change notification settings - Fork 9
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 #211 from dajiaji/separate-prim-from-dhkem-class
Separate dhkemPrimitives from dhkem classes.
- Loading branch information
Showing
12 changed files
with
113 additions
and
109 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
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,18 @@ | ||
import { KemId } from "../identifiers.ts"; | ||
import { HkdfSha256 } from "../kdfs/hkdf.ts"; | ||
import { Dhkem } from "./dhkem.ts"; | ||
import { Ec } from "./dhkemPrimitives/ec.ts"; | ||
|
||
export class DhkemP256HkdfSha256 extends Dhkem { | ||
public readonly id: KemId = KemId.DhkemP256HkdfSha256; | ||
public readonly secretSize: number = 32; | ||
public readonly encSize: number = 65; | ||
public readonly publicKeySize: number = 65; | ||
public readonly privateKeySize: number = 32; | ||
|
||
constructor() { | ||
const kdf = new HkdfSha256(); | ||
const prim = new Ec(KemId.DhkemP256HkdfSha256, kdf); | ||
super(prim, kdf); | ||
} | ||
} |
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,18 @@ | ||
import { KemId } from "../identifiers.ts"; | ||
import { HkdfSha384 } from "../kdfs/hkdf.ts"; | ||
import { Dhkem } from "./dhkem.ts"; | ||
import { Ec } from "./dhkemPrimitives/ec.ts"; | ||
|
||
export class DhkemP384HkdfSha384 extends Dhkem { | ||
public readonly id: KemId = KemId.DhkemP384HkdfSha384; | ||
public readonly secretSize: number = 48; | ||
public readonly encSize: number = 97; | ||
public readonly publicKeySize: number = 97; | ||
public readonly privateKeySize: number = 48; | ||
|
||
constructor() { | ||
const kdf = new HkdfSha384(); | ||
const prim = new Ec(KemId.DhkemP384HkdfSha384, kdf); | ||
super(prim, kdf); | ||
} | ||
} |
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,18 @@ | ||
import { KemId } from "../identifiers.ts"; | ||
import { HkdfSha512 } from "../kdfs/hkdf.ts"; | ||
import { Dhkem } from "./dhkem.ts"; | ||
import { Ec } from "./dhkemPrimitives/ec.ts"; | ||
|
||
export class DhkemP521HkdfSha512 extends Dhkem { | ||
public readonly id: KemId = KemId.DhkemP521HkdfSha512; | ||
public readonly secretSize: number = 64; | ||
public readonly encSize: number = 133; | ||
public readonly publicKeySize: number = 133; | ||
public readonly privateKeySize: number = 64; | ||
|
||
constructor() { | ||
const kdf = new HkdfSha512(); | ||
const prim = new Ec(KemId.DhkemP521HkdfSha512, kdf); | ||
super(prim, kdf); | ||
} | ||
} |
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
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,18 @@ | ||
import { KemId } from "../identifiers.ts"; | ||
import { HkdfSha256 } from "../kdfs/hkdf.ts"; | ||
import { Dhkem } from "./dhkem.ts"; | ||
import { X25519 } from "./dhkemPrimitives/x25519.ts"; | ||
|
||
export class DhkemX25519HkdfSha256 extends Dhkem { | ||
public readonly id: KemId = KemId.DhkemX25519HkdfSha256; | ||
public readonly secretSize: number = 32; | ||
public readonly encSize: number = 32; | ||
public readonly publicKeySize: number = 32; | ||
public readonly privateKeySize: number = 32; | ||
|
||
constructor() { | ||
const kdf = new HkdfSha256(); | ||
const prim = new X25519(kdf); | ||
super(prim, kdf); | ||
} | ||
} |
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,18 @@ | ||
import { KemId } from "../identifiers.ts"; | ||
import { HkdfSha512 } from "../kdfs/hkdf.ts"; | ||
import { Dhkem } from "./dhkem.ts"; | ||
import { X448 } from "./dhkemPrimitives/x448.ts"; | ||
|
||
export class DhkemX448HkdfSha512 extends Dhkem { | ||
public readonly id: KemId = KemId.DhkemX448HkdfSha512; | ||
public readonly secretSize: number = 64; | ||
public readonly encSize: number = 56; | ||
public readonly publicKeySize: number = 56; | ||
public readonly privateKeySize: number = 56; | ||
|
||
constructor() { | ||
const kdf = new HkdfSha512(); | ||
const prim = new X448(kdf); | ||
super(prim, kdf); | ||
} | ||
} |
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