Language Version : | ActionScript 3.0 |
Runtime Versions : | AIR 1.0, Flash Player 10 |
This Kevlar connection class sets up encryption and handles socket transmission of data and messages to and from Photoshop.
public function KevlarConnection()
Language Version : | ActionScript 3.0 |
Runtime Versions : | AIR 1.0, Flash Player 10 |
Constructor. Creates a new Kevlar connection. No connection is attempted in this function, nor is the encryption set up.
Use the connect() and initEncryption() classes for these tasks.
public function connect(serverName:String, serverPort:int = 49494):void
Language Version : | ActionScript 3.0 |
Runtime Versions : | AIR 1.0, Flash Player 10 |
Opens a Kevlar data connection to Photoshop. You may call this function before you call initEncryption(),
but you will have to initialize the encryption before you can successfully communicate with Photoshop.
Parameters
| serverName:String — IP address or resolvable hostname of the server
|
|
| serverPort:int (default = 49494 ) — Port to connect to. Default is 49494
|
public function disconnect():void
Language Version : | ActionScript 3.0 |
Runtime Versions : | AIR 1.0, Flash Player 10 |
Disconnects the connection to Photoshop
public function encryptAndSendData(data:ByteArray):Boolean
Language Version : | ActionScript 3.0 |
Runtime Versions : | AIR 1.0, Flash Player 10 |
Will both encrypt and send data to Photoshop. However, it doesn't ensure that your data is properly formatted.
If you're interested in creating and dispatching properly formatted messages, look into the KevlarMessageDispatcher class.
Parameters
| data:ByteArray — The payload to encrypt and send
|
Returns | Boolean — Returns true or false based on whether the operations were successful
|
public function encryptData(data:ByteArray):Boolean
Language Version : | ActionScript 3.0 |
Runtime Versions : | AIR 1.0, Flash Player 10 |
Encrypts data such that Photoshop will be able to decrypt it. This won't ensure that your data is properly formatted, however.
If you're interested in creating and dispatching properly formatted messages, look into the KevlarMessageDispatcher class.
This function requires that the developer has already initialized the encryption.
Parameters
| data:ByteArray — The data to encrypt
|
Returns | Boolean — Returns true or false based on whether the operations were successful
|
public function initEncryption(password:String = Swordfish, salt:String = Adobe Photoshop, numIterations:int = 1000, numBytes:int = 24):void
Language Version : | ActionScript 3.0 |
Runtime Versions : | AIR 1.0, Flash Player 10 |
Derives the key necessary for all communication with Photoshop. This is a costly function. However, it must be called
before communication can be successful. It's recommended that you inform the user that initializing enryption will take some time before
calling this function.
Parameters
| password:String (default = Swordfish ) — The pre-shared password between Photoshop and your client.
|
|
| salt:String (default = Adobe Photoshop ) — The pre-shared salt between Photoshop and this client. This value should be available in Photoshop SDK documentation.
|
|
| numIterations:int (default = 1000 ) — The number of iterations the PBKDF2 password hash should use
|
|
| numBytes:int (default = 24 ) — The length of the derived PBKDF2 key, in bytes.
|
public function sendDatagram(data:ByteArray):Boolean
Language Version : | ActionScript 3.0 |
Runtime Versions : | AIR 1.0, Flash Player 10 |
Sends raw data to Photoshop, without encrypting it or wrapping it in a properly formatted message.
If you want to generate your own message and dispatch it, look at the KevlarMessageDispatcher class.
If you want to encrypt your data before pushing it to Photoshop, you'll want to use encryptAndSendData(), or encryptData()
Parameters
| data:ByteArray — The payload of data
|
Returns | Boolean — Returns false if the operation failed immediately.
|
Event Object Type: com.adobe.photoshop.events.KevlarEvent
KevlarEvent.type property = com.adobe.kevlar.events.KevlarEvent.CONNECTED
Language Version : | ActionScript 3.0 |
Runtime Versions : | AIR 1.0, Flash Player 10 |
Dispatched when the connection to Photoshop has been established
Event Object Type: com.adobe.photoshop.events.KevlarEvent
KevlarEvent.type property = com.adobe.kevlar.events.KevlarEvent.DISCONNECTED
Language Version : | ActionScript 3.0 |
Runtime Versions : | AIR 1.0, Flash Player 10 |
Dispatched when the connection is terminated
Event Object Type: com.adobe.photoshop.events.KevlarEvent
KevlarEvent.type property = com.adobe.kevlar.events.KevlarEvent.ENCRYPTION_SUCCESS
Language Version : | ActionScript 3.0 |
Runtime Versions : | AIR 1.0, Flash Player 10 |
Dispatched when the key has been encrypted, and the connection is ready to send and receive data.
Event Object Type: com.adobe.photoshop.events.KevlarEvent
KevlarEvent.type property = com.adobe.kevlar.events.KevlarEvent.ERROR
Language Version : | ActionScript 3.0 |
Runtime Versions : | AIR 1.0, Flash Player 10 |
Dispatched when there's been an error in either data transfer, encryption, or connection management.
Event Object Type: com.adobe.photoshop.events.KevlarEvent
KevlarEvent.type property = com.adobe.kevlar.events.KevlarEvent.IMAGE_RECEIVED
Language Version : | ActionScript 3.0 |
Runtime Versions : | AIR 1.0, Flash Player 10 |
Dispatched when the connection has received an image
Event Object Type: com.adobe.photoshop.events.KevlarMessageEvent
KevlarMessageEvent.type property = com.adobe.kevlar.events.KevlarMessageEvent.MESSAGE_RECEIVED
Language Version : | ActionScript 3.0 |
Runtime Versions : | AIR 1.0, Flash Player 10 |
Dispatched when a message is received from Photoshop.
Event Object Type: com.adobe.photoshop.events.KevlarMessageEvent
KevlarMessageEvent.type property = com.adobe.kevlar.events.KevlarMessageEvent.MESSAGE_SENT
Language Version : | ActionScript 3.0 |
Runtime Versions : | AIR 1.0, Flash Player 10 |
Dispatched when a message is sent to Photoshop.
Event Object Type: com.adobe.photoshop.events.KevlarEvent
KevlarEvent.type property = com.adobe.kevlar.events.KevlarEvent.PROGRESS
Language Version : | ActionScript 3.0 |
Runtime Versions : | AIR 1.0, Flash Player 10 |
Dispatched when there is progress in parsing a response or sending a message. Useful for large transfers.
public static const KEVLAR_CONNECTION_API_VERSION:int = 1
The Kevlar API version that this code supports
Fri Apr 1 2011, 03:48 PM -04:00