changed CHANGELOG.md
 
@@ -1,5 +1,12 @@
1
1
# Changes
2
2
3
+ ## v0.8.1
4
+
5
+ ### Fixes
6
+
7
+ * [X509.Certificate] Support both 'plain' and 'otp' `rdnSequence` records
8
+ * [X509.CSR] Support both 'plain' and 'otp' `rdnSequence` records
9
+
3
10
## v0.8.0
4
11
5
12
### Enhancements
changed README.md
 
@@ -8,6 +8,9 @@ Elixir package for working with X.509 certificates, Certificate Signing Requests
8
8
9
9
Requires Erlang/OTP 20.1 or later.
10
10
11
+ Development and public release of this package were made possible by
12
+ [Bluecode](https://bluecode.com/).
13
+
11
14
## Usage
12
15
13
16
### As a Certificate Authority (CA)
 
@@ -90,9 +93,39 @@ Add `x509` to your list of dependencies in `mix.exs`:
90
93
```elixir
91
94
def deps do
92
95
[
93
- {:x509, "~> 0.7.0"}
96
+ {:x509, "~> 0.8"}
94
97
]
95
98
end
96
99
```
97
100
98
101
Documentation can be found at [https://hexdocs.pm/x509](https://hexdocs.pm/x509).
102
+
103
+ ## License
104
+
105
+ Copyright (c) 2019, Bram Verburg
106
+ All rights reserved.
107
+
108
+ Redistribution and use in source and binary forms, with or without
109
+ modification, are permitted provided that the following conditions are met:
110
+
111
+ * Redistributions of source code must retain the above copyright notice, this
112
+ list of conditions and the following disclaimer.
113
+
114
+ * Redistributions in binary form must reproduce the above copyright notice,
115
+ this list of conditions and the following disclaimer in the documentation
116
+ and/or other materials provided with the distribution.
117
+
118
+ * Neither the name of the copyright holder nor the names of its contributors
119
+ may be used to endorse or promote products derived from this software
120
+ without specific prior written permission.
121
+
122
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
123
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
124
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
125
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
126
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
127
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
128
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
129
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
130
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
131
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
changed hex_metadata.config
 
@@ -19,10 +19,10 @@
19
19
<<"lib/x509/certificate.ex">>,<<"lib/x509/signature_algorithm.ex">>,
20
20
<<"lib/x509/date_time.ex">>,<<"lib/x509/rdn_sequence.ex">>,
21
21
<<"lib/x509/public_key.ex">>,<<"lib/x509/asn1.ex">>,<<"lib/x509/csr.ex">>,
22
- <<"priv">>,<<".formatter.exs">>,<<"mix.exs">>,<<"README.md">>,<<"LICENSE">>,
22
+ <<".formatter.exs">>,<<"mix.exs">>,<<"README.md">>,<<"LICENSE">>,
23
23
<<"CHANGELOG.md">>]}.
24
- {<<"licenses">>,[<<"BSD 3-Clause">>]}.
24
+ {<<"licenses">>,[<<"BSD-3-Clause">>]}.
25
25
{<<"links">>,[{<<"GitHub">>,<<"https://github.com/voltone/x509">>}]}.
26
26
{<<"name">>,<<"x509">>}.
27
27
{<<"requirements">>,[]}.
28
- {<<"version">>,<<"0.8.0">>}.
28
+ {<<"version">>,<<"0.8.1">>}.
changed lib/x509/certificate.ex
 
@@ -397,8 +397,15 @@ defmodule X509.Certificate do
397
397
end,
398
398
subject:
399
399
case subject_rdn do
400
- {:rdnSequence, _} -> subject_rdn
401
- name when is_binary(name) -> RDNSequence.new(name, :otp)
400
+ {:rdnSequence, [[{:AttributeTypeAndValue, _oid, value} | _] | _]}
401
+ when is_binary(value) ->
402
+ :pubkey_cert_records.transform(subject_rdn, :decode)
403
+
404
+ {:rdnSequence, _} ->
405
+ subject_rdn
406
+
407
+ name when is_binary(name) ->
408
+ RDNSequence.new(name, :otp)
402
409
end,
403
410
subjectPublicKeyInfo: PublicKey.wrap(public_key, :OTPSubjectPublicKeyInfo),
404
411
extensions:
changed lib/x509/csr.ex
 
@@ -63,8 +63,15 @@ defmodule X509.CSR do
63
63
# Convert subject to RDNSequence, if necessary
64
64
subject_rdn_sequence =
65
65
case subject do
66
- {:rdnSequence, _} -> subject
67
- rdn -> RDNSequence.new(rdn)
66
+ {:rdnSequence, [[{:AttributeTypeAndValue, _oid, value} | _] | _]}
67
+ when is_binary(value) ->
68
+ subject
69
+
70
+ {:rdnSequence, _} ->
71
+ :pubkey_cert_records.transform(subject, :encode)
72
+
73
+ rdn ->
74
+ RDNSequence.new(rdn)
68
75
end
69
76
70
77
attributes =
changed lib/x509/private_key.ex
 
@@ -25,9 +25,8 @@ defmodule X509.PrivateKey do
25
25
true
26
26
27
27
Note that in practice it is not a good idea to directly encrypt a message
28
- with asymmetrical cryptography, and signatures should be calculated over
29
- message hashes rather than raw messages. The examples above are deliberate
30
- over-simpliciations intended to highlight the `:crypto` API calls.
28
+ with asymmetrical cryptography. The examples above are deliberate
29
+ over-simpliciations intended to highlight the `:public_key` API calls.
31
30
"""
32
31
33
32
@typedoc "RSA or EC private key"
changed mix.exs
 
@@ -1,7 +1,7 @@
1
1
defmodule X509.MixProject do
2
2
use Mix.Project
3
3
4
- @version "0.8.0"
4
+ @version "0.8.1"
5
5
6
6
def project do
7
7
[
 
@@ -40,7 +40,7 @@ defmodule X509.MixProject do
40
40
defp package do
41
41
[
42
42
maintainers: ["Bram Verburg"],
43
- licenses: ["BSD 3-Clause"],
43
+ licenses: ["BSD-3-Clause"],
44
44
links: %{"GitHub" => "https://github.com/voltone/x509"}
45
45
]
46
46
end