Skip to content

Instantly share code, notes, and snippets.

View klali's full-sized avatar

Klas Lindfors klali

  • Yubico
  • Stockholm, Sweden
View GitHub Profile
@klali
klali / convert.c
Last active May 10, 2022 10:59
Convert a 7 byte Mifare UID to access control system formats (RCO, ESMI, RFIDeas and OnGuard)
/* Copyright (c) 2020 Yubico AB. */
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include <ctype.h>
/* This small program takes in a 7 byte NFC UID and converts to format
* needed for access control systems. This is implemented for the esmi,
* RCO, RFIDeas and OnGuard systems */
@klali
klali / ecconv.c
Last active February 26, 2018 18:02
add a namned group of secp521r1 to an ec key
#include <stdio.h>
#include <openssl/ec.h>
#include <openssl/pem.h>
int main(int argc, char **argv) {
if(argc != 2) {
printf("give key as arg\n");
exit(1);
}
@klali
klali / engine.py
Last active March 18, 2024 19:50
sample for using a yubihsm2 with python requests
try:
from OpenSSL._util import (
ffi as _ffi,
lib as O,
lib as S
)
pyopenssl = True
import sys
#include <u2f-host.h>
#include <stdio.h>
#include <stdlib.h>
int
main (int argc, char *argv[])
{
u2fh_devs *devs = NULL;
u2fh_cmdflags flags = 0;
diff --git a/util.h b/util.h
index 38526ef..2128d01 100644
--- a/util.h
+++ b/util.h
@@ -38,20 +38,16 @@
#include <stdint.h>
#include <pwd.h>
-#if defined(DEBUG_PAM)
-# if defined(HAVE_SECURITY__PAM_MACROS_H)

Keybase proof

I hereby claim:

  • I am klali on github.
  • I am klali (https://keybase.io/klali) on keybase.
  • I have a public key whose fingerprint is 0A3B 0262 BCA1 7053 07D5 FF06 BCA0 0FD4 B216 8C0A

To claim this, I am signing this object:

@klali
klali / gp_changekey
Last active August 29, 2015 13:56
Neo change management keys
mode_211
establish_context
card_connect
open_sc -security 3 -keyind 0 -keyver 0 -mac_key 404142434445464748494a4b4c4d4e4f -enc_key 404142434445464748494a4b4c4d4e4f -kek_key 404142434445464748494a4b4c4d4e4f
put_sc_key -keyver 0 -newkeyver 1 -mac_key 000102030405060708090a0b0c0d0e0f -enc_key 000102030405060708090a0b0c0d0e0f -kek_key 000102030405060708090a0b0c0d0e0f
card_disconnect
release_context
@klali
klali / oath-unlock-reprogram.sh
Created October 26, 2012 12:00
yubikey oath script
#!/bin/sh
# Copyright (c) 2012 Yubico AB. All rights reserved.
# Author: Simon Josefsson <simon@josefsson.org>.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright