Activecrypt Online Help Prev Next
About ActiveCrypt
About
ActiveCrypt overview
How to ...
How to make pair of keys
Create new public key from private
How to decrypt string
How to encrypt string
How to save keys
Free keys
Programmer reference
Hash
Hash overview
Methods
HashFile
HashVariant
Properties
Error
Crypt
Encryption overview
Methods
DecryptFile
DecryptVariant
EncryptFile
EncryptVariant
FreeKey
LoadKeyFromString
LoadKey
Properties
AddCRLF
Error
KeySize
Base64
Base64 overview
Methods
DecodeFile
DecodeVariant
EncodeFile
EncodeVariant
Properties
AddCRLF
Error
Sign
Sign overview
Methods
FreeKey
LoadKey
LoadKeyFromString
MakeVariantSignature
MakeFileSignature
VerifyFileSignature
VerifyVariantSignature
Properties
AddCRLF
Error
RSACrypt (old, use Crypt)
Methods
FreeKey
GenerateCouple
GeneratePublicKey
GetVersion
LoadKeyFromString
LoadKey
PublicEncrypt
PrivateDecrypt
SaveKeyToString
SaveKey
Properties
About
Async
Error
Events
OnDecryptionFinished
OnEncryptionFinished
OnError
OnKeyGenerationFinished
Disclaimer

SaveKeyToString

Sub SaveKeyToString ( Key As Long [, Password As String]) As String

The SaveKeyToString function saves public or private keys from memory into string. Public keys are stored without a password unlike private keys. The private key MUST be stored with a password. The password should be longer than 4 chars. After saving, the key still remains valid.

Here is an example :


        Dim Privatekey As Variant, Publickey As Variant
        Dim PrivateKeyString As String
        Dim PublicKeyString As String 
        ...
        Set ActiveCryptObject = newActiveCryptLib.RSACrypt
        ActiveCryptObject.GenerateCouple 256, PrivateKey, PublicKey
        ...
        PrivateKeyString = ActiveCryptObject.SaveKey (PrivateKey, "SecurePassword")
        PublicKeyString = ActiveCryptObject.SaveKey (PublicKey)
        ActiveCryptObject.FreeKey PrivateKey
        ActiveCryptObject.FreeKey PublicKey
        ' We must save strings PrivateKeyString, PublicKeyString to some persistent storage ( for example: registry or database )

This HTML Help has been published using the chm2web software.