Skip to content

Commit

Permalink
Dinge
Browse files Browse the repository at this point in the history
  • Loading branch information
Felefix201 committed Apr 7, 2024
1 parent 0c2acab commit c67cbde
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 10 deletions.
6 changes: 3 additions & 3 deletions GUI/src/app/app-routing.module.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {NgModule} from "@angular/core";
import {RouterModule, Routes} from "@angular/router";
import {StartseiteComponent} from "./homepage/startseite.component";
import {HomepageComponent} from "./homepage/homepage.component";
import {ExponentiationComponent} from "./exponentiation/exponentiation.component";
import {ExtendedGcdComponent} from "./extendedgcd/extended-gcd.component";
import {ShanksComponent} from "./shanks/shanks.component";
Expand All @@ -15,7 +15,7 @@ import {RsaComponent} from "./rsa/rsa.component";
* The routing takes place in navbar.component.html and homepage.html
*/
export const routes: Routes = [
{path: "homepage", component: StartseiteComponent},
{path: "homepage", component: HomepageComponent},
{path: "client/:client", component: ClientComponent},
{path: "menezesVanstone", component: MenezesVanstoneComponent},
{path: "rsa", component: RsaComponent},
Expand All @@ -25,7 +25,7 @@ export const routes: Routes = [
{path: "modularInverse", component: ModularInverseComponent},
{path: `multiplication`, component: MultiplicationComponent},
{path: "", redirectTo: "/homepage", pathMatch: "full"},
{path: "**", component: StartseiteComponent}
{path: "**", component: HomepageComponent}
];

@NgModule({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ import {StateManagementService} from "../services/management/state-management.se
RouterLink,
RouterLinkActive
],
templateUrl: "./startseite.component.html",
styleUrl: "./startseite.component.scss"
templateUrl: "./homepage.component.html",
styleUrl: "./homepage.component.scss"
})
/**
* Komponente für die Darstellung der Startseite inklusive der Konfigurationsmöglichkeiten.
*/
export class StartseiteComponent implements OnInit {
export class HomepageComponent implements OnInit {

constructor(
private stateService: StateManagementService,
Expand Down
7 changes: 6 additions & 1 deletion GUI/src/app/menezes-vanstone/menezes-vanstone.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {
MvEncryptRequest, MvKeyPair,
} from "../models/mv-beans";
import {ClientData} from "../models/client";
import {StateManagementService} from "../services/management/state-management.service";

@Component({
selector: "app-menezes-vanstone",
Expand Down Expand Up @@ -55,6 +56,8 @@ export class MenezesVanstoneComponent {
public millerRabinIterations: number = 100;
public coefficientA: number = 5;

private configurationData = this.stateService.getConfigurationData();

public clients: ClientData[] =
[
{
Expand Down Expand Up @@ -91,7 +94,9 @@ export class MenezesVanstoneComponent {
}
];

constructor(private backendRequestService: MvBackendRequestService) {
constructor(
private stateService: StateManagementService,
private backendRequestService: MvBackendRequestService) {
}

public generateKeys(client: string) {
Expand Down
24 changes: 24 additions & 0 deletions GUI/src/app/models/menezes-vanstone-configuration-data.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/**
* This class represents the configuration data for the Menezes-Vanstone cryptosystem.
*/
export class RsaConfigurationData {
modulus_width: number;
miller_rabin_rounds: number;
random_seed: number;
number_system_base: number;

constructor(modulus_width: number,
miller_rabin_rounds: number,
random_seed: number,
number_system_base: number) {
this.modulus_width = modulus_width;
this.miller_rabin_rounds = miller_rabin_rounds;
this.random_seed = random_seed;
this.number_system_base = number_system_base;
}

public static createDefaultConfigurationDataForRSA(): RsaConfigurationData {
return new RsaConfigurationData(1024, 10, 13, 55296);
}
}

2 changes: 1 addition & 1 deletion GUI/src/app/models/rsa-configuration-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export class RsaConfigurationData {
this.number_system_base = number_system_base;
}

public static createDefaultConfigurationData(): RsaConfigurationData {
public static createDefaultConfigurationDataForRSA(): RsaConfigurationData {
return new RsaConfigurationData(1024, 10, 13, 55296);
}
}
Expand Down
4 changes: 2 additions & 2 deletions GUI/src/app/services/management/state-management.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export class StateManagementService {

private server_url = signal("https://krypto-server.tristan-hoermann.de");

private configurationData = signal(RsaConfigurationData.createDefaultConfigurationData());
private configurationDataRSA = signal(RsaConfigurationData.createDefaultConfigurationDataForRSA());

private clientKeyMap = new Map<Client, WritableSignal<RsaKeyPair>>();

Expand Down Expand Up @@ -89,7 +89,7 @@ export class StateManagementService {
* Gibt die Konfigurationsdaten zurück.
*/
public getConfigurationData() {
return this.configurationData;
return this.configurationDataRSA;
}

public getClientKey(client: Client): WritableSignal<RsaKeyPair> {
Expand Down

0 comments on commit c67cbde

Please sign in to comment.