encrypt and decrypt using encrypt(char block[64], int edflag)

From: rockwell (rockwell_001_at_yahoo.com)
Date: 07/25/04

  • Next message: TLOlczyk: "Symbol Tables and Backtraces in Linux"
    Date: 25 Jul 2004 01:40:35 -0700
    
    

    Hi groups i am trying to encrypt and decrypt back a block of data .I
    am using the standard encrypt(char block[64], int edflag) function. I
    have written a small program which should do this according to the man
    page.the program looks like

    #include <stdio.h>
    #include <unistd.h>
    #include <crypt.h>

    int main(void)
    {
    char key[64];
    char txt[64]="myblockofdata";

    strcat(key, "thisismystring");

    printf("Before encrypting");
    printf("txt is %s",txt);
    printf("\n");
    setkey(key);

    printf("After encrypting");
    encrypt(txt, 0);
    printf("txt is %s",txt);
    printf("\n");

    printf("After decrypting");
    encrypt(txt, 1);
    printf("txt is %s",txt);
    printf("\n");
    return 0;
    }

    but this program does not display any thing except the string before
    encrypting.Can u suggest me what to do and how to proceed. According
    to the manpage on encrypt it just says if edflag is 0 it encrypts and
    if edflag is 1 it decrypts and i even want to know what does this mean
    void setkey(const char *key). The key parameter used here is an array
    of bytes, having each byte the numerical value 1 or 0. Does this mean
    that the key parameter should contain only 0's and 1's.I would be very
    thankful if you can answer me. If this is not the proper group can you
    please direct me to a proper group.

    Thanks in advance.


  • Next message: TLOlczyk: "Symbol Tables and Backtraces in Linux"

    Relevant Pages

    • RE: NTE_BAD_DATA
      ... They are NOT used DIRECTLY to encrypt / decrypt data; ... you should generate a RANDOM SESSION KEY and select a SYMMETRIC ENCRYPTION ... // imported from a BLOB read in from the source file or having ...
      (microsoft.public.platformsdk.security)
    • Re: Back Doors
      ... >> Design into the system a master key. ... Encrypt that with public key. ... Decrypt random symmetric key with private key. ...
      (sci.crypt)
    • Re: CAPI and RC4: can not decrypt when Final parameter is set to F
      ... to store ASYMMETRIC key pairs - never symmetric keys like RC4, ... Now when you need to encrypt at one place and decrypt at the other normally ... Get a HCRYPTPROV handle to a key container with CryptAcquireContext ...
      (microsoft.public.platformsdk.security)
    • Re: RSA - Public vs. Private Keys
      ... This is a common pattern for license software ... your client will send a unique machine hash to the ... will let us decrypt with a Public Key (or simply not ... |> RSA is intended to encrypt messages with public keys only. ...
      (microsoft.public.dotnet.security)
    • Re: .NET Crypto Classes Interoperability with Win32 Crypto APIs
      ... when i encrypt a string using .NET classes and try to ... > decrypt it using Win32 APIs, ... > UnicodeEncoding(); ...
      (microsoft.public.dotnet.security)