README.md

# Signing HTTP Messages (HTTPSignature)

[![Build Status](https://travis-ci.org/potatosalad/erlang-http_signature.svg?branch=master)](https://travis-ci.org/potatosalad/erlang-http_signature) [![Hex.pm](https://img.shields.io/hexpm/v/http_signature.svg)](https://hex.pm/packages/http_signature)

HTTP Signature Scheme - Signing HTTP Messages for Erlang and Elixir based on [draft-cavage-http-signatures](https://tools.ietf.org/html/draft-cavage-http-signatures).

## Installation

If [using Hex](https://hex.pm/), the package can be installed
by adding `http_signature` to your list of dependencies in `mix.exs`:

```elixir
def deps do
  [{:http_signature, "~> 2.0.0"}]
end
```

If [using rebar3](http://www.rebar3.org/), the package can be installed by adding `http_signature ` to you list of dependencies in `rebar.config`:

```erlang
{deps, [
  {http_signature, "2.0.0"}
]}.
```

The [HexDocs](https://hexdocs.pm) can
be found at [https://hexdocs.pm/http_signature](https://hexdocs.pm/http_signature).

## Usage

### Sign and Verify

```elixir
key = :http_signature_key.decode_file("test_ecdsa256", "password")
# Sign
signer = :http_signature_signer.new(key, "ecdsa-sha256", [
  "(request-target)",
  "date"
])
request = :http_signature.sign(signer, :get, "/", %{})
%:http_signature_request{
  headers: %{
    "authorization" => "Signature algorithm=\"ecdsa-sha256\",headers=\"(request-target) date\",keyId=\"cb:7c:77:1e:af:64:27:f5:0b:76:a2:d5:5a:a8:45:ef\",signature=\"/2rbvv8Or8bm+XlPGujTiARWJ6ZEb1iJvJIvo8CMtiL9EtJzskX+C8aIdx0x7zt3RBEW5fN2jwMB3C9J59++pA==\"",
    "date" => "Mon, 09 Oct 2017 23:59:15 GMT"
  },
  method: "get",
  path: "/"
}

# Verify
verifier = :http_signature_verifier.new(key, ["ecdsa-sha256", "ecdsa-sha512"])
true = :http_signature.verify(verifier, :get, "/", request.headers)
```

### Key Generation

The following key generation types are available:

 * DSA — `{:dsa, num_bits}`
   * For example: `{:dsa, 1024}`
 * ECDSA — `{:ecdsa, named_curve_or_ec_parameters}`
   * For example:
     * `{:ecdsa, <<"nistp256">>}`
     * `{:ecdsa, <<"nistp384">>}`
     * `{:ecdsa, <<"nistp521">>}`
 * HMAC &mdash; `{:hmac, num_bytes}`
   * For example:
     * `{:hmac, 16}`
 * RSA &mdash; `{:rsa, modulus_size, exponent_size}` (`exponent_size` defaults to `65537`)
   * For example:
     * `{:rsa, 4096}`
     * `{:rsa, 4096, 65537}`

An existing `%:http_signature_key{}` struct can also be passed to `:http_signature_key.generate_key/1` and a new key of the same size, parameters, or curve will be generated.

_Elixir_

```elixir
iex> :http_signature_key.generate_key({:dsa, 1024})
%:http_signature_key{attributes: nil, id: nil, key: {:DSAPrivateKey, 0, 97202469206644971628615501625794273972720007065448563260237939125119935066783283187099215423135234564237045028934690396239699693712076089067494431586462385878734792451691200130931211075928837685643926875477708962420305255430564638782540970191759219359054629110897962886783351794272574863774768721338262076079, 928992002797264582469203428377851477613999986399, 75288491090612272394361735350598547281251246506680474729540542156717540865035934387613961787562902905670519362600501018986014205958158178378860816001883915323271285939936658305034286234798798831075525891854057150678841765758161477964584255913530148719293269555368747088665432030767653392692963982727666618141, 93214229442335468805520539895798289869026207672747059747716988446492435210129450696561709225242518890381914157382687983446159464620443902123707356178482838718686147124203836521464423359668541227904895763106077937704912753141857160567967965593804747503593353585108706894195864977115357995014417009940912022260, 751259874676424896059604264814569634620376855202}, module: :http_signature_dsa, public: false, shared: false}

iex> :http_signature_key.generate_key({:ecdsa, "nistp256"})
%:http_signature_key{attributes: nil, id: nil, key: {:ECPrivateKey, 1, <<129, 11, 58, 69, 15, 141, 147, 115, 140, 111, 61, 207, 146, 51, 188, 92, 164, 91, 55, 30, 76, 95, 211, 89, 254, 217, 163, 191, 136, 7, 238, 100>>, {:namedCurve, {1, 2, 840, 10045, 3, 1, 7}}, <<4, 198, 101, 87, 9, 207, 75, 136, 8, 47, 231, 39, 133, 250, 177, 247, 123, 204, 173, 204, 174, 99, 53, 134, 166, 233, 148, 93, 35, 75, 109, 184, 113, 231, 101, 80, 88, 66, 165, 160, 102, 83, 176, 29, 74, 201, 48, 53, 77, 86, 129, 178, 230, 65, 23, 57, 90, 81, 195, 131, 216, 123, 15, 46, 161>>}, module: :http_signature_ecdsa, public: false, shared: false}

iex> :http_signature_key.generate_key({:hmac, 16})
%:http_signature_key{attributes: nil, id: nil, key: {:hmac, <<232, 131, 12, 16, 165, 113, 238, 159, 136, 118, 128, 13, 201, 255, 106, 127>>}, module: :http_signature_hmac, public: false, shared: true}

iex> :http_signature_key.generate_key({:rsa, 4096})
%:http_signature_key{attributes: nil, id: nil, key: {:RSAPrivateKey, :"two-prime", 724103535064406613981196302107483691715505442393555175546843620646312917665660016721521333008494528989460322249557044456277385610186186145997220963960348558724718169213602069383984387712688616182735925254813098276715808987804031626750753806650478843836383453649073282429157288594133934058721330988502188241375459652767427938906622396909729902322859410267007674038118797462522475469910793627410215002785777857663676388879192977063921902916289571995827576974609796548443411951227781680214322332810309559251137221232994587069798516143231125845234205191652448979963190445241521869224365192342810234911768267387880941719323807782150837929518481032168029602703835394627475048855085308720417604603428147699935447055962520131026876448571866328886227641039893260600928715857637321925980277586775964843920329348532594186629311663408772486767346932627366401416417609490573372296827743181237243749584630158254708516625997799979246189486357520576108510045538061992187360943799179356818570630173585842117302918724173209411790450860051152187285532366521242750487390658854137991049791021043634494331707327710790510563926224713938731317501176015768578232639634482962165129270260331654681484356918035511431703201795311387394319623511811658328594458501, 65537, 593042971826327494475497986108903171534091499770726063864333602975278786879233126287862696632908797221558551608175143219718459383657224794946378919397770860575693848246640692649730106817195805020192422418665685795851519712839791225809034752459899780931655124198758082218975807029466391665805078670184093776886763154588884059703876545373296801916161539986292276179807230324868301430450918533824302154119453537850341489129662374596121399194834105572059221418621249519167800425441371769923917042488874461644640284872377198543897879884461154458442497576360608495956852574093087665450322744388671122555032451165669919996060434337951648820325797415492357793797147931317073807081084032623420269475825510709747138217048849171871525135367241261823937079069550536547685970835680481564167760584938940233717346090471633054137488551994890970782001591829975406238692819388903716964321122372866492816068527148824175378285426333494762166067762278864162491222433875221365024842318553759973767461792214967038466536852675451639490191099966744591898873328618763977516247512238657196251253893751489577343125105645546115482160163164885164837435999788661914630488685976700183410087908233645146879864895071554070229914756881965247655059138170737008006341573, 28362630808202257543208564131903380723376804148147773035658534808982074312970294170197606349704300393566627297510620943915400372826182060447842605301647888422249205184414235279008588712697263378453608791533915182077825932703214198639193670262218306850564658705656420532777224792049235476625692644785189858885673485260307118923351009786893436785468111480642622100207754440177232157269729077778151536186798433552135007881078539399686279030248594303984512785168194445216508790510754194829998414439435910684037096666354389551752417220273340271235989237205022598653011930928162558302984776416477058573913646701299684567759, 25530196403889351757446939966770791480529685500714027665295348740665261065731696186753244575271160060199994976928727628545017033449274618621168169789189401453971174396676711845356385056305951852069348195916046507257941338559250513002371376502866795326268424075943164349798871341939241428138321259185742812620564119714113134256893174601519361827804173460388323040567109607905604409787675783723116909007327790077735033822421037122678478872022686180391437035413560730431707339273773516099939349849033252902657500529674348920508325546713046187388137104539980430823503155269080031570009011480345569021452132435532986060139, 27976164700328466921329545443684668866166747445761396464853599099620629749418674891103560810996609467044891511974557582716131981948757390719598659949642585091900416862860274736045763595275979886732000041502028060946320087792645050228604233035244827014478871437027231165919265749992077424218247330965619623080175729453092045648734343602300064506458955987528597022229123671068510849970922784135539129121860902063631466949424616643320869457426951648485204456786437611068190400136979022088139791309075713112576011671266813527983936689005444382467602854111135402403608698337124684055390815671555655194044185381674730445369, 11973719377852922852261266059762177361445304839029053333966814688524469069035737761756480743856289527600702589466382365970187658225587896189310557926214422883115064580781117414448619977656530541176061697939660367328186260025568503565221004921931377511077903334334269841765230456645657625107764782391506734081790123863660152397182133874405307299711870846269372801591639043871317923366095344069723124832662988596050196600389938783279191984518078415653624672437044969578701931538794521634555072650712347139310368094062902829999304245377708785293027910680155919590796290393300165255769519292481830950644280248881965798411, 663274871796385511939951026599221685888634159677177291337169929099887968932645176661734337414262792082457234700831319583572786964569221270291562658559385395791592823416284583571724316244568769219073737902030244865827628283094421540873059099476435699126402915115445587873179058252032225467285751153408966896929924812152420696231216617713463237944074111170075883559469243700305237824413947373913518289136614564337818759164974321870276779338229612613887649448501888807459879606899671660016262354528094835999120495166881954889027205105711400513374452529636294789745366795677300256337200568086587268780450462144242585802, :asn1_NOVALUE}, module: :http_signature_rsa, public: false, shared: false}
```

_Erlang_

```erlang
http_signature_key:generate_key({dsa, 1024}).
% #{'__struct__'=>http_signature_key,attributes=>nil,id=>nil,key=>{'DSAPrivateKey',0,97202469206644971628615501625794273972720007065448563260237939125119935066783283187099215423135234564237045028934690396239699693712076089067494431586462385878734792451691200130931211075928837685643926875477708962420305255430564638782540970191759219359054629110897962886783351794272574863774768721338262076079,928992002797264582469203428377851477613999986399,75288491090612272394361735350598547281251246506680474729540542156717540865035934387613961787562902905670519362600501018986014205958158178378860816001883915323271285939936658305034286234798798831075525891854057150678841765758161477964584255913530148719293269555368747088665432030767653392692963982727666618141,93214229442335468805520539895798289869026207672747059747716988446492435210129450696561709225242518890381914157382687983446159464620443902123707356178482838718686147124203836521464423359668541227904895763106077937704912753141857160567967965593804747503593353585108706894195864977115357995014417009940912022260,751259874676424896059604264814569634620376855202},module=>http_signature_dsa,public=>false,shared=>false}

http_signature_key:generate_key({ecdsa, <<"nistp256">>}).
% #{'__struct__'=>http_signature_key,attributes=>nil,id=>nil,key=>{'ECPrivateKey',1,<<129,11,58,69,15,141,147,115,140,111,61,207,146,51,188,92,164,91,55,30,76,95,211,89,254,217,163,191,136,7,238,100>>,{namedCurve,{1,2,840,10045,3,1,7}},<<4,198,101,87,9,207,75,136,8,47,231,39,133,250,177,247,123,204,173,204,174,99,53,134,166,233,148,93,35,75,109,184,113,231,101,80,88,66,165,160,102,83,176,29,74,201,48,53,77,86,129,178,230,65,23,57,90,81,195,131,216,123,15,46,161>>},module=>http_signature_ecdsa,public=>false,shared=>false}

http_signature_key:generate_key({hmac, 16}).
% #{'__struct__'=>http_signature_key,attributes=>nil,id=>nil,key=>{hmac,<<232,131,12,16,165,113,238,159,136,118,128,13,201,255,106,127>>},module=>http_signature_hmac,public=>false,shared=>true}

http_signature_key:generate_key({rsa, 4096}).
% #{'__struct__'=>http_signature_key,attributes=>nil,id=>nil,key=>{'RSAPrivateKey','two-prime',724103535064406613981196302107483691715505442393555175546843620646312917665660016721521333008494528989460322249557044456277385610186186145997220963960348558724718169213602069383984387712688616182735925254813098276715808987804031626750753806650478843836383453649073282429157288594133934058721330988502188241375459652767427938906622396909729902322859410267007674038118797462522475469910793627410215002785777857663676388879192977063921902916289571995827576974609796548443411951227781680214322332810309559251137221232994587069798516143231125845234205191652448979963190445241521869224365192342810234911768267387880941719323807782150837929518481032168029602703835394627475048855085308720417604603428147699935447055962520131026876448571866328886227641039893260600928715857637321925980277586775964843920329348532594186629311663408772486767346932627366401416417609490573372296827743181237243749584630158254708516625997799979246189486357520576108510045538061992187360943799179356818570630173585842117302918724173209411790450860051152187285532366521242750487390658854137991049791021043634494331707327710790510563926224713938731317501176015768578232639634482962165129270260331654681484356918035511431703201795311387394319623511811658328594458501,65537,593042971826327494475497986108903171534091499770726063864333602975278786879233126287862696632908797221558551608175143219718459383657224794946378919397770860575693848246640692649730106817195805020192422418665685795851519712839791225809034752459899780931655124198758082218975807029466391665805078670184093776886763154588884059703876545373296801916161539986292276179807230324868301430450918533824302154119453537850341489129662374596121399194834105572059221418621249519167800425441371769923917042488874461644640284872377198543897879884461154458442497576360608495956852574093087665450322744388671122555032451165669919996060434337951648820325797415492357793797147931317073807081084032623420269475825510709747138217048849171871525135367241261823937079069550536547685970835680481564167760584938940233717346090471633054137488551994890970782001591829975406238692819388903716964321122372866492816068527148824175378285426333494762166067762278864162491222433875221365024842318553759973767461792214967038466536852675451639490191099966744591898873328618763977516247512238657196251253893751489577343125105645546115482160163164885164837435999788661914630488685976700183410087908233645146879864895071554070229914756881965247655059138170737008006341573,28362630808202257543208564131903380723376804148147773035658534808982074312970294170197606349704300393566627297510620943915400372826182060447842605301647888422249205184414235279008588712697263378453608791533915182077825932703214198639193670262218306850564658705656420532777224792049235476625692644785189858885673485260307118923351009786893436785468111480642622100207754440177232157269729077778151536186798433552135007881078539399686279030248594303984512785168194445216508790510754194829998414439435910684037096666354389551752417220273340271235989237205022598653011930928162558302984776416477058573913646701299684567759,25530196403889351757446939966770791480529685500714027665295348740665261065731696186753244575271160060199994976928727628545017033449274618621168169789189401453971174396676711845356385056305951852069348195916046507257941338559250513002371376502866795326268424075943164349798871341939241428138321259185742812620564119714113134256893174601519361827804173460388323040567109607905604409787675783723116909007327790077735033822421037122678478872022686180391437035413560730431707339273773516099939349849033252902657500529674348920508325546713046187388137104539980430823503155269080031570009011480345569021452132435532986060139,27976164700328466921329545443684668866166747445761396464853599099620629749418674891103560810996609467044891511974557582716131981948757390719598659949642585091900416862860274736045763595275979886732000041502028060946320087792645050228604233035244827014478871437027231165919265749992077424218247330965619623080175729453092045648734343602300064506458955987528597022229123671068510849970922784135539129121860902063631466949424616643320869457426951648485204456786437611068190400136979022088139791309075713112576011671266813527983936689005444382467602854111135402403608698337124684055390815671555655194044185381674730445369,11973719377852922852261266059762177361445304839029053333966814688524469069035737761756480743856289527600702589466382365970187658225587896189310557926214422883115064580781117414448619977656530541176061697939660367328186260025568503565221004921931377511077903334334269841765230456645657625107764782391506734081790123863660152397182133874405307299711870846269372801591639043871317923366095344069723124832662988596050196600389938783279191984518078415653624672437044969578701931538794521634555072650712347139310368094062902829999304245377708785293027910680155919590796290393300165255769519292481830950644280248881965798411,663274871796385511939951026599221685888634159677177291337169929099887968932645176661734337414262792082457234700831319583572786964569221270291562658559385395791592823416284583571724316244568769219073737902030244865827628283094421540873059099476435699126402915115445587873179058252032225467285751153408966896929924812152420696231216617713463237944074111170075883559469243700305237824413947373913518289136614564337818759164974321870276779338229612613887649448501888807459879606899671660016262354528094835999120495166881954889027205105711400513374452529636294789745366795677300256337200568086587268780450462144242585802,asn1_NOVALUE},module=>http_signature_rsa,public=>false,shared=>false}
```

Alternatively, `ssh-keygen` can be used:

_ssh-keygen_

```bash
# DSA
ssh-keygen -t dsa -b 1024 -C "test@dsa" -P "password" -f test_dsa
# ECDSA
ssh-keygen -t ecdsa -b 256 -C "test@ecdsa256" -P "password" -f test_ecdsa256
ssh-keygen -t ecdsa -b 384 -C "test@ecdsa384" -P "password" -f test_ecdsa384
ssh-keygen -t ecdsa -b 521 -C "test@ecdsa521" -P "password" -f test_ecdsa521
# RSA
ssh-keygen -t rsa -b 4096 -c "test@rsa" -P "password" -f test_rsa
```

These can be read (with or without a password) using `:http_signature_key.decode_file/1,2`:

```elixir
iex> :http_signature_key.decode_file("test_dsa", "password")
%:http_signature_key{attributes: nil, id: nil, key: {:DSAPrivateKey, 0, 111926020317636910034577969971397796352934170034660884717176490333102608819741546071037600084006157358787809687391732409642831866423795174530671962279287816083057241300426314455516992700378015139827672781822775214922605955682114336750562458412164491033418564474967573599729910194679926989216894632079162382659, 748354041565105844238228442780091921496065521763, 34191356122051350492426075514834739703704477677181624273397956978059453228966813745874917554573670703249360902537815730564544451359674296780206543169299264259968384223031317028637134148381407348201195186896359558189525550493432421268631479332327056128029069559316054365900383114103008277536243339134015333326, 102046468525760087988514321814590269344804195551526686337747332857710683793317218372659446672794717918592270209292471419532259963421980848790630718612254258944831370517111263410902885039576728477249264884144470649617264834899414363984280810648964039262274455057864469192981621236168921487312098310980549252904, 478289681309633491317947017250791026615343540219}, module: :http_signature_dsa, public: false, shared: false}

iex> :http_signature_key.decode_file("test_dsa.pub")
%:http_signature_key{attributes: [comment: 'test@dsa'], id: nil, key: {102046468525760087988514321814590269344804195551526686337747332857710683793317218372659446672794717918592270209292471419532259963421980848790630718612254258944831370517111263410902885039576728477249264884144470649617264834899414363984280810648964039262274455057864469192981621236168921487312098310980549252904, {:"Dss-Parms", 111926020317636910034577969971397796352934170034660884717176490333102608819741546071037600084006157358787809687391732409642831866423795174530671962279287816083057241300426314455516992700378015139827672781822775214922605955682114336750562458412164491033418564474967573599729910194679926989216894632079162382659, 748354041565105844238228442780091921496065521763, 34191356122051350492426075514834739703704477677181624273397956978059453228966813745874917554573670703249360902537815730564544451359674296780206543169299264259968384223031317028637134148381407348201195186896359558189525550493432421268631479332327056128029069559316054365900383114103008277536243339134015333326}}, module: :http_signature_dsa, public: true, shared: false}

iex> :http_signature_key.decode_file("test_ecdsa256", "password")
%:http_signature_key{attributes: nil, id: nil, key: {:ECPrivateKey, 1, <<194, 6, 182, 238, 84, 142, 92, 143, 99, 151, 116, 226, 239, 198, 43, 181, 129, 151, 119, 224, 202, 49, 195, 225, 135, 209, 90, 0, 241, 108, 70, 16>>, {:namedCurve, {1, 2, 840, 10045, 3, 1, 7}}, <<4, 88, 11, 228, 163, 5, 193, 25, 44, 123, 101, 126, 192, 58, 213, 190, 20, 115, 203, 112, 236, 183, 49, 181, 165, 133, 149, 184, 163, 52, 162, 45, 100, 218, 106, 84, 193, 98, 115, 30, 152, 133, 203, ...>>}, module: :http_signature_ecdsa, public: false, shared: false}

iex> :http_signature_key.decode_file("test_ecdsa256.pub")
%:http_signature_key{attributes: [comment: 'test@ecdsa256'], id: nil, key: {{:ECPoint, <<4, 88, 11, 228, 163, 5, 193, 25, 44, 123, 101, 126, 192, 58, 213, 190, 20, 115, 203, 112, 236, 183, 49, 181, 165, 133, 149, 184, 163, 52, 162, 45, 100, 218, 106, 84, 193, 98, 115, 30, 152, 133, 203, 220, 49, ...>>}, {:namedCurve, {1, 2, 840, 10045, 3, 1, 7}}}, module: :http_signature_ecdsa, public: true, shared: false}

iex> :http_signature_key.decode_file("test_rsa", "password")
%:http_signature_key{attributes: nil, id: nil, key: {:RSAPrivateKey, :"two-prime", 874892734052206052614934222489159067518495965935795269032653295253125790771818191380495987107124096744703295881986480743912818031759052326174438257034332389733163432008255137607254101433354498104647331997138585998562784232066080100306662297715358117501423030063846556781565774443735568681678710997813508088409523113807989538107369994052197777227840784934391115544356367468728036317963284767594446338085596506182720456613445533178214191320436224008893114214343206221288982675615744352251316373405719791349917409526479904743954509117324351713031350469706267482089275732316595622201885849427993838740032902850263800769415706532026811770374724547080121169135982086418058995958934561312228882073615666712039058385837688331513945812934817421536538068201853248919472955444281521495536297734926112805710582625241880195178988672926086343406485578429845059538637854148794196232508037940508661477776252142043225314528305140765094830800171804660181551832909753243367333454511549494245533134709390150229570145298539042486261002809355210214782657215322369140574323424612854474845324584945465565798326230733562233674877615046357081976865837823067981909870727463456906744181451018949231221859834751957664430491693486568370763085695511554717263429967, 65537, 721212139053823519424475050276589081323324908977849755244962300319668597074133356566997203159472959193014565207811154343193768316611727755642980710686784676676292085604253838430686525625783553719327587639736516907584332791207561795917839245526530391962011981006138673270428780144388881059976690444434056708062994739208029583231619755690220561129348282742275050998426121923463572670063726743202922981141558985710689727459929428108595475625777301403488876442771132583199372706259679091663905382810382100610026214957475576449824409952598503155416310010007798659076142048589408707897170804512677832948262471222141718976524465312082213881895672317808214770716841430211904431292888878894782923791919719520858980429633323914536896983890136852003562533526808205126838639816996071920389373456243319908908651686874181306003410501924433975063938635762356697414820848095294747463480202550272735194533510707234378217819248763003237181231805643300046334035141501029074159415371089147003485142513790705441138269336543348040119878804523119027583315115538848536658660464210904370364507814599753023747042041005722843028713137234151275615769357100663581950992627465011445147945124499872141420093742409608479589225933685803817499156119058127038039868673, 31035729103712186911852355257921569651249382268499042804681403652977581094900500662301598731788994748662784192894519295751148080956447087069346524378449962651732746864554113518406011843588214464875000569837747623452213063184851298780725210380462990060590825609691570106122254976060011491185693508109236531679635723151600669144433246915557156708399001818673171863631497724569934771216333837659387020751553652659538798637697585902915379815525456196021895081850312355271429594174639011450970487115797191372199735590803425143520414665557229466123769410779630761419124209522378778494280676084957071647627557570036826328449, 28189855992381375636927227598285274108154512353214174095631066847083073740380271866701180146100907384109752686524187087011535702011784147238416594181306402611567394124387391108310654898216863874652983678014361312758245742973682869902288138046511088365085152459697716148254780299347037141043303790343166857262343643841664888358794534038269534717326336302556768382879349131582895369315725956321453593400475659328298412529923357665294322954890451685198649333813820236583168839402198410311407861388874149743385651398276788690048529805313743346343111976552376355883864706275897834522169571861946084918964303591867998066383, 22031451318980149712377849514995883010895753715876237368237681647732975346415856574335982388559430591757918565177406979206107422834990735488765252508638290010933710459429803366293893357939095496427661496720349309334685877268548102189231715863257086631809008343984023010621872655923217642010345592226772833106973049547307901347429207108236043785111414340145749341772253362835758050586653327577210772028389010523516845888911680256364072434772583404909083798356990428373174222344427281226383569160752441128047489187648927292247131414097669811747198136895200602918991037118110806290941298709133128526825714647158448987265, 24830059768012073943226896872585192077259065567567044781488303779768947537073585513178697912840395191344119864844213555469855347884893292086681360387416167922781625543195241453199579850381718480068024715764484507076651262018383773257541313408805698871826685855143054494013388582939516090206536072773389840888750616970626475813659051709616661749734960242327113106643473274177246716955606703917057999796082486387618508044346792568881396568259246135462063131417925553153180713540920479021565378435603539498095428729067944884900764934945773355676983718486694195946594656979759195502185951528185600470453841175888003057509, 30205833780479913712331952115001793532832635008559312492194750671441001515896254619033511582262705287802972678041849906909875952050230703893981699916707898621245540193195634237241294283015085913585343957031114042217107576089598824537197540491318396709439146486673465222362256621959194854510064297592578823946810030178205556506233838735171069691195349335578481762647968239067993667992230022941823644118105701282357718846254315466761200962125381461629898540150194702139727613641137103191676902640234094901571521242550688766569803565854076473984685129064791819778276900933954000885162160242107436696588069549628976504624, :asn1_NOVALUE}, module: :http_signature_rsa, public: false, shared: false}

iex> :http_signature_key.decode_file("test_rsa.pub")
%:http_signature_key{attributes: [comment: 'test@rsa'], id: nil, key: {:RSAPublicKey, 874892734052206052614934222489159067518495965935795269032653295253125790771818191380495987107124096744703295881986480743912818031759052326174438257034332389733163432008255137607254101433354498104647331997138585998562784232066080100306662297715358117501423030063846556781565774443735568681678710997813508088409523113807989538107369994052197777227840784934391115544356367468728036317963284767594446338085596506182720456613445533178214191320436224008893114214343206221288982675615744352251316373405719791349917409526479904743954509117324351713031350469706267482089275732316595622201885849427993838740032902850263800769415706532026811770374724547080121169135982086418058995958934561312228882073615666712039058385837688331513945812934817421536538068201853248919472955444281521495536297734926112805710582625241880195178988672926086343406485578429845059538637854148794196232508037940508661477776252142043225314528305140765094830800171804660181551832909753243367333454511549494245533134709390150229570145298539042486261002809355210214782657215322369140574323424612854474845324584945465565798326230733562233674877615046357081976865837823067981909870727463456906744181451018949231221859834751957664430491693486568370763085695511554717263429967, 65537}, module: :http_signature_rsa, public: true, shared: false}
```