ActionScript 3 Cryptography Library | All Packages | All Classes | Index | Frames No Frames |
RSAKey

Package | com.hurlant.crypto.rsa
Class | public class RSAKey
Inheritance | RSAKey Object

Current limitations: exponent must be smaller than 2^31.

Public Properties

| Property | Defined By
--- | --- | ---
|  | coeff : BigInteger | RSAKey
|  | d : BigInteger | RSAKey
|  | dmp1 : BigInteger | RSAKey
|  | dmq1 : BigInteger | RSAKey
|  | e : int | RSAKey
|  | n : BigInteger | RSAKey
|  | p : BigInteger | RSAKey
|  | q : BigInteger | RSAKey

Protected Properties

| Property | Defined By
--- | --- | ---
|  | canDecrypt : Boolean | RSAKey
|  | canEncrypt : Boolean | RSAKey

Public Methods

| Method | Defined By
--- | --- | ---
|  | RSAKey(N:BigInteger, E:int, D:BigInteger = null, P:BigInteger = null, Q:BigInteger = null, DP:BigInteger = null, DQ:BigInteger = null, C:BigInteger = null) | RSAKey
|  | decrypt(src:ByteArray, dst:ByteArray, length:uint, pad:Function = null):void | RSAKey
|  | dispose():void | RSAKey
|  | dump():String | RSAKey
|  | encrypt(src:ByteArray, dst:ByteArray, length:uint, pad:Function = null):void | RSAKey
|  | generate(B:uint, E:String):RSAKey [static] note: We should have a "nice" variant of this function that takes a callback, and perform the computation is small fragments, to keep the web browser usable. | RSAKey
|  | getBlockSize():uint | RSAKey
|  | parsePrivateKey(N:String, E:String, D:String, P:String = null, Q:String = null, DMP1:String = null, DMQ1:String = null, IQMP:String = null):RSAKey [static] | RSAKey
|  | parsePublicKey(N:String, E:String):RSAKey [static] | RSAKey
|  | rawpad(src:ByteArray, end:int, n:uint, type:uint = 0):ByteArray Raw pad. | RSAKey
|  | rawunpad(src:BigInteger, n:uint, type:uint = 0):ByteArray | RSAKey
|  | sign(src:ByteArray, dst:ByteArray, length:uint, pad:Function = null):void | RSAKey
|  | toString():String | RSAKey
|  | verify(src:ByteArray, dst:ByteArray, length:uint, pad:Function = null):void | RSAKey

Protected Methods

| Method | Defined By
--- | --- | ---
|  | bigRandom(bits:int, rnd:Random):BigInteger [static] | RSAKey
|  | doPrivate(x:BigInteger):BigInteger | RSAKey
|  | doPrivate2(x:BigInteger):BigInteger | RSAKey
|  | doPublic(x:BigInteger):BigInteger | RSAKey

Property Detail

canDecrypt | property

`protected var canDecrypt:Boolean`

canEncrypt | property |

`protected var canEncrypt:Boolean`

coeff | property |

`public var coeff:BigInteger`

d | property |

`public var d:BigInteger`

dmp1 | property |

`public var dmp1:BigInteger`

dmq1 | property |

`public var dmq1:BigInteger`

e | property |

`public var e:int`

n | property |

`public var n:BigInteger`

p | property |

`public var p:BigInteger`

q | property |

`public var q:BigInteger`

Constructor Detail

RSAKey | () | Constructor

`public function RSAKey(N:BigInteger, E:int, D:BigInteger = null, P:BigInteger = null, Q:BigInteger = null, DP:BigInteger = null, DQ:BigInteger = null, C:BigInteger = null)`

Parameters

| `N:BigInteger`
| `E:int`
| `D:BigInteger` (default = `null`)``
| `P:BigInteger` (default = `null`)``
| `Q:BigInteger` (default = `null`)``
| `DP:BigInteger` (default = `null`)``
| `DQ:BigInteger` (default = `null`)``
| `C:BigInteger` (default = `null`)``

Method Detail

bigRandom | () | method

`protected static function bigRandom(bits:int, rnd:Random):BigInteger`

Parameters

| `bits:int`
| `rnd:Random`

Returns

| `BigInteger`

decrypt | () | method |

`public function decrypt(src:ByteArray, dst:ByteArray, length:uint, pad:Function = null):void`

Parameters

| `src:ByteArray`
| `dst:ByteArray`
| `length:uint`
| `pad:Function` (default = `null`)``

dispose | () | method |

`public function dispose():void`

doPrivate | () | method |

`protected function doPrivate(x:BigInteger):BigInteger`

Parameters

| `x:BigInteger`

Returns

| `BigInteger`

doPrivate2 | () | method |

`protected function doPrivate2(x:BigInteger):BigInteger`

Parameters

| `x:BigInteger`

Returns

| `BigInteger`

doPublic | () | method |

`protected function doPublic(x:BigInteger):BigInteger`

Parameters

| `x:BigInteger`

Returns

| `BigInteger`

dump | () | method |

`public function dump():String`

Returns

| `String`

encrypt | () | method |

`public function encrypt(src:ByteArray, dst:ByteArray, length:uint, pad:Function = null):void`

Parameters

| `src:ByteArray`
| `dst:ByteArray`
| `length:uint`
| `pad:Function` (default = `null`)``

generate | () | method |

`public static function generate(B:uint, E:String):RSAKey`

note: We should have a "nice" variant of this function that takes a callback, and perform the computation is small fragments, to keep the web browser usable.

Parameters

| `B:uint`
| `E:String`

Returns

| `RSAKey` — a new random private key B bits long, using public expt E

getBlockSize | () | method |

`public function getBlockSize():uint`

Returns

| `uint`

parsePrivateKey | () | method |

`public static function parsePrivateKey(N:String, E:String, D:String, P:String = null, Q:String = null, DMP1:String = null, DMQ1:String = null, IQMP:String = null):RSAKey`

Parameters

| `N:String`
| `E:String`
| `D:String`
| `P:String` (default = `null`)``
| `Q:String` (default = `null`)``
| `DMP1:String` (default = `null`)``
| `DMQ1:String` (default = `null`)``
| `IQMP:String` (default = `null`)``

Returns

| `RSAKey`

parsePublicKey | () | method |

`public static function parsePublicKey(N:String, E:String):RSAKey`

Parameters

| `N:String`
| `E:String`

Returns

| `RSAKey`

rawpad | () | method |

`public function rawpad(src:ByteArray, end:int, n:uint, type:uint = 0):ByteArray`

Raw pad.

Parameters

| `src:ByteArray`
| `end:int`
| `n:uint`
| `type:uint` (default = `0`)``

Returns

| `ByteArray`

rawunpad | () | method |

`public function rawunpad(src:BigInteger, n:uint, type:uint = 0):ByteArray`

Parameters

| `src:BigInteger`
| `n:uint`
| `type:uint` (default = `0`)``

Returns

| `ByteArray`

sign | () | method |

`public function sign(src:ByteArray, dst:ByteArray, length:uint, pad:Function = null):void`

Parameters

| `src:ByteArray`
| `dst:ByteArray`
| `length:uint`
| `pad:Function` (default = `null`)``

toString | () | method |

`public function toString():String`

Returns

| `String`

verify | () | method |

`public function verify(src:ByteArray, dst:ByteArray, length:uint, pad:Function = null):void`

Parameters

| `src:ByteArray`
| `dst:ByteArray`
| `length:uint`
| `pad:Function` (default = `null`)``

Mon May 20 2013, 09:16 PM +02:00