C# と VB.NET の質問掲示板

ASP.NET、C++/CLI、Java 何でもどうぞ

ログ内検索
  • キーワードを複数指定する場合は 半角スペース で区切ってください。
  • 検索条件は、(AND)=[A かつ B] (OR)=[A または B] となっています。
  • [返信]をクリックすると返信ページへ移動します。
キーワード/ 検索条件 /
検索範囲/ 強調表示/ ON (自動リンクOFF)
結果表示件数/ 記事No検索/ ON
大文字と小文字を区別する

No.50472 の関連記事表示

<< 0 >>
■50472  AES 復号化
□投稿者/ mick -(2010/06/08(Tue) 13:54:08)

    分類:[.NET 全般] 

    Flex側でAES+PKCS#5で暗号化したものを
    C#側で復号化はできないのでしょうか?

    .netライブラリでPaddingMode 列挙体を調べたら
    PKCS #7で埋めるっぽい感じでした。

    ご存知のかた、おしえていただけますでしょうか?
親記事 /過去ログ85より / 関連記事表示
削除チェック/

■50481  Re[1]: AES 復号化
□投稿者/ れい -(2010/06/08(Tue) 15:54:38)
    No50472 (mick さん) に返信
    > Flex側でAES+PKCS#5で暗号化したものを
    > C#側で復号化はできないのでしょうか?

    Flexってなんでしょうか?
    よくわかりませんが、
    AES+PKCS#5ならできるとおもいますよ。

    > .netライブラリでPaddingMode 列挙体を調べたら
    > PKCS #7で埋めるっぽい感じでした。

    PKCS#7のPaddingはPKCS#5のPaddingの一般化です。
    PKCS#5はブロック長が64bitに限定されているだけです。

    PKCS#7で問題ないはずです。
記事No.50472 のレス /過去ログ85より / 関連記事表示
削除チェック/

■50492  Re[2]: AES 復号化
□投稿者/ mick -(2010/06/08(Tue) 19:04:46)
    No50481 (れい さん) に返信
    > Flexってなんでしょうか?
    > よくわかりませんが、
    > AES+PKCS#5ならできるとおもいますよ。
    Adobe Flex+ActionScriptでした。

    > PKCS#7のPaddingはPKCS#5のPaddingの一般化です。
    > PKCS#5はブロック長が64bitに限定されているだけです。

    PKCS#5でパディングしたものをPKCS#7で取り除けるということですね。

    パディングの細かい仕様を探してもなかなか見つからず
    苦労していたので本当に助かりました。
    どうもありがとうございました。

    > PKCS#7で問題ないはずです。
    >
記事No.50472 のレス /過去ログ85より / 関連記事表示
削除チェック/

■50495  Re[3]: AES 復号化
□投稿者/ れい -(2010/06/08(Tue) 20:20:37)
    No50492 (mick さん) に返信
    > PKCS#5でパディングしたものをPKCS#7で取り除けるということですね。

    はい。
    paddingに関してはPKCS#7がスーパーセットです。

    > パディングの細かい仕様を探してもなかなか見つからず

    細かい仕様は仕様書に載っているものです。
    PKCS#5/#7の仕様書はRFCです。
    paddingの部分のみ引用します。

    PKCS#5
    http://tools.ietf.org/rfc/rfc2898.txt

    6.1.1 Encryption Operation
    の4項目目。


    4. Concatenate M and a padding string PS to form an encoded
    message EM:

    EM = M || PS ,

    where the padding string PS consists of 8-(||M|| mod 8) octets
    each with value 8-(||M|| mod 8). The padding string PS will
    satisfy one of the following statements:

    PS = 01, if ||M|| mod 8 = 7 ;
    PS = 02 02, if ||M|| mod 8 = 6 ;
    ...
    PS = 08 08 08 08 08 08 08 08, if ||M|| mod 8 = 0.


    The length in octets of the encoded message will be a multiple
    of eight and it will be possible to recover the message M
    unambiguously from the encoded message. (This padding rule is
    taken from RFC 1423 [3].)

    PKCS#7
    http://tools.ietf.org/rfc/rfc2315.txt

    10.3 Content-encryption process
    の2項目目

    2. Some content-encryption algorithms assume the
    input length is a multiple of k octets, where k > 1, and
    let the application define a method for handling inputs
    whose lengths are not a multiple of k octets. For such
    algorithms, the method shall be to pad the input at the
    trailing end with k - (l mod k) octets all having value k -
    (l mod k), where l is the length of the input. In other
    words, the input is padded at the trailing end with one of
    the following strings:

    01 -- if l mod k = k-1
    02 02 -- if l mod k = k-2
    .
    .
    .
    k k ... k k -- if l mod k = 0

    The padding can be removed unambiguously since all input is
    padded and no padding string is a suffix of another. This
    padding method is well-defined if and only if k < 256;
    methods for larger k are an open issue for further study.

記事No.50472 のレス /過去ログ85より / 関連記事表示
削除チェック/

■50501  Re[4]: AES 復号化
□投稿者/ mick -(2010/06/09(Wed) 08:48:29)
    No50495 (れい さん) に返信

    れいさん

    詳しい参考資料を提供していただき本当に助かりました。
    ありがとうございました。

記事No.50472 のレス /過去ログ85より / 関連記事表示
削除チェック/



<< 0 >>

パスワード/

- Child Tree -