- F0D2AC0848E2E2B0EF2826F5E5D747A4E9A8FC20B79C2FCCDB02B390C14F2B1B59902024F294E28710844F6B3512537C23F9B46B887015F4556C8C31262CCFF4
+ 8CE351DC40192AE3425D230BE59B8B487B9A206D2AE0747F87B09E00CCDF14898876877C68A6EA9E2C382B90220401B1EC4925F59906E77895C4A499827751F1
eucrypt/smg_rsa/include/smg_rsa.h
(15 . 6)(15 . 27)
545 */
546 static const int KEY_LENGTH_OCTETS = 512;
547
548 /*
549 * This is the maximum length of a plain-text message (in octets) that can be
550 * oeap+rsa encrypted in a single block. Its value is defined in smg_oaep.ads
551 */
552 extern int max_len_msg;
553
554 /*
555 * ada-exported oaep encrypt
556 */
557 extern void oaep_encrypt_c( char* msg, int msglen,
558 char* entropy, int entlen,
559 char* encr, int encrlen,
560 int* success);
561
562 /*
563 * ada-exported oaep decrypt
564 */
565 extern void oaep_decrypt_c( char* encr, int encrlen,
566 char* decr, int* decrlen,
567 int* success);
568
569 typedef struct {
570 MPI n; /* modulus */
571 MPI e; /* public exponent */
(163 . 6)(184 . 34)
573 */
574 void secret_rsa( MPI output, MPI input, RSA_secret_key *sk );
575
576 /*********
577 * @param output - an MPI with KEY_LENGTH_OCTETS octets allocated space;
578 it will hold the result: (rsa(oaep(input), pk))
579 @param input - the plain-text message to be encrypted; maximum length is
580 245 octets (1960 bits)
581 @param pk - public key with which to encrypt
582 NB: this method does NOT allocate memory for output!
583 preconditions:
584 - output IS different from input!
585 - output has at least KEY_LENGTH_OCTETS octets allocated space
586 - input is AT MOST max_len_msg octets long (ct defined in smg_oaep.ads)
587 */
588 void rsa_oaep_encrypt( MPI output, MPI input, RSA_public_key *pk);
589
590 /*
591 * Opposite operation to rsa_oaep_encrypt.
592 * Attempts oaep_decrypt(rsa_decrypt(input))
593 * @param output - an MPI to hold the result; allocated >= max_len_msg octets
594 * @param input - an MPI previously obtained with rsa_oaep_encrypt
595 * @param sk - the secret key with which to decrypt
596 * @param success - this will be set to -1 if there is an error
597 *
598 * preconditions:
599 * - output IS different from input!
600 * - output has at least KEY_LENGTH_OCTETS octets allocated space
601 * - input is precisely KEY_LENGTH_OCTETS
602 */
603 void rsa_oaep_decrypt( MPI output, MPI input, RSA_secret_key *sk, int *success);
604
605 #endif /*SMG_RSA*/
606