Packagecom.hurlant.crypto.rsa
Classpublic class RSAKey
InheritanceRSAKey Inheritance Object

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



Public Properties
 PropertyDefined 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
 PropertyDefined By
  canDecrypt : Boolean
RSAKey
  canEncrypt : Boolean
RSAKey
Public Methods
 MethodDefined 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
  
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
 MethodDefined By
  
bigRandom(bits:int, rnd:Random):BigInteger
[static]
RSAKey
  
RSAKey
  
RSAKey
  
RSAKey
Property Detail
canDecryptproperty
protected var canDecrypt:Boolean

canEncryptproperty 
protected var canEncrypt:Boolean

coeffproperty 
public var coeff:BigInteger

dproperty 
public var d:BigInteger

dmp1property 
public var dmp1:BigInteger

dmq1property 
public var dmq1:BigInteger

eproperty 
public var e:int

nproperty 
public var n:BigInteger

pproperty 
public var p:BigInteger

qproperty 
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)