如何将此代码从C#转换为java? [英] How can I convert this code from C# to java?

查看:57
本文介绍了如何将此代码从C#转换为java?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

public static string AESDecryptData(string EncryptedText, string Encryptionkey)
        {
            RijndaelManaged objrij = new RijndaelManaged();
            objrij.Mode = CipherMode.CBC;
            objrij.Padding = PaddingMode.PKCS7;

            objrij.KeySize = 0x100;
            objrij.BlockSize = 0x100;
            byte[] encryptedTextByte = Convert.FromBase64String(EncryptedText);
            byte[] passBytes = Encoding.UTF8.GetBytes(Encryptionkey);
            byte[] EncryptionkeyBytes = new byte[] { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
            int len = passBytes.Length;
            if (len > EncryptionkeyBytes.Length)
            {
                len = EncryptionkeyBytes.Length;
            }
            Array.Copy(passBytes, EncryptionkeyBytes, len);
            objrij.Key = EncryptionkeyBytes;
            objrij.IV = EncryptionkeyBytes;
            byte[] TextByte = objrij.CreateDecryptor().TransformFinalBlock(encryptedTextByte, 0, encryptedTextByte.Length);
            return Encoding.UTF8.GetString(TextByte);   
        }





我的尝试:



从c#到Java没有任何想法,任何人都可以帮助我吗?



What I have tried:

No any idea from c# to Java, anyone can help me?

推荐答案

引用:< / div我可以将此代码从C#转换为java吗?
Quote:</divHow can I convert this code from C# to java?



简单:学习C#,然后学习Java。一旦掌握了两者的良好工作知识,对你来说应该很容易。



如果另一方面你希望别人为你做你的工作,你来到错误的网站...我建议你去Freelancer.com并在那里问。



但要注意:你得到的是你付出的代价。支付花生,买猴子。



发展的概念就像这句话所暗示的那样:系统地运用科学和技术知识来满足特定的目标或要求。 BusinessDictionary.com [ ^ ]

这与有一个不一样快速谷歌并放弃,如果我找不到完全正确的代码。

所以要么付钱给别人去做,要么学会如何自己写。我们不是为你做的。


Simple: Learn C#, then learn Java. Once you have a good working knowledge of both, it should be pretty easy for you.

If on the other hand you want others to do your work for you, you have come to the wrong site ... I suggest you go to Freelancer.com and ask there.

But be aware: you get what you pay for. Pay peanuts, get monkeys.

The idea of "development" is as the word suggests: "The systematic use of scientific and technical knowledge to meet specific objectives or requirements." BusinessDictionary.com[^]
That's not the same thing as "have a quick google and give up if I can't find exactly the right code".
So either pay someone to do it, or learn how to write it yourself. We aren't here to do it for you.


我同意OriginalGriff。



对于初学者,请检查:< a href =https://gist.github.com/jafetsanchez/1080133>关于C#和Java·GitHub的Rijndael [ ^ ]
I agree with OriginalGriff.

For starters, check this: Rijndael on C# and Java · GitHub[^]


这篇关于如何将此代码从C#转换为java?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆