xrootd
Loading...
Searching...
No Matches
XrdCryptoCipher.hh
Go to the documentation of this file.
1#ifndef __CRYPTO_CIPHER_H__
2#define __CRYPTO_CIPHER_H__
3/******************************************************************************/
4/* */
5/* X r d C r y p t o C i p h e r . h h */
6/* */
7/* (c) 2004 by the Board of Trustees of the Leland Stanford, Jr., University */
8/* Produced by Gerri Ganis for CERN */
9/* */
10/* This file is part of the XRootD software suite. */
11/* */
12/* XRootD is free software: you can redistribute it and/or modify it under */
13/* the terms of the GNU Lesser General Public License as published by the */
14/* Free Software Foundation, either version 3 of the License, or (at your */
15/* option) any later version. */
16/* */
17/* XRootD is distributed in the hope that it will be useful, but WITHOUT */
18/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */
19/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */
20/* License for more details. */
21/* */
22/* You should have received a copy of the GNU Lesser General Public License */
23/* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */
24/* COPYING (GPL license). If not, see <http://www.gnu.org/licenses/>. */
25/* */
26/* The copyright holder's institutional names and contributor's names may not */
27/* be used to endorse or promote products derived from this software without */
28/* specific prior written permission of the institution or contributor. */
29/******************************************************************************/
30
31/* ************************************************************************** */
32/* */
33/* Abstract interface for a symmetric Cipher functionality. */
34/* Allows to plug-in modules based on different crypto implementation */
35/* (OpenSSL, Botan, ...) */
36/* */
37/* ************************************************************************** */
38
41
42// ---------------------------------------------------------------------------//
43//
44// Cipher interface
45//
46// ---------------------------------------------------------------------------//
48{
49public:
51 virtual ~XrdCryptoCipher() {}
52
53 // Finalize key computation (key agreement)
54 virtual bool Finalize(bool padded, char *pub, int lpub, const char *t);
55 bool Finalize(char *pub, int lpub, const char *t)
56 { return Finalize(false, pub, lpub, t); }
57
58 // Validity
59 virtual bool IsValid();
60
61 // Required buffer size for encrypt / decrypt operations on l bytes
62 virtual int EncOutLength(int l);
63 virtual int DecOutLength(int l);
64
65 // Additional getters
67 virtual char *IV(int &l) const;
68 virtual bool IsDefaultLength() const;
69 virtual char *Public(int &lpub);
70 virtual int MaxIVLength() const;
71
72 // Additional setters
73 virtual void SetIV(int l, const char *iv);
74
75 // Additional methods
76 virtual int Encrypt(const char *in, int lin, char *out);
77 virtual int Decrypt(const char *in, int lin, char *out);
78 int Encrypt(XrdSutBucket &buck, bool useiv = true);
79 int Decrypt(XrdSutBucket &buck, bool useiv = true);
80 virtual char *RefreshIV(int &l);
81};
82
83#endif
Definition XrdCryptoBasic.hh:48
Definition XrdCryptoCipher.hh:48
bool Finalize(char *pub, int lpub, const char *t)
Definition XrdCryptoCipher.hh:55
virtual int DecOutLength(int l)
virtual ~XrdCryptoCipher()
Definition XrdCryptoCipher.hh:51
int Encrypt(XrdSutBucket &buck, bool useiv=true)
virtual int EncOutLength(int l)
virtual void SetIV(int l, const char *iv)
virtual char * RefreshIV(int &l)
virtual int MaxIVLength() const
virtual bool IsValid()
virtual int Decrypt(const char *in, int lin, char *out)
virtual bool Finalize(bool padded, char *pub, int lpub, const char *t)
virtual char * IV(int &l) const
virtual bool IsDefaultLength() const
int Decrypt(XrdSutBucket &buck, bool useiv=true)
XrdCryptoCipher()
Definition XrdCryptoCipher.hh:50
virtual XrdSutBucket * AsBucket()
virtual char * Public(int &lpub)
virtual int Encrypt(const char *in, int lin, char *out)
Definition XrdSutBucket.hh:44