RSA-OAEP详解

1.OAEP的编码

1.1名称介绍

  • D B ( D a t a B l o c k ) = l H a s h ∣ ∣ P S ∣ ∣ 01 ∣ ∣ M DB(Data Block)= lHash || PS || 01 || M DBDataBlock=lHashPS01M
    • l H a s h lHash lHash:标签 L L L的哈希值
      • h L e n hLen hLen l H a s h lHash lHash的字节长度
    • P S : P a d d i n g S t r i n g PS:Padding String PS:PaddingString
      • P S PS PS k − m L e n − 2 h L e n − 2 k-mLen-2hLen - 2 kmLen2hLen2长的0x00。PS长度可能为0
      • k k k是 RSA 中模数 n n n的字节长度
    • 01:0x01
    • M : M e s s a g e M:Message M:Message
      • m L e n mLen mLen:明文的字节长度
  • m a s k e d D B = M G F ( s e e d ) ⊕ D B maskedDB = MGF(seed)\oplus DB maskedDB=MGF(seed)DB
  • m a s k e d S e e d = m a s k e d D B ⊕ s e e d maskedSeed = maskedDB \oplus seed maskedSeed=maskedDBseed
  • E M = 00 ∣ ∣ m a s k e d S e e d ∣ ∣ D B EM=00 || maskedSeed || DB EM=00maskedSeedDB
  • 00串和01串的长度均为 1 1 1字节

1.2 编码过程

文中所提到的长度均为字节长度,即有多少个字节。

  1. 首先对输入的标签 L L L H a s h Hash Hash生成 l H a s h lHash lHash
  2. 然后生成 D a t a B l o c k DataBlock DataBlock,根据 k k k h L e n hLen hLen决定 P a d d i n g S t r i n g PaddingString PaddingString的长度

在这里插入图片描述
3. 如下图,生成 M a s k e d D a t a B l o c k MaskedDataBlock MaskedDataBlock
4. 然后生成 M a s k e d S e e d MaskedSeed MaskedSeed
5. 输出 E n c o d e d M e s s a g e EncodedMessage EncodedMessage

在这里插入图片描述

1.3 MGF函数介绍

  • 1
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值