Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9138797
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T09:18:13+00:00 2026-06-17T09:18:13+00:00

public byte[] CryptDeriveKey( string algname, string alghashname, int keySize, byte[] rgbIV ) Can someone

  • 0
public byte[] CryptDeriveKey(
    string algname,
    string alghashname,
    int keySize,
    byte[] rgbIV
)

Can someone please enlighten me as to what options there are in algname? If I want to specify an encryption algorithm for AES-128 and AES-256, what should I put in the algname?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T09:18:14+00:00Added an answer on June 17, 2026 at 9:18 am

    I’m not 100% sure but, algname is your algorithm name. keySize is size of the key.

    You should use AES-128 and AES-256 like this;

    CryptDeriveKey("AES", "SHA1", 128, aes.IV)
    

    and

    CryptDeriveKey("AES", "SHA1", 256, aes.IV)
    

    Check out for more details from MSDN.

    Here is a decompiled code for PasswordDeriveBytes.CryptDeriveKey method.

    [SecuritySafeCritical]
    public byte[] CryptDeriveKey(string algname, string alghashname, int keySize, byte[] rgbIV)
    {
        if (keySize < 0)
        {
            throw new CryptographicException(Environment.GetResourceString("Cryptography_InvalidKeySize"));
        }
        int algidHash = X509Utils.NameOrOidToAlgId(alghashname, OidGroup.HashAlgorithm);
        if (algidHash == 0)
        {
            throw new CryptographicException(Environment.GetResourceString("Cryptography_PasswordDerivedBytes_InvalidAlgorithm"));
        }
        int algid = X509Utils.NameOrOidToAlgId(algname, OidGroup.AllGroups);
        if (algid == 0)
        {
            throw new CryptographicException(Environment.GetResourceString("Cryptography_PasswordDerivedBytes_InvalidAlgorithm"));
        }
        if (rgbIV == null)
        {
            throw new CryptographicException(Environment.GetResourceString("Cryptography_PasswordDerivedBytes_InvalidIV"));
        }
        byte[] o = null;
        DeriveKey(this.ProvHandle, algid, algidHash, this._password, this._password.Length, keySize << 0x10, rgbIV, rgbIV.Length, JitHelpers.GetObjectHandleOnStack<byte[]>(ref o));
        return o;
    }
    

    Here is a decompiled code of NameOrOidToAlgId method.

    internal static int NameOrOidToAlgId(string oid, OidGroup oidGroup)
    {
        if (oid == null)
        {
            return 0x8004;
        }
        string str = CryptoConfig.MapNameToOID(oid, oidGroup);
        if (str == null)
        {
            str = oid;
        }
        int algIdFromOid = GetAlgIdFromOid(str, oidGroup);
        switch (algIdFromOid)
        {
            case 0:
            case -1:
                throw new CryptographicException(Environment.GetResourceString("Cryptography_InvalidOID"));
        }
        return algIdFromOid;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following function: public static byte[] StringToByte(string str) { int length =
Can someone explain the following code.. What will that return statement do. public byte[]
I have the next code: public byte[] A(int i){//do something} public byte[] B(string a)
public Image Base64ToImage(string base64String) { // Convert Base64 String to byte[] byte[] imageBytes =
I have byte[] a = HashEncrypt(a); with public byte[] HashEncrypt(string password) { SHA512Managed sha
I have webservice, with method: [WebMethod] public byte[] GetFile(string FName) { System.IO.FileStream fs1 =
struct a { public int x; } struct c { public byte x; }
public byte[] method(int var1) { if(var1 == ~L.length) //<- this return a(i1, 0, false);
public : array<Byte>^ Foo(array<Byte>^ data) gets dynamic size managed array but how can I
I have a class like this: class person { public string Name{get;set;} public byte[]

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.