Changeset 339
- Timestamp:
- 01/26/06 16:37:18
- Files:
-
- openpgpsdk/trunk/examples/packet-dump.c (modified) (6 diffs)
- openpgpsdk/trunk/include/openpgpsdk/crypto.h (modified) (1 diff)
- openpgpsdk/trunk/src/hash.c (modified) (1 diff)
- openpgpsdk/trunk/src/packet-parse.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
openpgpsdk/trunk/examples/packet-dump.c
r338 r339 19 19 static const char *pname; 20 20 static ops_keyring_t keyring; 21 static ops_boolean_t passphrase_prompt; 21 22 22 23 static void print_indent() … … 805 806 806 807 case OPS_PARSER_CMD_GET_PASSPHRASE: 807 printf(">>> ASKED FOR PASSPHRASE <<<\n"); 808 if(passphrase_prompt) 809 { 810 *content->passphrase=ops_get_passphrase(); 811 if(!**content->passphrase) 812 break; 813 return OPS_KEEP_MEMORY; 814 } 815 else 816 printf(">>> ASKED FOR PASSPHRASE <<<\n"); 808 817 break; 809 818 … … 817 826 print_public_key(&content->secret_key.public_key); 818 827 printf("S2K Usage: %d\n",content->secret_key.s2k_usage); 819 printf("S2K Specifier: %d\n",content->secret_key.s2k_ usage);828 printf("S2K Specifier: %d\n",content->secret_key.s2k_specifier); 820 829 printf("Symmetric algorithm: %d\n",content->secret_key.algorithm); 821 830 printf("Hash algorithm: %d\n",content->secret_key.hash_algorithm); … … 943 952 fprintf(stderr,"-a\tRead armoured data\n" 944 953 "-b\tDon't buffer stdout/stderr\n" 945 "-B\tRead via a memory buffer\n"); 954 "-B\tRead via a memory buffer\n" 955 "-k <file>\tRead in a keyring\n" 956 "-p\tPrompt for passphrases\n"); 957 946 958 exit(1); 947 959 } … … 960 972 pname=argv[0]; 961 973 962 while((ch=getopt(argc,argv,"abBk: ")) != -1)974 while((ch=getopt(argc,argv,"abBk:p")) != -1) 963 975 switch(ch) 964 976 { … … 978 990 case 'k': 979 991 keyring_file=optarg; 992 break; 993 994 case 'p': 995 passphrase_prompt=ops_true; 980 996 break; 981 997 openpgpsdk/trunk/include/openpgpsdk/crypto.h
r336 r339 49 49 const char *ops_text_from_hash(ops_hash_t *hash); 50 50 unsigned ops_hash_size(ops_hash_algorithm_t alg); 51 unsigned ops_hash(unsigned char *out,ops_hash_algorithm_t alg,const void *in, 52 size_t length); 51 53 52 54 void ops_hash_add_int(ops_hash_t *hash,unsigned n,unsigned length); openpgpsdk/trunk/src/hash.c
r245 r339 60 60 return OPS_HASH_UNKNOWN; 61 61 } 62 63 unsigned ops_hash(unsigned char *out,ops_hash_algorithm_t alg,const void *in, 64 size_t length) 65 { 66 ops_hash_t hash; 67 68 ops_hash_any(&hash,alg); 69 hash.init(&hash); 70 hash.add(&hash,in,length); 71 return hash.finish(&hash,out); 72 } openpgpsdk/trunk/src/packet-parse.c
r336 r339 1833 1833 C.secret_key.s2k_usage=OPS_S2KU_ENCRYPTED; 1834 1834 C.secret_key.s2k_specifier=OPS_S2KS_SIMPLE; 1835 C.secret_key.hash_algorithm=OPS_HASH_MD5; 1835 1836 } 1836 1837 … … 1841 1842 ops_parser_content_t pc; 1842 1843 char *passphrase; 1844 unsigned char hash[OPS_MAX_HASH]; 1843 1845 1844 1846 n=ops_block_size(C.secret_key.algorithm); … … 1858 1860 return 1; 1859 1861 } 1862 1863 ops_hash(hash,C.secret_key.hash_algorithm,passphrase, 1864 strlen(passphrase)); 1860 1865 } 1861 1866
