bcinfo.c

来自「BestCrypt开源加密原代码」· C语言 代码 · 共 78 行

C
78
字号
/*********************************************************************      Copyright (c) 1994-1999 Jetico, Inc., Finland*      All rights reserved.**      File: bcinfo.c*      Revision: $Id: bcinfo.c,v 1.9 2005/05/14 11:19:24 nail Rel-1.6-5 $*      Created:*      Description: implementation of container info routine********************************************************************/#include <stdio.h>#include <stdlib.h>#include <fcntl.h>#include <unistd.h>#include <string.h>#include <kg_defs.h>#include "header.h"#include "config.h"#include "bctool.h"#include "misc.h"#include "error.h"char bcinfo_c[]="$Id: bcinfo.c,v 1.9 2005/05/14 11:19:24 nail Rel-1.6-5 $";int bcinfo (int argc, char ** argv){    struct HiddenSector  hs;    int fd;    alg_info *alg_inf;    char *algorithm,*fsys;    if ( argc < 2 )    {        msg(stderr,"Please specify container name\n");         return -1;     }    else if ( argc > 2 )    {        msg(stderr,"Too many parameters\n");        return -1;    }    if ( (fd = open(argv[1], O_RDONLY|O_LARGEFILE)) < 0 )    {        perror (argv[1]);        return -1;     }    if ( read(fd, &hs, sizeof(hs))!=sizeof(hs) )    {        msg(stderr,"Can not read container header\n");        return -1;     }    if ( strncmp(hs.br.OEMid, "LOCOS94 ", sizeof(hs.br.OEMid))!=0 )    {        msg(stderr,"%s is not valid BestCrypt container\n",argv[0]);        return -1;    };       if ( (alg_inf=GetInfoById(hs.algorithmId))==NULL )        algorithm="Unknown algorithm";    else algorithm=alg_inf->alg_name;    if ( (fsys=getFStypeById(hs.fileSystemId))==NULL )        fsys="Unknown filesystem";    msg(stdout,"Description: %s\nEncryption Algorithm: %s\nKey Generator: %s\nFilesystem: %s\n",           hs.description,algorithm,hs.keyGenId == KGSHA256_ID ? "SHA-256" : "SHA-1", fsys);    close(fd);    return 0;} 

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?