Skip to content

Instantly share code, notes, and snippets.

Antonio Sanso asanso

Block or report user

Report or block asanso

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View aes-gcm-webcrypto.html
<script>
window.crypto.subtle.generateKey(
{
name: "AES-GCM",
length: 256, //can be 128, 192, or 256
},
false, //whether the key is extractable (i.e. can be used in exportKey)
["encrypt", "decrypt"] //can "encrypt", "decrypt", "wrapKey", or "unwrapKey"
)
.then(function(key){
View dh-recover.js
function recover(privateKey) {
console.log("recover");
const MALICIOUS_PRIME = new Uint8Array([129,0,0,0,0,0,0,0,0,0,0,0,0,0,0,17]);
// this generator has order 5
const MALICIOUS_GENERATOR = new Uint8Array([46,35,147,92,93,21,176,170,70,144,93,164,112,85,178,126]);
privateKey.algorithm.generator = MALICIOUS_GENERATOR;
privateKey.algorithm.prime = MALICIOUS_PRIME;
window.crypto.subtle.generateKey(
{
View dh-derivebits.js
/*
* Arguments:
* priv: CryptoKey representing a DH private key
* pub: CryptoKey representing a DH public key
*
* Returns: Promise resolving to ArrayBuffer
*/
async function secret(priv, pub) {
return await window.crypto.subtle.deriveBits(
{
View dh-keypair.js
/*
* Arguments: None
*
* Returns: Promise resolving to:
* {
* privateKey: CryptoKey,
* publicKey: CryptoKey,
* }
*/
View aes-gcm-webcrypto.js
//https://github.com/diafygi/webcrypto-examples
window.crypto.subtle.encrypt(
{
name: "AES-GCM",
//Don't re-use initialization vectors!
//Always generate a new iv every time your encrypt!
//Recommended to use 12 bytes length
iv: window.crypto.getRandomValues(new Uint8Array(12)),
View recovery-codes.txt
cd0b2-ec8fc
d4ca7-cbb2f
cd0b2-ec8fc
dd8fd-a90f9
dfaf5-bfb21
aed4b-47351
d1950-f654a
b05b8-aa6af
fdff0-a95f4
d347b-eff1d
View Untitled1.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View node-jose.js
"use strict";
var forEach = require("lodash.foreach");
var chai = require("chai");
var JWE = require("../../lib/jwe"),
JWK = require("../../lib/jwk");
var assert = chai.assert;
View MSDBRG
package gist;
import java.math.BigInteger;
import java.security.SecureRandom;
public class MSDBRG {
private static BigInteger TWO = new BigInteger("2");
public static void main(String[] args) {
You can’t perform that action at this time.