For some reason my code give m a error for when I try and grab the byte from this section. And I don't know what the problem is.



static byte[] EncryptStringToBytes_Aes(string plainText, byte[] Key)
{
byte[] encrypted;
byte[] IV;

using (Aes aesAlg = Aes.Create())
{
aesAlg.Key = Key;

aesAlg.GenerateIV();
IV = aesAlg.IV;

aesAlg.Mode = CipherMode.CBC;

var encryptor = aesAlg.CreateEncryptor(aesAlg.Key, aesAlg.IV);

// Create the streams used for encryption.
using (var msEncrypt = new MemoryStream())
{
using (var csEncrypt = new CryptoStream(msEncrypt, encryptor, CryptoStreamMode.Write))
{
using (var swEncrypt = new StreamWriter(csEncrypt))
{
//Write all data to the stream.
swEncrypt.Write(plainText);
}
encrypted = msEncrypt.ToArray();
}
}
}

var combinedIvCt = new byte[IV.Length + encrypted.Length];
Array.Copy(IV, 0, combinedIvCt, 0, IV.Length);
Array.Copy(encrypted, 0, combinedIvCt, IV.Length, encrypted.Length);

// Return the encrypted bytes from the memory stream.
return combinedIvCt;

Answers

Answer 1
I ran the code without problems. I added the decrypt routine from the same github site you got it from and was able to encrypt and subsequently decrypt a message.

So how are you invoking this code? Did you allocate a 16 byte buffer for the key?

Related Questions

scientist have observed many mysteries of plants True Or False

Answers

I think the answers is true.

Answer:

true

Explanation:

Which network is a private network used for communications with business partners?

Answers

An Intranet is a private network used ....

Shakespeare’s complete works have approximately 3.5 million characters. Which is bigger in file size: Shakespeare’s complete works stored in plain ASCII text or a 4 minute song on mp3? How much bigger?

Answers

1 character in ASCII plain text occupies 1 byte of data; therefore 3.5 million of characters are 3.5 million of bytes. Since 1024 bytes = 1KB, we can use this equivalence to convert 3.5 million bytes to KB: (3500000 bytes)*(1KB/1024bytes) = 3417.97 KB. Now 1 minute of mp3 at 128 Kbps occupies 960KB, and since our mp3 is 4 minutes in length: 4*960= 3840KB. The difference between the two is 3840KB – 3417.97KB = 422.1KB, which means that the mp3 is larger than all the Shakespeare’s works by 422.1KB.





The size of MP3 depends on the file quality. The MP3 quality can be 128 Kbps or 256 Kbps or it may be at any other rate (320Kbps). The high quality MP3 (256 Kbps) have more size than the lower size MP3 (128 Mbps). Therefore, we cannot say whether 4 minutes MP3 is large or 3.5 million characters since MP3 is totally dependent on MP3 quality.

Further explanation:

Since the MP3 file size is dependent on the quality of the music. A high quality (256 Kbps) MP3 of 4 minutes has the size about 7.68 MB and on the other hand a comparatively low quality (128 Kbps) MP3 of 4 minutes has the size of about 3.84 MB. The size of plain text file is 3.5 MB (using M=10^6, not 2^20). The compression of much higher MP3 file is not commonly used for music.

Learn more:

1. A company that allows you to license software monthly to use online is an example of ?brainly.com/question/10410011

2. How does coding work on computers?  brainly.com/question/2257971

Answer details:

Grade: Middle School

Subject: Computer Science

Chapter: Computer basics

Keyword:

MP3, file, quality, 256 Kbps, 128 Kbps, 512 Kbps, 320Kbps, high, low, minutes, ASCII code, music, text, size, Shakespeare, millions, MB, KB

Which device is a general-purpose computing device?

Answers

Ay 
Fonsi 
DY 
Oh
Oh no, oh no
Oh yeah
Diridiri, dirididi Daddy 
GoSí, sabes que ya llevo un rato mirándote 
Tengo que bailar contigo hoy (DY) 
Vi que tu mirada ya estaba llamándome 
Muéstrame el camino que yo voy (Oh)Tú, tú eres el imán y yo soy el metal 
Me voy acercando y voy armando el plan 
Solo con pensarlo se acelera el pulso (Oh yeah)Ya, ya me está gustando más de lo normal 
Todos mis sentidos van pidiendo más 
Esto hay que tomarlo sin ningún apuroDespacito 
Quiero respirar tu cuello despacito 
Deja que te diga cosas al oído 
Para que te acuerdes si no estás conmigoDespacito 
Quiero desnudarte a besos despacito 
Firmo en las paredes de tu laberinto 
Y hacer de tu cuerpo todo un manuscrito (sube, sube, sube)
(Sube, sube)Quiero ver bailar tu pelo 
Quiero ser tu ritmo 
Que le enseñes a mi boca 
Tus lugares favoritos (favoritos, favoritos baby)Déjame sobrepasar tus zonas de peligro 
Hasta provocar tus gritos 
Y que olvides tu apellido (Diridiri, dirididi Daddy)Si te pido un beso ven dámelo 
Yo sé que estás pensándolo 
Llevo tiempo intentándolo 
Mami, esto es dando y dándolo 
Sabes que tu corazón conmigo te hace bom, bom 
Sabes que esa beba está buscando de mi bom, bom 
Ven prueba de mi boca para ver cómo te sabe 
Quiero, quiero, quiero ver cuánto amor a ti te cabe 
Yo no tengo prisa, yo me quiero dar el viaje 
Empecemos lento, después salvajePasito a pasito, suave suavecito 
Nos vamos pegando poquito a poquito 
Cuando tú me besas con esa destreza 
Veo que eres malicia con delicadezaPasito a pasito, suave suavecito 
Nos vamos pegando, poquito a poquito 
Y es que esa belleza es un rompecabezas 
Pero pa montarlo aquí tengo la piezaDespacito 
Quiero respirar tu cuello despacito 
Deja que te diga cosas al oído 
Para que te acuerdes si no estás conmigoDespacito 
Quiero desnudarte a besos despacito 
Firmo en las paredes de tu laberinto 
Y hacer de tu cuerpo todo un manuscrito (sube, sube, sube)
(Sube, sube)Quiero ver bailar tu pelo 
Quiero ser tu ritmo 
Que le enseñes a mi boca 
Tus lugares favoritos (favoritos, favoritos baby)Déjame sobrepasar tus zonas de peligro 
Hasta provocar tus gritos 
Y que olvides tu apellidoDespacito 
Vamos a hacerlo en una playa en Puerto Rico 
Hasta que las olas griten "¡ay, bendito!" 
Para que mi sello se quede contigoPasito a pasito, suave suavecito 
Nos vamos pegando, poquito a poquito 
Que le enseñes a mi boca 
Tus lugares favoritos (favoritos, favoritos baby)Pasito a pasito, suave suavecito 
Nos vamos pegando, poquito a poquito 
Hasta provocar tus gritos 
Y que olvides tu apellido (DY)
Despacito

Jane works in the sales department of a service company. She has impressive interpersonal skills and always turns up for work on time. Though she gets along well with her coworkers, she has a habit of constantly interrupting them during a conversation. Which core business etiquette, is missing in Jane?

Answers

Is this multiple choice? I believe it is manners or approachability, but then again I haven't read your lesson.

Active listening. Jane's habit of interrupting coworkers indicates a lack of this core business etiquette, hindering effective communication.

The core business etiquette missing in Jane's behavior is active listening. Active listening involves fully concentrating on what is being said by the speaker, understanding the message, and responding appropriately. By constantly interrupting her coworkers during conversations, Jane fails to practice active listening.

Effective communication in the workplace requires not only expressing oneself but also listening attentively to others. Interrupting others can be perceived as disrespectful and can hinder effective communication. It may make coworkers feel undervalued or ignored, ultimately leading to a breakdown in teamwork and collaboration.

Additionally, active listening is essential for building rapport and trust with coworkers. When Jane interrupts her coworkers, she may come across as impatient or disinterested, which can negatively impact her relationships with them.

To improve her communication skills and demonstrate respect for her coworkers, Jane should work on practicing active listening. This involves giving her full attention to the speaker, refraining from interrupting, asking clarifying questions when necessary, and providing feedback to show understanding. By enhancing her active listening skills, Jane can contribute to a more positive and productive work environment.

A layer 2 switch is used to switch incoming frames from a 1000base-t port to a port connected to a 100base-t network. which method of memory buffering would work best for this task?

Answers

Shared memory buffering would work best. This would give the ports the best allocation of resources, using only those that are the most active and best allocated for the size of the frames being transmitted in the current traffic. In addition, any port can store these frames, instead of being specifically allocated as per other types of memory buffering.

What is diffie-hellman most commonly used for?

Answers

DH is an algorithm to derive a shared secret over an unsafe channel.

Both parties exchange public keys, and can join them together with their private keys to create the secret. An eavesdropper can see both public keys, but since he doesn't posess the private keys, cannot derive the same secret.

The secret can be used to subsequently encrypt communications with a symmetric algorithm.

TLS uses this approach.

Final answer:

The Diffie-Hellman algorithm is primarily used for secure key exchange, allowing two parties to establish a shared secret over an insecure channel which can be used for encrypted communication. It relies on the difficulty of solving the Diffie-Hellman problem and is fundamental to many cryptographic protocols.

Explanation:

The Diffie-Hellman algorithm is most commonly used for secure key exchange over a public channel in the field of cryptography. This method enables two parties to create a shared secret key, which can then be used for secure data encryption and decryption. The process involves each party generating a private key and a public key component, followed by an exchange of the public key components. The clever part of Diffie-Hellman is that despite the public exchange, eavesdroppers cannot easily calculate the agreed-upon secret key. Each party then uses its private key together with the other party's public key to compute the identical shared secret.

The security of the Diffie-Hellman algorithm relies on the difficulty of calculating discrete logarithms in a finite field, which is known as the Diffie-Hellman problem. It's a foundational technique in creating secure communications, laying the groundwork for various cryptographic protocols, such as the establishment of SSL/TLS connections which are ubiquitous in securing web-based transactions.

You've formatted the first paragraph of a document. What button can you use to apply the formatting from the first paragraph to the next paragraph in the document? A. Cut B. Paste C. Copy D. Format Painter

Answers

the answer is D format painter

Suppose that a local area network requires seven letters for user names.​ lower- and uppercase letters are considered the same. how many user names are possible for the local area​ network?

Answers

If a user name can have seven letters (with no distinction between upper and lower case), and if a letter can be repeated, then the maximum number of names is 26x26x26x26x26x26x26, or 8,031,810,176. That is, slightly more than eight billion names are possible.

Final answer:

Given that lowercase and uppercase letters are considered the same, there are 26 options for each of the 7 positions in a username. Thus, the total number of possible usernames is 26^7, which equals 8,031,810,176.

Explanation:

The question involves calculating the number of possible usernames a local area network can have given certain constraints. Since lowercase and uppercase letters are considered the same, and the username requires seven letters without considering numbers, dots, or underscores, we'll only consider the 26 letters of the alphabet. Therefore, for each of the seven positions in the username, there are 26 possibilities.

The total number of possible usernames can be calculated by raising the number of possible letters (26) to the power of the length of the usernames (7), which is 26^7.

This gives us a total of 8,031,810,176 possible usernames for the local area network.

Recombinant DNA technology was very important because it _______.

Answers

Final answer:

Recombinant DNA technology is important because it "enables the production of proteins, revolutionizes the pharmaceutical industry, and contributes to advancements in medical treatments, agriculture, and sustainability".

Explanation:

Recombinant DNA technology, also known as genetic engineering, is important because it has several applications in various fields such as medicine, agriculture, and biotechnology. One of the major contributions of recombinant DNA technology is the production of proteins in large quantities. For example, insulin used to be obtained from animals before the advent of recombinant DNA technology. Now, bacteria can be engineered to produce human insulin, eliminating the need for animal sources.

In addition, recombinant DNA technology has revolutionized the pharmaceutical industry by allowing for the rapid production of high-quality recombinant DNA pharmaceuticals used to treat different human conditions.

Overall, recombinant DNA technology has significantly advanced our understanding and manipulation of genetic material, enabling us to develop new medical treatments, genetically modified crops, and sustainable raw materials.

Other Questions
Theorists believed that the drug, chlorpromazine, had its effect on psychotic patients because it blocked ______ receptors. An electrical shock happens when electric ________enters the body at one point and leaves through another. Read Nick's description of an evening at Gatsby's party below:The lights grow brighter as the earth lurches away from the sun, and now the orchestra is playing yellow cocktail music, and the opera of voices pitches a key higher.Which literary element is best represented in this excerpt? A student placed 18.5 g of glucose (c6h12o6) in a volumetric flask, added enough water to dissolve the glucose by swirling, then carefully added additional water until the 100.-ml mark on the neck of the flask was reached. the flask was then shaken until the solution was uniform. a 45.0-ml sample of this glucose solution was diluted to 0.500 l. how many grams of glucose are in 100. ml of the final solution? The vertex of the graph of a quadratic function is (2, 9) and the y-intercept is (0, 5). Which of the following is the equation of the function? A. y = x2 +10x + 2 B. y = x2 +10x 2 C. y = x2 2x 5 D. y = x2 + 4x 5 Help please! I need to show my work If an atom has sp hybridization in a molecule: the maximum number of bonds that the atom can form is Let p: The shape is a rhombus. Let q: The diagonals are perpendicular. Let r: The sides are congruent. Which represents "The shape is a rhombus if and only if the diagonals are perpendicular and the sides are congruent? What mental processes allow you to perceive a lemon as yellow? Find the value of c such that the line y = 9/4 x + 9 is tangent to the curve y = c x . How did people travel according to this theory(The coastal route theory) Fill in the coefficients that will balance the following reaction:_____Hg(CO3)2+______AgCl---> ______HgCl4+______Ag2CO3 HELP PLEASE!!!! 30 POINTS!!!!Review the entry from a works cited page:Dean, Cornelia. "Executive on a Mission: Saving the Earth." New York Times 20 May 2007: B2. Web. 25 May 2007.Which is the correct format for an in-text citation of this source?A. (Cornelia Dean 2).B. (Dean 2).C. ("Executive" 2).D. (Cornelia 2). When group members use different meanings for the same words and phrases, they run the risk of? In the first paragraph, leon botstein states, "[t]he american high school is obsolete and should be abolished." why? what specific reasons does he provide? Next year you are going to study in Argentina. Your host family sent a copy of your class schedule as follows. What clase de ciencias will you be taking? Argentina siglo XIX Educacin Fsica Biologa Matemtica Avanzada [02.05]Solve for x: 4 (x + 2) < 3(x + 4) (1 point)x < 7x > 7x < 9x > 9 One Ear was uttering quick, eager whines, lunging at the length of his stick toward the darkness, and desisting now and again in order to make frantic attacks on the stick with his teeth. The words uttering quick, eager whines suggests which of the following? One Ear is begging. One Ear is determined. One Ear is ill. One Ear is playful. What happens to the atomic radius when an electron is lost Which statement is not true about similar triangles? Corresponding angles are equal. Each triangle has 3 sides. The lengths of corresponding sides are proportional Corresponding sides are congruent. Steam Workshop Downloader