Ask a Question related to ASP.NET Security, Design and Development.

  1. #1

    Default CryptoStream

    I have some basic understanding questions about encryption. I am looking at
    implementing the Rijndael (256) encryption scheme. Does this imply that the
    key must be a string of 256 characters? Is the key something that I can just
    type out or is this something the crypto class needs to generate for me. My
    second questions is about the IV byte array. What function is served by this
    byte array and what is the recommended manner to create this byte array?

    Thanks,
    Fred Herring


    Fred Herring Guest

  2. Similar Questions and Discussions

    1. cryptostream,padding
      My application produces BLOB's which need to be compressed and encrypted prior to transfer over the internet. I have inplemented a class called...
  3. #2

    Default Re: CryptoStream

    Fred,

    Check these samples (I think they will answer your questions):

    [url]http://www.obviex.com/Samples/Encryption.aspx[/url] (explains how to use Rijndael)
    [url]http://www.obviex.com/Articles/CiphertextSize.aspx[/url] (there is a section
    explaining what IV does and how it works)

    Alek

    "Fred Herring" <FredHerring@discussions.microsoft.com> wrote in message
    news:07401221-19F8-4ABE-9A3E-12FE814CCC95@microsoft.com...
    > I have some basic understanding questions about encryption. I am looking
    at
    > implementing the Rijndael (256) encryption scheme. Does this imply that
    the
    > key must be a string of 256 characters? Is the key something that I can
    just
    > type out or is this something the crypto class needs to generate for me.
    My
    > second questions is about the IV byte array. What function is served by
    this
    > byte array and what is the recommended manner to create this byte array?
    >
    > Thanks,
    > Fred Herring
    >
    >

    Alek Davis Guest

  4. #3

    Default Re: CryptoStream

    Quick answers:

    Rijndael key is typically a 256-bit (not character) value. It can also be
    128 or 192-bit long, but 256 bits is your best bet (256 bits = 32 bytes).
    You can define the actual bits (bytes) of the Rijndael key yourself, but a
    more common approach is to derive the key from a password (passphrase),
    which can be a string of any length (this is done using the API call
    sequence you can follow in the example mentioned in the previous post). By
    the way, you may need to figure out how to protect the key (or passphrase).

    You need to use the initialization vector (IV) in certain (better)
    encryption modes, such as CBC, for encrypting the first block of the
    plaintext data (and decrypting the first block of the ciphertext). In other
    modes, IV may not be needed, but these modes are typically not recommended,
    so the rule of thumb is: use IV. The size of IV must match the encryption
    block size, which in many cases is 16-byte (not bit) long, so you can use
    any 16-character ASCII string for this.

    Alek

    "Alek Davis" <alek_xDOTx_davis_xATx_intel_xDOTx_com> wrote in message
    news:OzRPo8D9EHA.2540@TK2MSFTNGP09.phx.gbl...
    > Fred,
    >
    > Check these samples (I think they will answer your questions):
    >
    > [url]http://www.obviex.com/Samples/Encryption.aspx[/url] (explains how to use
    Rijndael)
    > [url]http://www.obviex.com/Articles/CiphertextSize.aspx[/url] (there is a section
    > explaining what IV does and how it works)
    >
    > Alek
    >
    > "Fred Herring" <FredHerring@discussions.microsoft.com> wrote in message
    > news:07401221-19F8-4ABE-9A3E-12FE814CCC95@microsoft.com...
    > > I have some basic understanding questions about encryption. I am
    looking
    > at
    > > implementing the Rijndael (256) encryption scheme. Does this imply that
    > the
    > > key must be a string of 256 characters? Is the key something that I can
    > just
    > > type out or is this something the crypto class needs to generate for me.
    > My
    > > second questions is about the IV byte array. What function is served by
    > this
    > > byte array and what is the recommended manner to create this byte array?
    > >
    > > Thanks,
    > > Fred Herring
    > >
    > >
    >
    >

    Alek Davis Guest

  5. #4

    Default Re: CryptoStream

    Thankyou very much. This is much clearer to me now. So 32 byte keys and
    vectors can be represented by strings 32 characters and or numbers <=255.

    dim MyIV() as byte={z,27,199,c,p,14... for 32 items}

    Fred

    "Alek Davis" wrote:
    > Quick answers:
    >
    > Rijndael key is typically a 256-bit (not character) value. It can also be
    > 128 or 192-bit long, but 256 bits is your best bet (256 bits = 32 bytes).
    > You can define the actual bits (bytes) of the Rijndael key yourself, but a
    > more common approach is to derive the key from a password (passphrase),
    > which can be a string of any length (this is done using the API call
    > sequence you can follow in the example mentioned in the previous post). By
    > the way, you may need to figure out how to protect the key (or passphrase).
    >
    > You need to use the initialization vector (IV) in certain (better)
    > encryption modes, such as CBC, for encrypting the first block of the
    > plaintext data (and decrypting the first block of the ciphertext). In other
    > modes, IV may not be needed, but these modes are typically not recommended,
    > so the rule of thumb is: use IV. The size of IV must match the encryption
    > block size, which in many cases is 16-byte (not bit) long, so you can use
    > any 16-character ASCII string for this.
    >
    > Alek
    >
    > "Alek Davis" <alek_xDOTx_davis_xATx_intel_xDOTx_com> wrote in message
    > news:OzRPo8D9EHA.2540@TK2MSFTNGP09.phx.gbl...
    > > Fred,
    > >
    > > Check these samples (I think they will answer your questions):
    > >
    > > [url]http://www.obviex.com/Samples/Encryption.aspx[/url] (explains how to use
    > Rijndael)
    > > [url]http://www.obviex.com/Articles/CiphertextSize.aspx[/url] (there is a section
    > > explaining what IV does and how it works)
    > >
    > > Alek
    > >
    > > "Fred Herring" <FredHerring@discussions.microsoft.com> wrote in message
    > > news:07401221-19F8-4ABE-9A3E-12FE814CCC95@microsoft.com...
    > > > I have some basic understanding questions about encryption. I am
    > looking
    > > at
    > > > implementing the Rijndael (256) encryption scheme. Does this imply that
    > > the
    > > > key must be a string of 256 characters? Is the key something that I can
    > > just
    > > > type out or is this something the crypto class needs to generate for me.
    > > My
    > > > second questions is about the IV byte array. What function is served by
    > > this
    > > > byte array and what is the recommended manner to create this byte array?
    > > >
    > > > Thanks,
    > > > Fred Herring
    > > >
    > > >
    > >
    > >
    >
    >
    >
    Fred Herring Guest

  6. #5

    Default Re: CryptoStream

    Yes, they can be defined in bytes (bytes are chars or numbers <= 255). I'm
    not sure if IV can be 32-byte long (I know it can be 16-byte long), so try
    it out.

    Alek

    "Fred Herring" <FredHerring@discussions.microsoft.com> wrote in message
    news:D67DF366-E21C-478F-A075-9F515F71D935@microsoft.com...
    > Thankyou very much. This is much clearer to me now. So 32 byte keys and
    > vectors can be represented by strings 32 characters and or numbers <=255.
    >
    > dim MyIV() as byte={z,27,199,c,p,14... for 32 items}
    >
    > Fred
    >
    > "Alek Davis" wrote:
    >
    > > Quick answers:
    > >
    > > Rijndael key is typically a 256-bit (not character) value. It can also
    be
    > > 128 or 192-bit long, but 256 bits is your best bet (256 bits = 32
    bytes).
    > > You can define the actual bits (bytes) of the Rijndael key yourself, but
    a
    > > more common approach is to derive the key from a password (passphrase),
    > > which can be a string of any length (this is done using the API call
    > > sequence you can follow in the example mentioned in the previous post).
    By
    > > the way, you may need to figure out how to protect the key (or
    passphrase).
    > >
    > > You need to use the initialization vector (IV) in certain (better)
    > > encryption modes, such as CBC, for encrypting the first block of the
    > > plaintext data (and decrypting the first block of the ciphertext). In
    other
    > > modes, IV may not be needed, but these modes are typically not
    recommended,
    > > so the rule of thumb is: use IV. The size of IV must match the
    encryption
    > > block size, which in many cases is 16-byte (not bit) long, so you can
    use
    > > any 16-character ASCII string for this.
    > >
    > > Alek
    > >
    > > "Alek Davis" <alek_xDOTx_davis_xATx_intel_xDOTx_com> wrote in message
    > > news:OzRPo8D9EHA.2540@TK2MSFTNGP09.phx.gbl...
    > > > Fred,
    > > >
    > > > Check these samples (I think they will answer your questions):
    > > >
    > > > [url]http://www.obviex.com/Samples/Encryption.aspx[/url] (explains how to use
    > > Rijndael)
    > > > [url]http://www.obviex.com/Articles/CiphertextSize.aspx[/url] (there is a section
    > > > explaining what IV does and how it works)
    > > >
    > > > Alek
    > > >
    > > > "Fred Herring" <FredHerring@discussions.microsoft.com> wrote in
    message
    > > > news:07401221-19F8-4ABE-9A3E-12FE814CCC95@microsoft.com...
    > > > > I have some basic understanding questions about encryption. I am
    > > looking
    > > > at
    > > > > implementing the Rijndael (256) encryption scheme. Does this imply
    that
    > > > the
    > > > > key must be a string of 256 characters? Is the key something that I
    can
    > > > just
    > > > > type out or is this something the crypto class needs to generate for
    me.
    > > > My
    > > > > second questions is about the IV byte array. What function is
    served by
    > > > this
    > > > > byte array and what is the recommended manner to create this byte
    array?
    > > > >
    > > > > Thanks,
    > > > > Fred Herring
    > > > >
    > > > >
    > > >
    > > >
    > >
    > >
    > >

    Alek Davis Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139