This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Expanse an AES-128 key to 16 round keys | |
| import sys | |
| # AES S-Box | |
| s_box = [ | |
| 0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76, | |
| 0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0, 0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0, | |
| 0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc, 0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8, 0x31, 0x15, | |
| 0x04, 0xc7, 0x23, 0xc3, 0x18, 0x96, 0x05, 0x9a, 0x07, 0x12, 0x80, 0xe2, 0xeb, 0x27, 0xb2, 0x75, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package de.tsenger.kasper.decoder; | |
| import org.spongycastle.asn1.ASN1GeneralizedTime; | |
| import org.spongycastle.asn1.ASN1Integer; | |
| import org.spongycastle.asn1.ASN1ObjectIdentifier; | |
| import org.spongycastle.asn1.ASN1UTCTime; | |
| import org.spongycastle.asn1.DEROctetString; | |
| import org.spongycastle.asn1.DERPrintableString; | |
| import org.spongycastle.asn1.DERSequence; | |
| import org.spongycastle.asn1.DERTaggedObject; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #Convert CardDav contacts to GrandStream DP720 / DP750 XML phonebook | |
| import vobject | |
| vcf_path = "./contacts.vcf" | |
| xml_path = './xml_contacts.xml' | |
| # phone number: CardDav to Grandstream | |
| map_number_types = { | |
| "work": "Work", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # How to use "acme.sh" to set up Lets Encrypt without root permissions | |
| # See https://github.com/Neilpang/acme.sh for more | |
| # This assumes that your website has a webroot at "/var/www/<domain>" | |
| # I'll use the domain "EXAMPLE.com" as an example | |
| # When this is done, there will be an "acme" user that handles issuing, | |
| # updating, and installing certificates. This account will have the following | |
| # (fairly minimal) permissions: | |
| # - Host files at http://EXAMPLE.com/.well-known/acme-challenge |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private short computeHmacSha256(byte[] key, short key_offset, short key_length, | |
| byte[] message, short message_offset, short message_length, | |
| byte[] mac, short mac_offset){ | |
| short BLOCKSIZE=64; | |
| short HASHSIZE=32; | |
| // compute inner hash | |
| for (short i=0; i<key_length; i++){ | |
| hmacBuffer[i]= (byte) (key[(short)(key_offset+i)] ^ (0x36)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package de.tsenger.sandbox; | |
| import java.io.ByteArrayOutputStream; | |
| import java.io.IOException; | |
| import javax.smartcardio.Card; | |
| import javax.smartcardio.CardException; | |
| import javax.smartcardio.CardTerminal; | |
| import javax.smartcardio.TerminalFactory; |