AsymmetricEncrypt
PowerScript function
Description
Encrypts a blob value with asymmetric algorithm.
Applies to
CrypterObject objects
Syntax
|
1 |
crypter.AsymmetricEncrypt ( algorithm, variable, pubKey) |
|
Argument |
Description |
|---|---|
|
crypter |
The name of the CrypterObject object |
|
algorithm |
A value of the AsymmetricAlgorithm enumerated type that Values are:
Note: DSA! is designed to be used in signature, not in |
|
variable |
A blob whose value is the data you want to encrypt with When using the system blob function to convert a string to |
|
pubKey |
A blob specifying the public key. Note: A 512-bit pubKey |
Return value
Blob. Returns the result of the encryption if it succeeds. If any
argument’s value is null, the method returns null. If an error occurs,
throw the exception.
Examples
This statement encrypts the data using RSA and then returns the
encrypted data.
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
Blob lblb_data Blob lblb_privKey Blob lblb_pubKey Blob lblb_encrypt lblb_data = Blob("Test Rsa", EncodingANSI!) CrypterObject lnv_CrypterObject lnv_CrypterObject = Create CrypterObject // Generate the private key lnv_CrypterObject.AsymmetricGenerateKey(RSA!, 1024, lblb_privKey, lblb_pubKey) // Encrypt data using RSA lblb_encrypt = lnv_CrypterObject.AsymmetricEncrypt(RSA!, lblb_data, lblb_pubKey) |
See also