OPENSSL_PUBLIC_ENCRYPT(3) 1 OPENSSL_PUBLIC_ENCRYPT(3)openssl_public_encrypt - Encrypts data with public keySYNOPSIS
bool openssl_public_encrypt (string $data, string &$crypted, mixed $key, [int $padding = OPENSSL_PKCS1_PADDING])
DESCRIPTION openssl_public_encrypt(3) encrypts $data with public $key and stores the result into $crypted. Encrypted data can be decrypted via
openssl_private_decrypt(3).
This function can be used e.g. to encrypt message which can be then read only by owner of the private key. It can be also used to store
secure data in database.
PARAMETERS
o $data
-
o $crypted
- This will hold the result of the encryption.
o $key
- The public key.
o $padding
-$padding can be one of OPENSSL_PKCS1_PADDING, OPENSSL_SSLV23_PADDING, OPENSSL_PKCS1_OAEP_PADDING, OPENSSL_NO_PADDING.
RETURN VALUES
Returns TRUE on success or FALSE on failure.
SEE ALSO openssl_private_encrypt(3), openssl_private_decrypt(3).
PHP Documentation Group OPENSSL_PUBLIC_ENCRYPT(3)
Check Out this Related Man Page
RSA_public_encrypt(3) OpenSSL RSA_public_encrypt(3)NAME
RSA_public_encrypt, RSA_private_decrypt - RSA public key cryptography
SYNOPSIS
#include <openssl/rsa.h>
int RSA_public_encrypt(int flen, unsigned char *from,
unsigned char *to, RSA *rsa, int padding);
int RSA_private_decrypt(int flen, unsigned char *from,
unsigned char *to, RSA *rsa, int padding);
DESCRIPTION
RSA_public_encrypt() encrypts the flen bytes at from (usually a session key) using the public key rsa and stores the ciphertext in to. to
must point to RSA_size(rsa) bytes of memory.
padding denotes one of the following modes:
RSA_PKCS1_PADDING
PKCS #1 v1.5 padding. This currently is the most widely used mode.
RSA_PKCS1_OAEP_PADDING
EME-OAEP as defined in PKCS #1 v2.0 with SHA-1, MGF1 and an empty encoding parameter. This mode is recommended for all new
applications.
RSA_SSLV23_PADDING
PKCS #1 v1.5 padding with an SSL-specific modification that denotes that the server is SSL3 capable.
RSA_NO_PADDING
Raw RSA encryption. This mode should only be used to implement cryptographically sound padding modes in the application code.
Encrypting user data directly with RSA is insecure.
flen must be less than RSA_size(rsa) - 11 for the PKCS #1 v1.5 based padding modes, less than RSA_size(rsa) - 41 for RSA_PKCS1_OAEP_PADDING
and exactly RSA_size(rsa) for RSA_NO_PADDING. The random number generator must be seeded prior to calling RSA_public_encrypt().
RSA_private_decrypt() decrypts the flen bytes at from using the private key rsa and stores the plaintext in to. to must point to a memory
section large enough to hold the decrypted data (which is smaller than RSA_size(rsa)). padding is the padding mode that was used to encrypt
the data.
RETURN VALUES
RSA_public_encrypt() returns the size of the encrypted data (i.e., RSA_size(rsa)). RSA_private_decrypt() returns the size of the recovered
plaintext.
On error, -1 is returned; the error codes can be obtained by ERR_get_error(3).
CONFORMING TO
SSL, PKCS #1 v2.0
SEE ALSO ERR_get_error(3), rand(3), rsa(3), RSA_size(3)HISTORY
The padding argument was added in SSLeay 0.8. RSA_NO_PADDING is available since SSLeay 0.9.0, OAEP was added in OpenSSL 0.9.2b.
1.0.1e 2013-02-11 RSA_public_encrypt(3)
I am writing a C program which a part of it needs to padding zero in front of a string. The program will get a sting from an ASCII file which the maxium length of this string is 5 char long. The string can sometimes less the 5 char long. In order to make it with the same length '0's are being... (3 Replies)
Hello all,
I have this text file data. The data are separated by comma in three column and space or line feed to start a new row
anderson helberg, Jane, brother
Sister ,mother,grandpa
bombay,new york, china
I would like store them in the following format.
field1 ... (2 Replies)
Please help, I am new to shell Programming. I have three files each containg a unique text (key) field (e.g. ABCDEF, XCDUD as shown below), line return followed by some data of which there can be more then one instance. In addition, in some cases there may be no data but only a key field. Please... (18 Replies)
Hi,
I was provided with
Server IP
Username and Password (worked when tested basic FTP)
Public key (GnuPG v1.0.6)
They refuse when I send it using basic FTP and insists for encryption.
I have Solaris 10 and Linux in my environment.
How can I encrypt and send them securely?... (5 Replies)
Hi everyone,
I have a quick/newb question:
I know that a public key is used to encrypt data and a private key is used to decrypt data but who keeps the public/private keys??
Does the Web Server hold both?
Does the Web Server have the public key and does the client have the private key? ... (3 Replies)
Hi experts
I want your help to change the file format to my wanted version, please give me a hand thanks
$cat file
install pass
make os pass
make build kernel failed
usb storage pass
chane to
| *install* | *make os* | *make build kernel* | *usb storage* |
| pass | pass... (7 Replies)
Hi,
I want to merge the two files based on the key file's columns.
The key file:
DATE~DATE
HOUSE~IN_HOUSE
CUST~IN_CUST
PRODUCT~PRODUCT
ADDRESS~CUST_ADDR
BASIS_POINTS~BASIS_POINTS
...
The other 2 files are From_file & To_file -
The From_file:
DATE|date/time|29|9 ... (9 Replies)
I have 2 ethernet cards at my server,OEL5.5. One is for Public LAN and another is for private to install Oracle RAC. I am facing the following problem
# ping 192.168.165.120
PING 192.168.165.120 (192.168.165.120) 56(84) bytes of data.
64 bytes from 192.168.165.120: icmp_seq=1 ttl=64... (3 Replies)
We are trying to do a key exchange from Sun solaris server to HP UNIX server. Errro we are getting is as below:-
sshd2: connection from "10.13.240.6"
sshd2: auths-pam: PAM subprocess returned packet SSH_PAM_OP_ERROR. (err_num: 32, err_msg: General Commercial Security error)
sshd2: User... (4 Replies)
Hi,
I'm getting key-value pairs in a string as follows -
0000xm7zcNDIkP888vRqGv93xA7:176n00qql||9700005405552747,9700005405717924,9700005405733788|unidentified,unidentified,unidentified
I need output as follows -
row1:... (5 Replies)
Hi All,
I have a XML file which is looks like as below. <<please see the attachment >>
<?xml version="1.0" encoding="UTF-8"?>
<esites>
<esite>
<name>XXX.com</name>
<storeId>10001</storeId>
<module>
... (4 Replies)
All,
I have 2 files A and B with some data. Now i want to concat data from both the files in to 3rd file.Please help me with a single command line.
A--123456789
B--jlsjdfkajsjas
output file C should be 123456789,jlsjdfkajsjas (2 Replies)
Hi,
we have private and public key, encrypt file using public and want to decrypt using private key. can you please advise below commands are correct or other remedy if unix have?
encrypt -a arcfour -k publickey.asc -i TESTFILE.csv -o TESTFILE00.csv
decrypt -a arcfour -k privatekey.asc... (2 Replies)
Hi,
I am working on PGP encryption. I am getting public keys from some file.
One of the key has dollar sign in it "$" Example: "abc$123"
echo 'passphrase='$passphrase --> Giving correct value abc$123
But if I use $passphrase in PGP command getting Invalid passphrase error.
If I... (10 Replies)