| 1 |
#! /bin/sh |
| 2 |
|
| 3 |
# Copyright (c) 2021 Michael Baeuerle |
| 4 |
# |
| 5 |
# All rights reserved. |
| 6 |
# |
| 7 |
# Permission is hereby granted, free of charge, to any person obtaining |
| 8 |
# a copy of this software and associated documentation files (the |
| 9 |
# "Software"), to deal in the Software without restriction, including |
| 10 |
# without limitation the rights to use, copy, modify, merge, publish, |
| 11 |
# distribute, and/or sell copies of the Software, and to permit persons |
| 12 |
# to whom the Software is furnished to do so, provided that the above |
| 13 |
# copyright notice(s) and this permission notice appear in all copies of |
| 14 |
# the Software and that both the above copyright notice(s) and this |
| 15 |
# permission notice appear in supporting documentation. |
| 16 |
# |
| 17 |
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
| 18 |
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
| 19 |
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT |
| 20 |
# OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR |
| 21 |
# HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY |
| 22 |
# SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER |
| 23 |
# RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF |
| 24 |
# CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN |
| 25 |
# CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 26 |
# |
| 27 |
# Except as contained in this notice, the name of a copyright holder |
| 28 |
# shall not be used in advertising or otherwise to promote the sale, use |
| 29 |
# or other dealings in this Software without prior written authorization |
| 30 |
# of the copyright holder. |
| 31 |
# |
| 32 |
# SPDX-License-Identifier: ICU |
| 33 |
|
| 34 |
|
| 35 |
# Create a <c-lock> element with the canlock utility |
| 36 |
# The local secret is loaded from the file "secret_512bits". |
| 37 |
|
| 38 |
# User-ID : testuser |
| 39 |
# Message-ID: <[email protected]> |
| 40 |
# |
| 41 |
# Note that RFC 8315 uses angle brackets like quotes in the continuous text. |
| 42 |
# Therefore <uid> or <mid> does not mean that additional angle brackets are |
| 43 |
# required. A User-ID must not contain angle brackets and a Message-ID always |
| 44 |
# includes angle brackets (as defined by RFC 5536 in Section 3.1.3). |
| 45 |
LOCK=$(canlock -a sha512 -l 'testuser<[email protected]>' \ |
| 46 |
<secret_512bits) |
| 47 |
|
| 48 |
|
| 49 |
# Print (initial) Cancel-Lock header field |
| 50 |
# |
| 51 |
# For insertion into a message header, the canonical line termination CRLF |
| 52 |
# must be used instead. |
| 53 |
printf "Cancel-Lock: %s\n" "$LOCK" |
| 54 |
|
| 55 |
|
| 56 |
# EOF |