Skip to content

Instantly share code, notes, and snippets.

View Anass-ABEA's full-sized avatar
🎯
Focusing

WhiteBatCodes Anass-ABEA

🎯
Focusing
View GitHub Profile
@Anass-ABEA
Anass-ABEA / RSA.java
Created July 25, 2021 00:33
RSA Decryption Client
import com.squareup.okhttp.OkHttpClient;
import com.squareup.okhttp.Request;
import com.squareup.okhttp.Response;
import javax.crypto.Cipher;
import java.security.*;
import java.security.spec.PKCS8EncodedKeySpec;
import java.security.spec.X509EncodedKeySpec;
import java.util.Base64;
@Anass-ABEA
Anass-ABEA / ApplicationController.java
Created July 25, 2021 00:34
RSA Server Controller ( Encryption )
package com.thexcoders.RSA_server.controllers;
import com.thexcoders.RSA_server.EncryptionManager;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class ApplicationController {
@GetMapping("getSecretMessage")
@Anass-ABEA
Anass-ABEA / EncryptionManager.java
Created July 25, 2021 00:35
RSA Encryption Manager from a String public key
package com.thexcoders.RSA_server;
import javax.crypto.Cipher;
import java.security.KeyFactory;
import java.security.PublicKey;
import java.security.spec.X509EncodedKeySpec;
import java.util.Base64;
public class EncryptionManager {
private PublicKey publicKey;
import React, {useEffect} from 'react';
import {useState} from "react";
import SideBar from "../../components/sideBar/SideBar";
import FactureBody from "./FactureBody";
import './facture.css'
import axios from "axios";
import {JwtHelper} from "../../helperClasses/jwtHelper";
import {loadFacturesService} from "../../services/FactureServices";
import javax.crypto.Cipher;
import javax.crypto.KeyGenerator;
import javax.crypto.SecretKey;
import javax.crypto.spec.GCMParameterSpec;
import javax.crypto.spec.SecretKeySpec;
import java.util.Base64;
/**
* Possible KEY_SIZE values are 128, 192 and 256
* Possible T_LEN values are 128, 120, 112, 104 and 96
@Anass-ABEA
Anass-ABEA / Server.java
Last active August 26, 2021 21:26
Server or AES Encryption
import javax.crypto.Cipher;
import javax.crypto.KeyGenerator;
import javax.crypto.SecretKey;
import javax.crypto.spec.GCMParameterSpec;
import javax.crypto.spec.SecretKeySpec;
import java.util.Base64;
/**
* Possible KEY_SIZE values are 128, 192 and 256
* Possible T_LEN values are 128, 120, 112, 104 and 96
@Anass-ABEA
Anass-ABEA / Client.java
Last active August 26, 2021 21:29
Client for the AES application
import javax.crypto.Cipher;
import javax.crypto.KeyGenerator;
import javax.crypto.SecretKey;
import javax.crypto.spec.GCMParameterSpec;
import javax.crypto.spec.SecretKeySpec;
import java.util.Base64;
/**
* Possible KEY_SIZE values are 128, 192 and 256
* Possible T_LEN values are 128, 120, 112, 104 and 96
import javax.crypto.Cipher;
import javax.crypto.KeyGenerator;
import javax.crypto.SecretKey;
import javax.crypto.spec.GCMParameterSpec;
import javax.crypto.spec.SecretKeySpec;
import java.util.Base64;
/**
* Possible KEY_SIZE values are 128, 192 and 256
* Possible T_LEN values are 128, 120, 112, 104 and 96
import sqlite3
conn = sqlite3.connect("database.db")
curs = conn.cursor()
curs.execute("CREATE TABLE users(id INTEGER PRIMARY KEY, login TEXT, password TEXT, nom TEXT,prenom TEXT, type INTEGER, spes INTEGER, prix INTEGER, max Integer)")
curs.execute("CREATE TABLE appoitnments(id INTEGER PRIMARY KEY, id_med INTEGER, id_pat INTEGER, date_app DATE, state INTEGER, motif TEXT)")
res = curs.execute("INSERT INTO users values (1,'m','password', 'Amine', 'Alami',0,0,300, 10)")
res = curs.execute("INSERT INTO users values (2,'m1','password', 'Yousef', 'Alami',0,1,310, 10)")
res = curs.execute("INSERT INTO users values (3,'m2','password', 'Ibrahim', 'Alami',0,2,330, 10)")
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.mytodo">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"