Skip to content

Commit

Permalink
Merge branch 'maint'
Browse files Browse the repository at this point in the history
  • Loading branch information
IngelaAndin committed Jan 12, 2024
2 parents 6d555f9 + 1e684a7 commit 9bf622b
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 25 deletions.
25 changes: 6 additions & 19 deletions lib/ssl/doc/src/ssl_crl_cache.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,36 +41,23 @@
<datatype>
<name name="crl_src"/>
</datatype>

<datatype>
<name name="uri"/>
</datatype>

</datatypes>

<funcs>
<func>
<name since="OTP 18.0">delete(Entries) -> ok | {error, Reason} </name>
<fsummary> </fsummary>
<type>
<v> Entries = <seetype marker="#crl_src">crl_src()</seetype>]}</v>
<v> Reason = crl_reason()</v>
</type>
<fsummary> Delete CRLs from the ssl applications local cache.</fsummary>
<desc>
<p>Delete CRLs from the ssl applications local cache. </p>
</desc>
</func>
<func>
<name since="OTP 18.0">insert(CRLSrc) -> ok | {error, Reason}</name>
<name since="OTP 18.0">insert(URI, CRLSrc) -> ok | {error, Reason}</name>
<fsummary> </fsummary>
<type>
<v> CRLSrc = <seetype marker="#crl_src">crl_src()</seetype>]}</v>
<v> URI = <seetype marker="#uri">uri()</seetype> </v>
<v> Reason = term()</v>
</type>
<name since="OTP 18.0" name="insert" arity="1"></name>
<name since="OTP 18.0" name="insert" arity="2"></name>
<fsummary> Insert CRLs into the ssl applications local cache.</fsummary>
<desc>
<p>Insert CRLs, available to fetch on DER format from <c>URI</c>, into the ssl applications local cache. </p>
<p>Insert CRLs into the ssl applications local cache, with or without a distribution point
reference URI</p>
</desc>
</func>
</funcs>
Expand Down
28 changes: 22 additions & 6 deletions lib/ssl/src/ssl_crl_cache.erl
Original file line number Diff line number Diff line change
Expand Up @@ -72,22 +72,38 @@ fresh_crl(#'DistributionPoint'{distributionPoint = {fullName, Names}}, CRL) ->
%% API
%%====================================================================

insert(CRLs) ->
insert(?NO_DIST_POINT, CRLs).
%%--------------------------------------------------------------------
-spec insert(CRLSrc) -> ok | {error, Reason} when
CRLSrc :: crl_src(),
Reason :: term().
%%--------------------------------------------------------------------
insert(CRLSrc) ->
insert(?NO_DIST_POINT, CRLSrc).

insert(URI, {file, File}) when is_list(URI) ->
%%--------------------------------------------------------------------
-spec insert(DistPointURI, CRLSrc) -> ok | {error, Reason} when
DistPointURI :: uri_string:uri_string(),
CRLSrc :: crl_src(),
Reason :: term().
%%--------------------------------------------------------------------
insert(DistPointURI, {file, File}) when is_list(DistPointURI) ->
case file:read_file(File) of
{ok, PemBin} ->
PemEntries = public_key:pem_decode(PemBin),
CRLs = [ CRL || {'CertificateList', CRL, not_encrypted}
<- PemEntries],
do_insert(URI, CRLs);
do_insert(DistPointURI, CRLs);
Error ->
Error
end;
insert(URI, {der, CRLs}) ->
do_insert(URI, CRLs).
insert(DistPointURI, {der, CRLs}) ->
do_insert(DistPointURI, CRLs).

%%--------------------------------------------------------------------
-spec delete(Entries) -> ok | {error, Reason} when
Entries :: crl_src() | uri_string:uri_string(),
Reason :: term().
%%--------------------------------------------------------------------
delete({file, File}) ->
case file:read_file(File) of
{ok, PemBin} ->
Expand Down

0 comments on commit 9bf622b

Please sign in to comment.