activemq-cpp-3.9.5
MessageDigest.h
Go to the documentation of this file.
1/*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18#ifndef _DECAF_SECURITY_MESSAGEDIGEST_H_
19#define _DECAF_SECURITY_MESSAGEDIGEST_H_
20
21#include <decaf/util/Config.h>
22
25
26#include <string>
27
28namespace decaf {
29namespace security {
30
31 class MessageDigestSpi;
32 class MessageDigestImpl;
33 class Provider;
34
71 class DECAF_API MessageDigest {
72 private:
73
74 MessageDigestImpl* impl;
75
77 const Provider* provider;
78 std::string algorithm;
79
80 private:
81
82 MessageDigest(const MessageDigest&);
83 MessageDigest& operator= (const MessageDigest&);
84
85 protected:
86
87 MessageDigest(const std::string& name);
88
89 public:
90
91 virtual ~MessageDigest();
92
97 std::vector<unsigned char> digest();
98
116 int digest(unsigned char* input, int size, int offset, int length);
117
130 std::vector<unsigned char> digest(const unsigned char* input, int size);
131
142 std::vector<unsigned char> digest(const std::vector<unsigned char>& input);
143
150 std::string getAlgorithmName() const {
151 return this->algorithm;
152 }
153
162 const Provider* getProvider() const {
163 return this->provider;
164 }
165
173 int getDigestLength() const;
174
183 MessageDigest* clone();
184
188 void reset();
189
195 std::string toString() const;
196
203 void update(unsigned char input);
204
217 void update(unsigned char* input, int size, int offset, int length);
218
225 void update(const std::vector<unsigned char>& input);
226
236
237 public:
238
256 static MessageDigest* getInstance(const std::string& algorithm);
257
268 static bool isEqual(const std::vector<unsigned char>& digesta,
269 const std::vector<unsigned char>& digestb);
270
271 };
272
273}}
274
275#endif /* _DECAF_SECURITY_MESSAGEDIGEST_H_ */
This class defines six categories of operations upon byte buffers:
Definition ByteBuffer.h:98
void update(unsigned char *input, int size, int offset, int length)
Updates the digest using the specified array of bytes, starting at the specified offset.
std::vector< unsigned char > digest(const unsigned char *input, int size)
Performs a final update on the digest using the specified array of bytes, then completes the digest c...
void update(unsigned char input)
Updates the digest using the specified byte.
int digest(unsigned char *input, int size, int offset, int length)
Completes the hash computation by performing final operations such as padding.
MessageDigest(const std::string &name)
static MessageDigest * getInstance(const std::string &algorithm)
Returns a MessageDigest object that implements the specified digest algorithm.
static bool isEqual(const std::vector< unsigned char > &digesta, const std::vector< unsigned char > &digestb)
Compares two digests for equality.
void update(nio::ByteBuffer &input)
Update the digest using the specified ByteBuffer.
std::string toString() const
Returns a string representation of this message digest object.
MessageDigest * clone()
Returns a clone of this MessageDisgest instance if the MessageDigestSpi in use is cloneable.
std::vector< unsigned char > digest()
Completes the hash computation by performing final operations such as padding.
void update(const std::vector< unsigned char > &input)
Updates the digest using the specified array of bytes.
const Provider * getProvider() const
Returns the Provider associated with this MessageDigest.
Definition MessageDigest.h:162
std::string getAlgorithmName() const
Returns a string that identifies the algorithm, independent of implementation details.
Definition MessageDigest.h:150
void reset()
Resets the digest for further use.
std::vector< unsigned char > digest(const std::vector< unsigned char > &input)
Performs a final update on the digest using the specified array of bytes, then completes the digest c...
int getDigestLength() const
Returns the length of the digest in bytes, or 0 if this operation is not supported by the provider an...
This class defines the Service Provider Interface (SPI) for the MessageDigest class,...
Definition MessageDigestSpi.h:47
This class represents a "provider" for the Decaf Security API, where a provider implements some or al...
Definition Provider.h:46
#define DECAF_API
Definition Config.h:29
Definition Engine.h:26
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.
Definition AprPool.h:25