lib/megar/crypto/support.rb
# Returns an OpenSSL RSA cipher object initialised with +pqdu+ (array of integer cipher components)
# p: The first factor of n, the RSA modulus
# q: The second factor of n
# d: The private exponent.
# u: The CRT coefficient, equals to (1/p) mod q.
#
# NB: this hacks the RSA object creation n a way that should work, but can't get this to work exactly right with Mega yet
Returns an OpenSSL RSA cipher object initialised with +pqdu+ (array of integer cipher components)
p: The first factor of n, the RSA modulus
q: The second factor of n
d: The private exponent.
u: The CRT coefficient, equals to (1/p) mod q.

this hacks the RSA object creation n a way that should work, but can't get this to work exactly right with Mega yet
Returns an OpenSSL RSA cipher object initialised with + pqdu + ( array of integer cipher components ) p : The first factor of n the RSA modulus q : The second factor of n d : The private exponent . u : The CRT coefficient equals to ( 1 / p ) mod q . this hacks the RSA object creation n a way that should work but can ' t get this to work exactly right with Mega yet
def openssl_rsa_cipher(pqdu)
    rsa = OpenSSL::PKey::RSA.new
    p, q, d, u = pqdu
    rsa.p, rsa.q, rsa.d = p, q, d
    rsa.n = rsa.p * rsa.q
    rsa.e = 0 
    rsa
  end
def openssl_rsa_cipher ( pqdu ) rsa = OpenSSL :: PKey :: RSA . new p , q , d , u = pqdu rsa . p , rsa . q , rsa . d = p , q , d rsa . n = rsa . p * rsa . q rsa . e = 0 rsa end
Returns an OpenSSL RSA cipher object initialised with +pqdu+ (array of integer cipher components)
p: The first factor of n, the RSA modulus
q: The second factor of n
d: The private exponent.
Returns an OpenSSL RSA cipher object initialised with + pqdu + ( array of integer cipher components ) p : The first factor of n the RSA modulus q : The second factor of n d : The private exponent .
# # dmp1 = d mod (p-1) # rsa.dmp1 = rsa.d % (rsa.p - 1) # # dmq1 = d mod (q-1) # rsa.dmq1 = rsa.d % (rsa.q - 1) # # iqmp = q^-1 mod p? # rsa.iqmp =  (rsa.q ** -1) % rsa.p # # ipmq =  (rsa.p ** -1) % rsa.q # ipmq =  rsa.p ** -1 % rsa.q # 65537
pqdu