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:27
RSA encryption/Decryption with a specific public/private Key.
import javax.crypto.Cipher;
import java.security.*;
import java.security.spec.PKCS8EncodedKeySpec;
import java.security.spec.X509EncodedKeySpec;
import java.util.Base64;
/**
* @author Anass AIT BEN EL ARBI
* <ul>
* <li>AES/CBC/NoPadding (128)</li>
@Anass-ABEA
Anass-ABEA / Client.java
Last active April 14, 2024 21:58
Java Sockets #2 : Simplified Client/Server Application - Multiple connections
package net.sockets.simplified;
import java.io.DataOutputStream;
import java.io.IOException;
import java.net.Socket;
import java.util.Scanner;
public class Client {
private Socket socket;
@Anass-ABEA
Anass-ABEA / Client.java
Last active April 2, 2024 11:35
Java Sockets #1 : Simplified Client/Server Application
package net.sockets.simplified;
import java.io.DataOutputStream;
import java.io.IOException;
import java.net.Socket;
import java.util.Scanner;
public class Client {
private Socket socket;
@Anass-ABEA
Anass-ABEA / AES.java
Last active September 20, 2023 05:54
AES ENCRYPTION
import javax.crypto.Cipher;
import javax.crypto.KeyGenerator;
import javax.crypto.SecretKey;
import javax.crypto.spec.GCMParameterSpec;
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
Created September 11, 2022 14:54
Java Sockets #3 : Simplified Client/Server Application - Sending files from server to client
package myjava.sockets.filetransfert;
import java.io.BufferedInputStream;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.net.Socket;
import java.net.UnknownHostException;
import java.util.Scanner;
import java.io.IOException;
import java.io.PrintWriter;
import java.net.Socket;
public class Client {
private Socket socket;
public void init() throws Exception{
import javax.crypto.Cipher;
import javax.crypto.KeyGenerator;
import javax.crypto.SecretKey;
import javax.crypto.spec.IvParameterSpec;
/**
* DES/CBC/NoPadding (56)
* DES/CBC/PKCS5Padding (56) *
* DES/ECB/NoPadding (56)
* DES/ECB/PKCS5Padding (56) *
import javax.crypto.Cipher;
import javax.crypto.KeyGenerator;
import javax.crypto.SecretKey;
import javax.crypto.spec.IvParameterSpec;
/**
* DES/CBC/NoPadding (56)
* DES/CBC/PKCS5Padding (56) *
* DES/ECB/NoPadding (56)
* DES/ECB/PKCS5Padding (56) *
public class MainActivity extends AppCompatActivity{
protected ServiceMusique service;
private boolean connected;
private final ServiceConnection conn = new ServiceConnection() {
@Override
public void onServiceConnected(ComponentName componentName, IBinder iBinder) {
Toast.makeText(getApplicationContext(), "connected To service", Toast.LENGTH_SHORT).show();
ServiceMusique.MyBinder binder = (ServiceMusique.MyBinder) iBinder;
service = binder.service;
@Anass-ABEA
Anass-ABEA / POM.xml
Last active December 11, 2021 18:22
Fichiers modifiés pendants les tests fonctionnels Selenium
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.springframework.samples</groupId>
<artifactId>spring-petclinic</artifactId>
<version>2.5.0-SNAPSHOT</version>
<parent>