1<?php
2
3/**
4 * This file is part of the FreeDSx SASL package.
5 *
6 * (c) Chad Sikorra <Chad.Sikorra@gmail.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace FreeDSx\Sasl\Security;
13
14use FreeDSx\Sasl\Exception\SaslException;
15use FreeDSx\Sasl\SaslContext;
16
17/**
18 * The security layer interface. Security layers are responsible for any integrity / confidentiality provided by the
19 * specific mechanisms.
20 *
21 * @author Chad Sikorra <Chad.Sikorra@gmail.com>
22 */
23interface SecurityLayerInterface
24{
25    /**
26     * Wraps / Installs the security layer for a specific SASL context over a data stream.
27     *
28     * @throws SaslException
29     */
30    public function wrap(string $data, SaslContext $context): string;
31
32    /**
33     * Unwraps / uninstalls the security layer for a specific SASL context from a data stream.
34     *
35     * @throws SaslException
36     */
37    public function unwrap(string $data, SaslContext $context): string;
38}
39