libcryptosec
|
Classe usada para representar números grandes. A limitação do tamanho do número depende da memória disponível. More...
#include <BigInteger.h>
Public Member Functions | |
BigInteger () throw (BigIntegerException) | |
BigInteger (BIGNUM const *bn) throw (BigIntegerException) | |
BigInteger (long val) throw (BigIntegerException) | |
BigInteger (ASN1_INTEGER *val) throw (BigIntegerException) | |
BigInteger (ByteArray &b) throw (BigIntegerException) | |
BigInteger (BigInteger const &b) throw (BigIntegerException) | |
BigInteger (std::string dec) throw (BigIntegerException) | |
virtual | ~BigInteger () |
void | setValue (const long val=0) throw (BigIntegerException) |
double | getValue () const throw (BigIntegerException) |
bool | isNegative () const throw () |
ASN1_INTEGER * | getASN1Value () const throw (BigIntegerException) |
ByteArray * | getBinValue () const throw (BigIntegerException) |
BIGNUM const * | getBIGNUM () const throw () |
std::string | toHex () const throw () |
std::string | toDec () const throw () |
void | setHexValue (std::string hex) throw (BigIntegerException) |
void | setDecValue (std::string dec) throw (BigIntegerException) |
void | setRandValue (int numBits=64) throw (BigIntegerException) |
void | setNegative (bool neg=true) throw () |
int | size () const throw () |
BigInteger & | add (BigInteger const &a) throw (BigIntegerException) |
BigInteger & | add (long const a) throw (BigIntegerException) |
BigInteger & | sub (BigInteger const &a) throw (BigIntegerException) |
BigInteger & | sub (long const a) throw (BigIntegerException) |
BigInteger & | mul (BigInteger const &a) throw (BigIntegerException) |
BigInteger & | mul (long const a) throw (BigIntegerException) |
BigInteger | operator* (BigInteger const &a) const throw (BigIntegerException) |
BigInteger | operator* (long const c) const throw (BigIntegerException) |
BigInteger & | div (BigInteger const &a) throw (BigIntegerException) |
BigInteger & | div (long const a) throw (BigIntegerException) |
BigInteger | operator/ (BigInteger const &a) const throw (BigIntegerException) |
BigInteger | operator/ (long const c) const throw (BigIntegerException) |
BigInteger & | mod (BigInteger const &a) throw (BigIntegerException) |
BigInteger & | mod (long const a) throw (BigIntegerException) |
BigInteger | operator% (BigInteger const &a) const throw (BigIntegerException) |
BigInteger | operator% (long const c) const throw (BigIntegerException) |
int | compare (BigInteger const &a) const throw () |
BigInteger | operator+ (BigInteger const &c) const throw (BigIntegerException) |
BigInteger | operator+ (long const c) const throw (BigIntegerException) |
BigInteger & | operator+= (BigInteger const &c) throw (BigIntegerException) |
BigInteger & | operator+= (long const c) throw (BigIntegerException) |
BigInteger | operator- (BigInteger const &c) const throw (BigIntegerException) |
BigInteger | operator- (long const c) const throw (BigIntegerException) |
bool | operator== (BigInteger const &c) const throw () |
bool | operator== (long const c) const throw (BigIntegerException) |
bool | operator!= (BigInteger const &c) const throw () |
bool | operator!= (long const c) const throw (BigIntegerException) |
bool | operator> (BigInteger const &c) const throw () |
bool | operator> (long const c) const throw (BigIntegerException) |
bool | operator>= (BigInteger const &c) const throw () |
bool | operator>= (long const c) const throw (BigIntegerException) |
bool | operator< (BigInteger const &c) const throw () |
bool | operator< (long const c) const throw (BigIntegerException) |
bool | operator<= (BigInteger const &c) const throw () |
bool | operator<= (long const c) const throw (BigIntegerException) |
bool | operator! () const throw () |
bool | operator|| (BigInteger const &c) const throw () |
bool | operator|| (long const c) const throw (BigIntegerException) |
bool | operator && (BigInteger const &c) const throw () |
bool | operator && (long const c) const throw (BigIntegerException) |
BigInteger & | operator= (BigInteger const &c) throw (BigIntegerException) |
BigInteger & | operator= (long const c) throw (BigIntegerException) |
Protected Attributes | |
BIGNUM * | bigInt |
Classe usada para representar números grandes. A limitação do tamanho do número depende da memória disponível.
BigInteger::BigInteger | ( | ) | ||
throw | ( | BigIntegerException | ||
) |
Construtor padrão. Cria um objeto BigInteger com o valor inteiro 0.
BigIntegerException | no caso de falta de memória ao criar o BigInteger. |
BigInteger::BigInteger | ( | BIGNUM const * | bn | ) | |
throw | ( | BigIntegerException | |||
) |
BigInteger a partir de um estrutura BIGNUM do OpenSSL.
bn | ponteiro para estrutra constante BIGNUM. |
BigIntegerException | no caso de erro interno do OpenSSL ao criar o BigInteger. |
BigInteger::BigInteger | ( | long | val | ) | |
throw | ( | BigIntegerException | |||
) |
BigInteger a partir de um tipo primitivo (unsigned long).
val | valor inteiro. |
BigIntegerException | no caso de falta de memória ao criar o BigInteger. |
BigInteger::BigInteger | ( | ASN1_INTEGER * | val | ) | |
throw | ( | BigIntegerException | |||
) |
BigInteger a partir de uma estrutura ASN1_INTEGER do OpenSSL.
val | ponteiro para estrutura ASN1_INTEGER. |
BigIntegerException | no caso de falta de memória ao criar o BigInteger. |
BigInteger::BigInteger | ( | ByteArray & | b | ) | |
throw | ( | BigIntegerException | |||
) |
BigInteger a partir de um objeto ByteArray.
val | referência para objeto constante ByteArray. |
BigIntegerException | no caso de falta de memória ao criar o BigInteger ou devido a um erro interno do OpenSSL. |
BigInteger::BigInteger | ( | BigInteger const & | b | ) | |
throw | ( | BigIntegerException | |||
) |
Construtor de cópia.
b | referência para um objeto constante BigInteger. |
BigIntegerException | no caso de falta de memória ao criar o BigInteger. |
BigInteger::BigInteger | ( | std::string | dec | ) | |
throw | ( | BigIntegerException | |||
) |
BigInteger a partir do string de um número inteiro na base decimal.
dec | string contendo um número inteiro em base 10. |
BigIntegerException | no caso de falta de memória ao criar o BigInteger. |
|
virtual |
Destrutor padrão
BigInteger & BigInteger::add | ( | BigInteger const & | a | ) | |
throw | ( | BigIntegerException | |||
) |
Soma os valores inteiros entre dois BigIntegers.
a | referência para objeto constante BigInteger. |
BigIntegerException | no caso de um erro interno do OpenSSL. |
BigInteger & BigInteger::add | ( | long const | a | ) | |
throw | ( | BigIntegerException | |||
) |
int BigInteger::compare | ( | BigInteger const & | a | ) | const |
throw | ( | ||||
) |
BigInteger & BigInteger::div | ( | BigInteger const & | a | ) | |
throw | ( | BigIntegerException | |||
) |
BigInteger & BigInteger::div | ( | long const | a | ) | |
throw | ( | BigIntegerException | |||
) |
ASN1_INTEGER * BigInteger::getASN1Value | ( | ) | const | |
throw | ( | BigIntegerException | ||
) |
Retorna estrutura ASN1_INTEGER com o valor do BigInteger.
BigIntegerException | no caso de falta de memória ao criar o ASN1_INTEGER. |
BIGNUM const * BigInteger::getBIGNUM | ( | ) | const | |
throw | ( | |||
) |
Retorna ponteiro para estrutura constante BIGNUM membro de BigInteger.
ByteArray * BigInteger::getBinValue | ( | ) | const | |
throw | ( | BigIntegerException | ||
) |
Retorna ponteiro para um objeto ByteArray com o valor do BigInteger. O objeto ByteArray tem codificação mpi (inclui sinal) e deve ser deletado.
BigIntegerException | no caso de falta de memória ao criar o ByteArray. |
double BigInteger::getValue | ( | ) | const | |
throw | ( | BigIntegerException | ||
) |
Retorna o valor inteiro correspondente do BigInteger.
BigIntegerException | caso o valor do BigInteger não possa ser representado em um unsigned long (overflow). |
bool BigInteger::isNegative | ( | ) | const | |
throw | ( | |||
) |
Retorna se o BigInteger é negativo.
BigInteger & BigInteger::mod | ( | BigInteger const & | a | ) | |
throw | ( | BigIntegerException | |||
) |
BigInteger & BigInteger::mod | ( | long const | a | ) | |
throw | ( | BigIntegerException | |||
) |
BigInteger & BigInteger::mul | ( | BigInteger const & | a | ) | |
throw | ( | BigIntegerException | |||
) |
BigInteger & BigInteger::mul | ( | long const | a | ) | |
throw | ( | BigIntegerException | |||
) |
bool BigInteger::operator&& | ( | BigInteger const & | c | ) | const |
throw | ( | ||||
) |
bool BigInteger::operator&& | ( | long const | c | ) | const |
throw | ( | BigIntegerException | |||
) |
bool BigInteger::operator! | ( | ) | const | |
throw | ( | |||
) |
bool BigInteger::operator!= | ( | BigInteger const & | c | ) | const |
throw | ( | ||||
) |
bool BigInteger::operator!= | ( | long const | c | ) | const |
throw | ( | BigIntegerException | |||
) |
BigInteger BigInteger::operator% | ( | BigInteger const & | a | ) | const |
throw | ( | BigIntegerException | |||
) |
BigInteger BigInteger::operator% | ( | long const | c | ) | const |
throw | ( | BigIntegerException | |||
) |
BigInteger BigInteger::operator* | ( | BigInteger const & | a | ) | const |
throw | ( | BigIntegerException | |||
) |
BigInteger BigInteger::operator* | ( | long const | c | ) | const |
throw | ( | BigIntegerException | |||
) |
BigInteger BigInteger::operator+ | ( | BigInteger const & | c | ) | const |
throw | ( | BigIntegerException | |||
) |
Operador de soma.
c | referência para objeto constante BigInteger. |
BigIntegerException | no caso de um erro interno do OpenSSL. |
BigInteger BigInteger::operator+ | ( | long const | c | ) | const |
throw | ( | BigIntegerException | |||
) |
BigInteger & BigInteger::operator+= | ( | BigInteger const & | c | ) | |
throw | ( | BigIntegerException | |||
) |
BigInteger & BigInteger::operator+= | ( | long const | c | ) | |
throw | ( | BigIntegerException | |||
) |
BigInteger BigInteger::operator- | ( | BigInteger const & | c | ) | const |
throw | ( | BigIntegerException | |||
) |
Operador de subtração.
c | referência para objeto constante BigInteger. |
BigIntegerException | no caso de um erro interno do OpenSSL. |
BigInteger BigInteger::operator- | ( | long const | c | ) | const |
throw | ( | BigIntegerException | |||
) |
BigInteger BigInteger::operator/ | ( | BigInteger const & | a | ) | const |
throw | ( | BigIntegerException | |||
) |
BigInteger BigInteger::operator/ | ( | long const | c | ) | const |
throw | ( | BigIntegerException | |||
) |
bool BigInteger::operator< | ( | BigInteger const & | c | ) | const |
throw | ( | ||||
) |
bool BigInteger::operator< | ( | long const | c | ) | const |
throw | ( | BigIntegerException | |||
) |
bool BigInteger::operator<= | ( | BigInteger const & | c | ) | const |
throw | ( | ||||
) |
bool BigInteger::operator<= | ( | long const | c | ) | const |
throw | ( | BigIntegerException | |||
) |
BigInteger & BigInteger::operator= | ( | BigInteger const & | c | ) | |
throw | ( | BigIntegerException | |||
) |
Operador de atribuição.
c | referência para objeto constante BigInteger. |
BigIntegerException | no caso de um erro interno do OpenSSL. |
BigInteger & BigInteger::operator= | ( | long const | c | ) | |
throw | ( | BigIntegerException | |||
) |
bool BigInteger::operator== | ( | BigInteger const & | c | ) | const |
throw | ( | ||||
) |
bool BigInteger::operator== | ( | long const | c | ) | const |
throw | ( | BigIntegerException | |||
) |
bool BigInteger::operator> | ( | BigInteger const & | c | ) | const |
throw | ( | ||||
) |
bool BigInteger::operator> | ( | long const | c | ) | const |
throw | ( | BigIntegerException | |||
) |
bool BigInteger::operator>= | ( | BigInteger const & | c | ) | const |
throw | ( | ||||
) |
bool BigInteger::operator>= | ( | long const | c | ) | const |
throw | ( | BigIntegerException | |||
) |
bool BigInteger::operator|| | ( | BigInteger const & | c | ) | const |
throw | ( | ||||
) |
bool BigInteger::operator|| | ( | long const | c | ) | const |
throw | ( | BigIntegerException | |||
) |
void BigInteger::setDecValue | ( | std::string | dec | ) | |
throw | ( | BigIntegerException | |||
) |
Define o valor inteiro em base 10 de um BigInteger. Não utilizar string "0x" para identificar base 16.
dec | valor inteiro. |
BigIntegerException | no caso de um erro interno do OpenSSL. |
void BigInteger::setHexValue | ( | std::string | hex | ) | |
throw | ( | BigIntegerException | |||
) |
Define o valor inteiro em base 16 de um BigInteger. Não utilizar string "0x" para identificar base 16.
hex | valor inteiro. |
BigIntegerException | no caso de um erro interno do OpenSSL. |
void BigInteger::setNegative | ( | bool | neg = true | ) | |
throw | ( | ||||
) |
Define o sinal do BigInteger.
bool | true se negativo, false se positivo. Se nenhum parâmetro é passado, assume-se negativo. |
void BigInteger::setRandValue | ( | int | numBits = 64 | ) | |
throw | ( | BigIntegerException | |||
) |
Define um valor inteiro randômico (positivo ou negativo).
numBits | número de bits do BigInteger. Se nenhum parâmetro é passado, assume-se numBits = 64. |
BigIntegerException | no caso de um erro interno do OpenSSL. |
void BigInteger::setValue | ( | const long | val = 0 | ) | |
throw | ( | BigIntegerException | |||
) |
Define o valor inteiro de um BigInteger. Se nenhum valor é passado, define o valor zero.
val | valor inteiro. |
BigIntegerException | no caso de um erro interno do OpenSSL. |
int BigInteger::size | ( | ) | const | |
throw | ( | |||
) |
Retorna o tamanho do valor inteiro do BigInteger em bits.
BigInteger & BigInteger::sub | ( | BigInteger const & | a | ) | |
throw | ( | BigIntegerException | |||
) |
Subtração entre os valores inteiros de dois BigIntegers.
a | referência para objeto constante BigInteger. |
BigIntegerException | no caso de um erro interno do OpenSSL. |
BigInteger & BigInteger::sub | ( | long const | a | ) | |
throw | ( | BigIntegerException | |||
) |
string BigInteger::toDec | ( | ) | const | |
throw | ( | |||
) |
Retorna string com valor do BigInteger em base 10.
string BigInteger::toHex | ( | ) | const | |
throw | ( | |||
) |
Retorna string com valor do BigInteger em base 16.
|
protected |