pike.git / lib / 7.8 / modules / Crypto.pmod / RSA.pike

version» Context lines:

pike.git/lib/7.8/modules/Crypto.pmod/RSA.pike:1:   /*    * Follow the PKCS#1 standard for padding and encryption.    */      #pike 7.8 - #pragma strict_types + #require constant(Crypto.Hash)    - #if constant(Crypto.Hash) -  +    protected Gmp.mpz n; /* modulo */   protected Gmp.mpz e; /* public exponent */   protected Gmp.mpz d; /* private exponent (if known) */   protected int size;      /* Extra info associated with a private key. Not currently used. */      protected Gmp.mpz p;   protected Gmp.mpz q;   
pike.git/lib/7.8/modules/Crypto.pmod/RSA.pike:126: Inside #if constant(Crypto.Hash)
   return this;   }      //! Returns the crypto block size, or zero if not yet set.   int query_blocksize() {    if(!size) return 0;    return size - 3;   }      //! Pads the @[message] to the current block size with method @[type] - //! and returns the result as an integer. This is equvivalent to + //! and returns the result as an integer. This is equivalent to   //! OS2IP(EME-PKCS1-V1_5-ENCODE(message)) in PKCS-1.   //! @param type   //! @int   //! @value 1   //! The message is padded with @expr{0xff@} bytes.   //! @value 2   //! The message is padded with random data, using the @[random]   //! function if provided. Otherwise   //! @[Crypto.Random.random_string] will be used.   //! @endint
pike.git/lib/7.8/modules/Crypto.pmod/RSA.pike:156: Inside #if constant(Crypto.Hash)
      switch(type)    {    case 1:    cookie = sprintf("%@c", allocate(len, 0xff));    break;    case 2:    if (random)    cookie = replace(random(len), "\0", "\1");    else -  cookie = replace(Crypto.Random.random_string(len), "\0", "\1"); +  cookie = replace(Crypto.Random.random_string([int(0..)]len), "\0", "\1");    break;    default:    error( "Unknown type.\n" );    }    return Gmp.mpz(sprintf("%c", type) + cookie + "\0" + message, 256);   }      //! Reverse the effect of @[rsa_pad].   string rsa_unpad(Gmp.mpz block, int type)   {
pike.git/lib/7.8/modules/Crypto.pmod/RSA.pike:389: Inside #if constant(Crypto.Hash)
  //! @[set_encrypt_key], @[set_decrypt_key]   string crypt(string s)   {    return (encrypt_mode ? encrypt(s) : decrypt(s));   }      //! Returns the string @expr{"RSA"@}.   string name() {    return "RSA";   } -  - #else - constant this_program_does_not_exist=1; - #endif +