Proud::CCryptoRsa Class Reference

Static Public Member Functions

static PROUD_API bool CreateRandomBlock (ByteArray &output, int length)
 
static PROUD_API bool CreatePublicAndPrivateKey (CCryptoRsaKey &outXchgKey, ByteArray &outPubKeyBlob)
 
static PROUD_API bool EncryptSessionKeyByPublicKey (ByteArray &outEncryptedSessionKey, const ByteArray &randomBlock, const ByteArray &publicKeyBlob)
 
static PROUD_API ErrorInfoPtr DecryptSessionKeyByPrivateKey (ByteArray &outRandomBlock, const ByteArray &encryptedSessionKey, const CCryptoRsaKey &privateKey)
 

Detailed Description

Encryption class of RSA publick key, private key

Member Function Documentation

static PROUD_API bool Proud::CCryptoRsa::CreatePublicAndPrivateKey ( CCryptoRsaKey outXchgKey,
ByteArray outPubKeyBlob 
)
static

TODO:translate needed. Generate a public key and a private key.

Parameters
outXchgKeyThis is an RSA key to be generated
outPubKeyBlobThis is the value of ByteArray of a public key exported from the RSA key to be generated.
Returns
true if successful in generating a key or otherwise return false.
static PROUD_API bool Proud::CCryptoRsa::CreateRandomBlock ( ByteArray output,
int  length 
)
static

TODO:translate needed. Generate a random block.

Parameters
outputThis is the ByteArray of the random block to be generated.
lengthThis is the length of the random block to be generated.
Returns
true if successful in generating a random block or otherwise return false.
static PROUD_API ErrorInfoPtr Proud::CCryptoRsa::DecryptSessionKeyByPrivateKey ( ByteArray outRandomBlock,
const ByteArray encryptedSessionKey,
const CCryptoRsaKey privateKey 
)
static

TODO:translate needed. Decode the encrypted block with the private key.

Parameters
outRandomBlockByteArray to decrypt.
encryptedSessionKeyEncrypted ByteArray.
privateKeyThis is a private key.
Returns
When you fail to obtain an encrypted symmetric key with a private key, returns ErrorInforPtr.
static PROUD_API bool Proud::CCryptoRsa::EncryptSessionKeyByPublicKey ( ByteArray outEncryptedSessionKey,
const ByteArray randomBlock,
const ByteArray publicKeyBlob 
)
static

TODO:translate needed. Encode the block with the public key

  • If the size of randomBlock exceeds the Modulus N value of the key, you cannot do encryption.
    Parameters
    outEncryptedSessionKeyThis is the random block to be encrypted.
    randomBlockThis is the random block you will encrypt.
    publicKeyBlobThis is the RSA public key.
    Returns
    true if successful in obtaining an encrypted symmetric key with the public key or otherwise return false.