diff options
author | Linus Nordberg <linus@nordu.net> | 2016-01-19 17:22:26 +0100 |
---|---|---|
committer | Linus Nordberg <linus@nordu.net> | 2016-01-19 17:22:26 +0100 |
commit | b0371b26d2b4d314b427c55296c96323cacc7a81 (patch) | |
tree | a6d9b8590532ecda60b03350576b359588a344ab /src/plop_compat.erl | |
parent | 7081864b2fcce8713b9441d388b3be617309426a (diff) |
Add compatibility layer for digging around in non-public data structures.
Diffstat (limited to 'src/plop_compat.erl')
-rw-r--r-- | src/plop_compat.erl | 15 |
1 files changed, 15 insertions, 0 deletions
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}. |