ClanLib
2.3.7
Main Page
Modules
Namespaces
Classes
Files
File List
File Members
Sources
API
Core
Crypto
rsa.h
Go to the documentation of this file.
1
/*
2
** ClanLib SDK
3
** Copyright (c) 1997-2011 The ClanLib Team
4
**
5
** This software is provided 'as-is', without any express or implied
6
** warranty. In no event will the authors be held liable for any damages
7
** arising from the use of this software.
8
**
9
** Permission is granted to anyone to use this software for any purpose,
10
** including commercial applications, and to alter it and redistribute it
11
** freely, subject to the following restrictions:
12
**
13
** 1. The origin of this software must not be misrepresented; you must not
14
** claim that you wrote the original software. If you use this software
15
** in a product, an acknowledgment in the product documentation would be
16
** appreciated but is not required.
17
** 2. Altered source versions must be plainly marked as such, and must not be
18
** misrepresented as being the original software.
19
** 3. This notice may not be removed or altered from any source distribution.
20
**
21
** Note: Some of the libraries ClanLib may link to may have additional
22
** requirements or restrictions.
23
**
24
** File Author(s):
25
**
26
** Mark Page
27
** Michael J. Fromberger
28
*/
29
30
// This class is based on the original MPI library (not NSS, because of license restrictions) with some modifications.
31
// Some ideas and algorithms are from NSS (Netscape Security Suite). Where they have been used, the function contains a reference note
32
//
33
// Note, since September 2011, I believe the MPI homepage is now: http://spinning-yarns.org/michael/mpi/
34
// The license is as follows
35
// This software was written by Michael J. Fromberger,
36
// http://www.dartmouth.edu/~sting/
37
//
38
// See the MPI home page at
39
// http://www.dartmouth.edu/~sting/mpi/
40
//
41
// This software is in the public domain. It is entirely free, and you
42
// may use it and/or redistribute it for whatever purpose you choose;
43
// however, as free software, it is provided without warranty of any
44
// kind, not even the implied warranty of merchantability or fitness for
45
// a particular purpose.
46
49
50
#pragma once
51
52
#include "../api_core.h"
53
54
class
CL_Random
;
55
class
CL_Secret
;
56
class
CL_DataBuffer
;
57
63
class
CL_API_CORE
CL_RSA
64
{
67
68
public
:
69
78
static
void
create_keypair(
CL_Random
&random,
CL_Secret
&out_private_exponent,
CL_DataBuffer
&out_public_exponent,
CL_DataBuffer
&out_modulus,
int
key_size_in_bits = 1024,
int
public_exponent_value = 65537);
79
88
static
CL_DataBuffer
encrypt(
int
block_type,
CL_Random
&random,
const
CL_DataBuffer
&in_public_exponent,
const
CL_DataBuffer
&in_modulus,
const
CL_Secret
&in_data);
89
101
static
CL_DataBuffer
encrypt(
int
block_type,
CL_Random
&random,
const
void
*in_public_exponent,
unsigned
int
in_public_exponent_size,
const
void
*in_modulus,
unsigned
int
in_modulus_size,
const
void
*in_data,
unsigned
int
in_data_size);
102
112
static
CL_Secret
decrypt(
const
CL_Secret
&in_private_exponent,
const
CL_DataBuffer
&in_modulus,
const
CL_DataBuffer
&in_data);
113
125
static
CL_Secret
decrypt(
const
CL_Secret
&in_private_exponent,
const
void
*in_modulus,
unsigned
int
in_modulus_size,
const
void
*in_data,
unsigned
int
in_data_size);
127
};
128
Generated on Fri Jun 14 2013 13:05:46 for ClanLib by
1.8.4