From 85f4c44d69c1a5a9ec71c64c9b0a6f92bfefb7e4 Mon Sep 17 00:00:00 2001 From: Linus Nordberg Date: Tue, 19 Jan 2016 17:22:26 +0100 Subject: Add compatibility layer for digging around in non-public data structures. --- src/plop_compat.erl | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 src/plop_compat.erl (limited to 'src/plop_compat.erl') diff --git a/src/plop_compat.erl b/src/plop_compat.erl new file mode 100644 index 0000000..d9f3620 --- /dev/null +++ b/src/plop_compat.erl @@ -0,0 +1,15 @@ +-module(plop_compat). +-export([unpack_spki/1]). +-include_lib("public_key/include/public_key.hrl"). + +unpack_spki(SPKI) -> + unpack_spki(erlang:system_info(otp_release), SPKI). + +unpack_spki("17", SPKI) -> + #'SubjectPublicKeyInfo'{subjectPublicKey = {_, Octets}, + algorithm = Algorithm} = SPKI, + {Octets, Algorithm}; +unpack_spki("18", SPKI) -> + #'SubjectPublicKeyInfo'{subjectPublicKey = Octets, + algorithm = Algorithm} = SPKI, + {Octets, Algorithm}. -- cgit v1.1