diff --git a/src/app/features/administration/form/date-select/date-select.component.scss b/src/app/features/administration/form/date-select/date-select.component.scss index 079527fa..e1f049d0 100644 --- a/src/app/features/administration/form/date-select/date-select.component.scss +++ b/src/app/features/administration/form/date-select/date-select.component.scss @@ -17,11 +17,6 @@ .btn + .btn { margin-left: 1em; } - .is-boxed { - border: 1px solid #ddd; - padding: 1em; - margin: 1em 0; - } .cdk-drag-preview { box-sizing: border-box; diff --git a/src/app/features/shared/components/ui/static-pages/ciphering/ciphering.component.html b/src/app/features/shared/components/ui/static-pages/ciphering/ciphering.component.html index 8e2042d3..5dd96ba7 100644 --- a/src/app/features/shared/components/ui/static-pages/ciphering/ciphering.component.html +++ b/src/app/features/shared/components/ui/static-pages/ciphering/ciphering.component.html @@ -1,22 +1,69 @@

- Test de chiffrement + Essais de chiffrement pour un framadate zéro knoledge

-
- - texte clair -
- - salt -
- - pepper +
+
+
+

Chiffrement simple

+ + texte clair à convertir en truc indéchiffrable (à priori) -
- - texte chiffré +
+ simple ciphered. On assigne un numéro à chaque caractère, séparé par un tiret en sortie. + + + {{ simpleCipheredText }} + +
+

Avec un peu de sel?

+ + salt +
+ simple ciphered avec un sel. on ajoute le sel avant le texte puis on passe le tout dans la conversion + comme ci-dessus. + + + {{ simpleCipheredTextWithSalt }} + +
+
+
+
-
- - texte à déchiffrer +
+

Déchiffrement simple

+ + Collez ici le texte chiffré à convertir en truc lisible par l'opération + du saint esprit réalisée dans l'autre sens + +
+ simple texte déchiffré + + {{ simpleDeCipheredText }} + + simple texte déchiffré avec sel + + {{ simpleDeCipheredTextWithSalt }} + +
+ +
+

Chiffrement AES

+ + + + texte avancé à déchiffrer +
+ + salt + + initial_vector +
+ + key +
diff --git a/src/app/features/shared/components/ui/static-pages/ciphering/ciphering.component.scss b/src/app/features/shared/components/ui/static-pages/ciphering/ciphering.component.scss index e69de29b..fbf02e7f 100644 --- a/src/app/features/shared/components/ui/static-pages/ciphering/ciphering.component.scss +++ b/src/app/features/shared/components/ui/static-pages/ciphering/ciphering.component.scss @@ -0,0 +1,18 @@ +.boxed-shadow { + padding: 1em; + margin-bottom: 1em; +} + +.cipher-result { + border-radius: 3px; + background: #00003b; + color: #7d6c99; + padding: 0.5em; + margin-left: 1em; + display: block; + min-width: 10ch; + min-height: 2em; + max-width: 100%; + overflow: hidden; + line-height: 2em; +} diff --git a/src/app/features/shared/components/ui/static-pages/ciphering/ciphering.component.ts b/src/app/features/shared/components/ui/static-pages/ciphering/ciphering.component.ts index 70ee4d15..3c443ae1 100644 --- a/src/app/features/shared/components/ui/static-pages/ciphering/ciphering.component.ts +++ b/src/app/features/shared/components/ui/static-pages/ciphering/ciphering.component.ts @@ -11,13 +11,15 @@ import * as Crypto from 'crypto'; styleUrls: ['./ciphering.component.scss'], }) export class CipheringComponent implements OnInit { - public plainText = 'le texte à chiffrer, coucou !'; - public cipheredText = ''; + // public plainText = 'le texte à chiffrer, coucou !'; + public plainText = 'salut les pipole'; + public cipheredText = + '121-127-42-110-127-42-122-121-115-128-124-111-125-107-118-127-126-42-118-111-125-42-122-115-122-121-118-111'; algorithm = 'aes-192-cbc'; - // public salt = Crypto.randomBytes(16); - // public initial_vector = Crypto.randomBytes(16); + public salt = 'ou du poivre'; + public initial_vector = ''; public key; - public otherCipheredText: any; + public otherCipheredText = 'le texte à chiffrer, coucou !'; constructor() {} @@ -25,6 +27,21 @@ export class CipheringComponent implements OnInit { this.encrypt(this.plainText); } + // ---------------------- make unreadable ---------------------- + get simpleCipheredText() { + return this.convertTextToInt(this.plainText); + } + get simpleCipheredTextWithSalt() { + return this.convertTextToInt(this.salt + this.plainText); + } + // ---------------------- make readable ---------------------- + get simpleDeCipheredText() { + return this.convertIntToText(this.cipheredText); + } + get simpleDeCipheredTextWithSalt() { + return this.convertIntToText(this.salt + this.cipheredText); + } + // ---------------------- conversions ---------------------- encrypt(someText) { // this.key = Crypto.scryptSync(someText, 'salt', 24); // this.initial_vector = Crypto.randomBytes(16); @@ -40,6 +57,7 @@ export class CipheringComponent implements OnInit { // this.cipheredText = someText; // // outputs encrypted hex // console.log(this.cipheredText); + return someText; } decrypt(sometext) { @@ -53,14 +71,29 @@ export class CipheringComponent implements OnInit { // // decipher.write(sometext, 'hex'); // decipher.end(); + return sometext; } - convertTextToInt(someText) { - let output = ''; - - for (let i = 0; i < someText.length; i++) { - output += someText[i].charCodeAt(0); + convertTextToInt(value) { + let result = ''; + for (let i = 0; i < value.length; i++) { + if (i < value.length - 1) { + result += value.charCodeAt(i) + 10; + result += '-'; + } else { + result += value.charCodeAt(i) + 10; + } } - return output; + return result; + } + convertIntToText(value) { + let result = ''; + const array = value.split('-'); + + for (let i = 0; i < array.length; i++) { + result += String.fromCharCode(array[i] - 10); + } + // remove salt characters + return result.slice(this.salt.length); } }