Skip to content

Instantly share code, notes, and snippets.

@masonbedard
masonbedard / private_fork.md
Created June 25, 2020 21:05 — forked from 0xjac/private_fork.md
Create a private fork of a public repository

The repository for the assignment is public and Github does not allow the creation of private forks for public repositories.

The correct way of creating a private frok by duplicating the repo is documented here.

For this assignment the commands are:

  1. Create a bare clone of the repository. (This is temporary and will be removed so just do it wherever.)

git clone --bare [email protected]:usi-systems/easytrace.git

@masonbedard
masonbedard / gist:4d4e21ed94ecccc8ab16158cbb763e8e
Last active May 29, 2020 14:33
Making an iOS exported public key compatible with Android (270 bytes -> 294 bytes)
A public key that is contained in the iOS keychain can be exported via something like SecKeyCopyExternalRepresentation(secKey, cferrorPtr).
But the returned CFData does not contain the OID and ASN.1 headers that Android/Java is expecting when it wants to import a public key.
The CFData is originally 270 bytes of data and needs 24 bytes of header to make it compatible.
A solution for this in Objective-C resides at: <https://blog.wingsofhermes.org/?p=42>.
I needed it in Swift so I translated it. It has not been tested extensively but I have successfully imported the resulting public key data into an Android app.
// implementation
func encodeLength(buf: inout [UInt8], length: size_t) -> size_t {
if length < 128 {