Performance Comparison of Elliptic Curves and RSA Signatures:  Page 11 
[10] FIPS 186-2:  The Digital Signature Standard. 
Available (28 April 2004) at: 
http://csrc.nist.gov/publications/fips/fips186-2/fips186-2-change1.pdf 
[11] SEC 2:  Recommended Elliptic Curve Domain Parameters.   
Available (28 April 2004) at: 
http://www.secg.org/collateral/sec2_final.pdf 
[12] PKCS#1 v2.1: RSA Cryptography Standard, RSA Laboratories,  
June 14, 2002 
9.4  Books and Presentations 
[13] I. Blake, G. Seroussi, and N. Smart. Elliptic Curves in Cryptography.  
Cambridge University Press, 1999. 
[14] P. Riikonen.  RSA Algorithm.   
Available (28 April 2004) at: 
http://iki.fi/priikone/docs/rsa.pdf 
[15] W. Mao. Modern Cryptography:  Theory and Practice.  © 2004.  pp. 258 
Page 11 
Pdf insert page break - Split, seperate PDF into multiple files in C#.net, ASP.NET, MVC, Ajax, WinForms, WPF
Explain How to Split PDF Document in Visual C#.NET Application
pdf split file; cannot print pdf file no pages selected
Pdf insert page break - VB.NET PDF File Split Library: Split, seperate PDF into multiple files in vb.net, ASP.NET, MVC, Ajax, WinForms, WPF
VB.NET PDF Document Splitter Control to Disassemble PDF Document
cannot print pdf no pages selected; break password on pdf
/*******************************************************************************
EECS 
498
:  
Introduction to Cryptography
Brandon Arrendondo 
[
barendo@umich
.
edu
]
Nic Jansma 
[
njansma@umich
.
edu
]
rsaKeys
.
cpp
Generate a pair of RSA keys
.
*******************************************************************************/
#include
<string>
#include
<iostream>
#include
<time
.
h>
#include
"
base
64
.
h
"
#include
"
default
.
h
"
#include
"
files
.
h
"
#include
"
hex
.
h
"
#include
"
randpool
.
h
"
#include
"
rng
.
h
"
#include
"
osrng
.
h
"
#include
"
rsa
.
h
"
using
namespace
CryptoPP;
int
main
(
int
argc, 
char
*
argv
[])
{
std
::
string privFilename, pubFilename;
unsigned
int
keyLength;
if
(
argc 
!= 
3
{
std
::
cout << 
"
RSA Key Generation\n
"
;
std
::
cout << 
"
Usage
rsa_genkeys keylen keyfile\n\n
"
;
std
::
cout << 
"  
keyfile will have 
.
pri and 
.
pub appeneded to it\n
"
;
exit
(
1
)
;
}
keyLength 
atoi
(
argv
[
1
])
;
privFilename 
argv
[
2
]
;
privFilename
.
append
(".
pri
")
;
pubFilename 
argv
[
2
]
;
pubFilename
.
append
(".
pub
")
;
AutoSeededRandomPool rng;
RSAES_OAEP_SHA_Decryptor priv
(
rng, keyLength
)
;
HexEncoder privFile
(
new
FileSink
(
privFilename
.
c_str
()))
;
priv
.
DEREncode
(
privFile
)
;
privFile
.
MessageEnd
()
;
RSAES_OAEP_SHA_Encryptor pub
(
priv
)
;
HexEncoder pubFile
(
new
FileSink
(
pubFilename
.
c_str
()))
;
pub
.
DEREncode
(
pubFile
)
;
pubFile
.
MessageEnd
()
;
}
Appendix A1
VB.NET PDF Page Insert Library: insert pages into PDF file in vb.
Offer PDF page break inserting function. This demo will help you to insert a PDF page to a PDFDocument object at specified position in VB.NET program.
break pdf file into multiple files; can't cut and paste from pdf
C# PDF Page Insert Library: insert pages into PDF file in C#.net
Offer PDF page break inserting function. NET PDF document editor library control, RasterEdge XDoc.PDF, offers easy APIs for developers to add & insert an (empty
break pdf into pages; break a pdf into smaller files
/*******************************************************************************
EECS 
498
:  
Introduction to Cryptography
Brandon Arrendondo 
[
barendo@umich
.
edu
]
Nic Jansma 
[
njansma@umich
.
edu
]
rsaSign
.
cpp
Sign a message using an RSA private key
.
*******************************************************************************/
#include
<iostream>
#include
<time
.
h>
#include
"
base
64
.
h
"
#include
"
default
.
h
"
#include
"
files
.
h
"
#include
"
hex
.
h
"
#include
"
randpool
.
h
"
#include
"
rng
.
h
"
#include
"
osrng
.
h
"
#include
"
rsa
.
h
"
using
namespace
CryptoPP;
int
main
(
int
argc, 
char
*
argv
[])
{
std
::
string priFilename, msgFilename, sigFilename;
if
(
argc 
!= 
4
{
std
::
cout << 
"
RSA Verification\n
"
;
std
::
cout << 
"
Usage
rsa_sign prifile message sig\n\n
"
;
exit
(
1
)
;
}
priFilename 
argv
[
1
]
;
msgFilename 
argv
[
2
]
;
sigFilename 
argv
[
3
]
;
AutoSeededRandomPool rng;
FileSource privFile
(
priFilename
.
c_str
()
true
new
HexDecoder
)
;
RSASSA_PKCS
1
v
15
_SHA_Signer priv
(
privFile
)
;
FileSource f
(
msgFilename
.
c_str
()
true
new
SignerFilter
(
rng, priv,
new
HexEncoder
(
new
FileSink
(
sigFilename
.
c_str
()))))
;
return
0
;
}
Appendix A2
C# PDF Convert: How to Convert Jpeg, Png, Bmp, & Gif Raster Images
Success"); break; case ConvertResult.FILE_TYPE_UNSUPPORT: Console.WriteLine("Fail: can not convert to PDF, file type unsupport"); break; case ConvertResult
break pdf password online; how to split pdf file by pages
C# Image Convert: How to Convert Word to Jpeg, Png, Bmp, and Gif
RasterEdge.XDoc.PDF.dll. is not a document"); default: Console.WriteLine("Fail: unknown error"); break; }. This demo code just convert first word page to Png
pdf link to specific page; pdf print error no pages selected
EECS 
498
:  
Introduction to Cryptography
Brandon Arrendondo 
[
barendo@umich
.
edu
]
Nic Jansma 
[
njansma@umich
.
edu
]
rsaVerify
.
cpp
Verify a RSA signed message
#include
<string>
#include
<iostream>
#include
<time
.
h>
#include
"
base
64
.
h
"
#include
"
default
.
h
"
#include
"
files
.
h
"
#include
"
hex
.
h
"
#include
"
randpool
.
h
"
#include
"
rng
.
h
"
#include
"
osrng
.
h
"
#include
"
rsa
.
h
"
using
namespace
CryptoPP;
int
main
(
int
argc, 
char
*
argv
[])
{
std
::
string pubFilename, msgFilename, sigFilename;
if
(
argc 
!= 
4
{
std
::
cout << 
"
RSA Verification\n
"
;
std
::
cout << 
"
Usage
rsa_verify pubfile message sig\n\n
"
;
exit
(
1
)
;
}
pubFilename 
argv
[
1
]
;
msgFilename 
argv
[
2
]
;
sigFilename 
argv
[
3
]
;
FileSource pubFile
(
pubFilename
.
c_str
()
true
new
HexDecoder
)
;
RSASSA_PKCS
1
v
15
_SHA_Verifier pub
(
pubFile
)
;
FileSource signatureFile
(
sigFilename
.
c_str
()
true
new
HexDecoder
)
;
if
(
signatureFile
.
MaxRetrievable
() != 
pub
.
SignatureLength
()) 
{
std
::
cout << 
"
Incorrect public key\n
"
;
}
SecByteBlock signature
(
pub
.
SignatureLength
())
;
signatureFile
.
Get
(
signature, signature
.
size
())
;
VerifierFilter 
*
verifierFilter 
new
VerifierFilter
(
pub
)
;
verifierFilter
-
>Put
(
signature, pub
.
SignatureLength
())
;
FileSource f
(
msgFilename
.
c_str
()
true
, verifierFilter
)
;
if
(
verifierFilter
-
>GetLastResult
())
{
std
::
cout << 
"
Valid signature
<< std
::
endl;
}
else
{
std
::
cout << 
"
Invalid signature
<< std
::
endl;
}
return
0
;
}
Appendix A3
C# TWAIN - Query & Set Device Abilities in C#
device.TwainTransferMode = method; break; } if (method == TwainTransferMethod.TWSX_FILE) device.TransferMethod = method; } // If it's not supported tell stop.
break a pdf apart; break a pdf into separate pages
C# TWAIN - Install, Deploy and Distribute XImage.Twain Control
are three parts on this page, including system RasterEdge.XDoc.PDF.dll. device. TwainTransferMode = method; break; } if (method == TwainTransferMethod.TWSX_FILE
break apart a pdf; break pdf documents
/*******************************************************************************
EECS 
498
:  
Introduction to Cryptography
Brandon Arrendondo 
[
barendo@umich
.
edu
]
Nic Jansma 
[
njansma@umich
.
edu
]
ecdsaKeys
.
cpp
Generate ECC private and public key pair
*******************************************************************************/
#include
"
borzoi
.
h
"
#include
"
nist_curves
.
h
"
#include
<fstream>
#include
<string>
using
namespace
std;
void
gen_keys
(
string pass, string oFile, 
int
keylen
)
;
int
main 
(
int
argc, 
char
argv
[]) 
{
// 
send to key generation function
if
(
argc 
!= 
4
{
cout << 
"
ECDSA Key Generation
<< endl;
cout << 
"
Usage
ecdsa_genkeys \
"
password\
output_file keylen
<< endl << endl;
cout << 
Files output_file
.
pub and output_file
.
priv will be created
<< endl;
cout << 
keylen
can be 
163
233
283
409
571 
<< endl;
exit
(
1
)
;
}
// 
generate keys to a file
gen_keys
(
argv
[
1
]
, argv
[
2
]
, atoi
(
argv
[
3
]))
;
return
0
;
}
void
gen_keys
(
string pass, string oFile, 
int
keylen
{
ECPrivKey 
*
keyPriv;
string sFilePri 
oFile;
ECPubKey 
*
keyPub;
string sFilePub 
oFile;
EC_Domain_Parameters dp;
// 
generate file names
sFilePri
.
append
(".
pri
")
;
sFilePub
.
append
(".
pub
")
;
// 
determine keysize
switch
(
keylen
{
case
163
:
use_NIST_B_
163
()
;
dp 
NIST_B_
163
;
break
;
case
233
:
use_NIST_B_
233
()
;
dp 
NIST_B_
233
;
break
;
case
283
:
use_NIST_B_
283
()
;
dp 
NIST_B_
283
;
break
;
case
409
:
use_NIST_B_
409
()
;
dp 
NIST_B_
409
;
break
;
Appendix A4
C# TWAIN - Specify Size and Location to Scan
connection can be found at this tutorial page of how in frames) { if (frame == TwainStaticFrameSizeType.LetterUS) { this.device.FrameSize = frame; break; } } }.
break up pdf into individual pages; break pdf into smaller files
C# TWAIN - Acquire or Save Image to File
RasterEdge.XDoc.PDF.dll. if (device.Compression != TwainCompressionMode.Group4) device.Compression = TwainCompressionMode.Group3; break; } } acq.FileTranfer
pdf rotate single page; split pdf into multiple files
case
571
:
use_NIST_B_
571
()
;
dp 
NIST_B_
571
;
break
;
}
cout << 
"
Using keysize
: " 
<< keylen << 
bits
." 
<< endl;
// 
create private key
cout << 
"
Generating private key, please be patient
... " 
<< endl;
keyPriv 
new
ECPrivKey
(
dp
)
;
cout << 
"
done
!" 
<< endl;
// 
encrypt this to DER and Hex 
(
for file output and screen output
)
DER keyPrivDER
(*
keyPriv
)
;
HexEncoder oHex
(
keyPrivDER
)
;
// 
show the hex encoding on screen
cout << oHex << endl << endl;
// 
generate public key
cout << 
"
Generating public key
... "
;
keyPub 
new
ECPubKey
(*
keyPriv
)
;
cout << 
"
done
:" 
<< endl;
// 
convert to DER and HEX
DER keyPubDER
(*
keyPub
)
;
oHex 
HexEncoder
(
keyPubDER
)
;
// 
print out public key to screen
cout << oHex << endl << endl;
// 
output DER for private key to file
cout << 
"
Creating file 
<< oFile << 
".
pri 
..."
;
ofstream outfile 
(
sFilePri
.
c_str
()
, std
::
ios
::
binary
)
;
if
(!
outfile
{
cout << 
"
Couldn't open 
<< sFilePri << 
for writing
!" 
<< endl;
exit
(
1
)
;
}
outfile << keyPrivDER;
outfile
.
close
()
;
cout << 
"
done
." 
<< endl;
// 
output DER for public key to file
cout << 
"
Creating file 
<< oFile << 
".
pub 
..."
;
outfile
.
open
(
sFilePub
.
c_str
()
, ios
::
binary
)
;
if
(!
outfile
{
cout << 
"
Couldn't open 
<< sFilePub << 
for writing
!" 
<< endl;
exit
(
1
)
;
}
outfile << keyPubDER;
outfile
.
close
()
;
cout << 
"
done
." 
<< endl;
// 
all done
!
cout << endl << 
"
Finished successfully
!" 
<< endl;
return
;
}
/*******************************************************************************
EECS 
498
:  
Introduction to Cryptography
Brandon Arrendondo 
[
barendo@umich
.
edu
]
Nic Jansma 
[
njansma@umich
.
edu
]
ecdsaSign
.
cpp
Sign a message with ECC private keys
.
*******************************************************************************/
#include
"
borzoi
.
h
#include
"
nist_curves
.
h
"
#include
<fstream>
#include
<string>
using
namespace
std;
void
ecdsa_sign
(
string sInFile, string sOutFile, string sKeyFile
)
;
void
print_octetstr
(
OCTETSTR o
)
;
int
main 
(
int
argc, 
char
argv
[]) 
{
// 
send to key generation function
if
(
argc 
!= 
4
{
cout << 
"
ECDSA Signature Generation
<< endl;
cout << 
"
Usage
ecdsa_sign input_file sig_file priv_key
<< endl << endl;
exit
(
1
)
;
}
// 
generate keys to a file
ecdsa_sign
(
argv
[
1
]
, argv
[
2
]
, argv
[
3
])
;
return
0
;
}
void
ecdsa_sign
(
string sInFile, string sOutFile, string sKeyFile
{
OCTETSTR oStr;
OCTET o;
OCTETSTR hash;
char
c;
// 
open file from disk
cout << 
"
Reading in data from 
<< sInFile << 
"... "
;
ifstream ifsInFile
(
sInFile
.
c_str
()
, std
::
ios
::
binary
)
;
if
(!
ifsInFile
{
cout << 
"
Error
Couldn't read input file 
<< sInFile << 
"!" 
<< endl;
exit
(
1
)
;
}
// 
read file into memory
while
(
ifsInFile
.
get
(
c
)) 
{
= (
unsigned
char
)
c;
oStr
.
push_back 
(
o
)
;
}
cout << 
"
done
." 
<< endl << endl;
// 
compute hash of message
hash 
SHA
1
(
oStr
)
;
HexEncoder h
(
hash
)
;
cout << 
"
Hash
: " 
<< h << endl;
// 
read in private key
oStr
.
clear
()
;
cout << 
"
Reading in private key
... " 
<< endl;
ifsInFile
.
close
()
;
ifsInFile
.
clear
()
;
ifsInFile
.
open
(
sKeyFile
.
c_str
()
, std
::
ios
::
binary
)
;
if
(!
ifsInFile
{
Appendix A5
cout << 
"
Error
Couldn't read key file 
<< sKeyFile << 
"!" 
<< endl;
exit
(
1
)
;
}
// 
read file into memory
while
(
ifsInFile
.
get
(
c
)) 
{
= (
unsigned
char
)
c;
oStr
.
push_back 
(
o
)
;
}
ECPrivKey keyPriv 
DER
(
oStr
).
toECPrivKey
()
;
cout << 
"
done
!" 
<< endl;
cout << 
"
Generating signature, please wait
..." 
<< endl;
// 
convert input to private key
// 
create signature object
ECDSA sig 
(
keyPriv, OS
2
IP
(
hash
))
;
DER sigDER
(
sig
)
;
cout << 
"
done
!" 
<< endl << endl;
// 
output DER to sig file
cout << 
"
Creating signature file 
<< sOutFile << 
"..."
;
ofstream outfile
(
sOutFile
.
c_str
()
, ios
::
binary
)
;
if
(!
outfile
{
cout << 
"
Couldn't open 
<< sOutFile << 
for writing
!" 
<< endl;
exit
(
1
)
;
}
outfile << sigDER;
outfile
.
close
()
;
cout << 
"
done
." 
<< endl << endl;
cout << 
"
Signature
:" 
<< endl;
HexEncoder
(
sigDER
)
;
cout << h << endl << endl;
cout << 
"
Finished successfull
!" 
<< endl;
return
;
}
void
print_octetstr
(
OCTETSTR o
{
for
(
int
0
; i < o
.
size
()
; i
++) 
{
cout << o
[
i
]
;
}
}
/*******************************************************************************
EECS 
498
:  
Introduction to Cryptography
Brandon Arrendondo 
[
barendo@umich
.
edu
]
Nic Jansma 
[
njansma@umich
.
edu
]
ecdsaVerify
.
cpp
Verify a message signed with ecdsaSign
.
*******************************************************************************/
#include
"
borzoi
.
h
#include
"
nist_curves
.
h
"
#include
<fstream>
#include
<string>
using
namespace
std;
bool
ecdsa_verify
(
string sInFile, string sSigFile, string sKeyFile
)
;
int
main 
(
int
argc, 
char
argv
[]) 
{
// 
send to key generation function
if
(
argc 
!= 
4
{
cout << 
"
ECDSA Signature Generation
<< endl;
cout << 
"
Usage
ecdsa_verify input_file sig_file pub_key
<< endl << endl;
exit
(
1
)
;
}
// 
generate keys to a file
if
(
ecdsa_verify
(
argv
[
1
]
, argv
[
2
]
, argv
[
3
])) 
{
cout << 
"
Verification successful
!" 
<< endl;
else
{
cout << 
"
Verification FAILED
!" 
<< endl;
}
return
0
;
}
bool
ecdsa_verify
(
string sInFile, string sSigFile, string sKeyFile
{
OCTETSTR oStr;
OCTET o;
OCTETSTR hash;
char
c;
// 
open file from disk
cout << 
"
Reading in data from 
<< sInFile << 
"... "
;
ifstream ifsInFile
(
sInFile
.
c_str
()
, std
::
ios
::
binary
)
;
if
(!
ifsInFile
{
cout << 
"
Error
Couldn't read input file 
<< sInFile << 
"!" 
<< endl;
exit
(
1
)
;
}
// 
read file into memory
while
(
ifsInFile
.
get
(
c
)) 
{
= (
unsigned
char
)
c;
oStr
.
push_back 
(
o
)
;
}
cout << 
"
done
." 
<< endl << endl;
// 
compute hash of message
hash 
SHA
1
(
oStr
)
;
HexEncoder h
(
hash
)
;
cout << 
"
Hash
: " 
<< h << endl << endl;
// 
read in public key
oStr
.
clear
()
;
cout << 
"
Reading in public key
... " 
<< endl;
Appendix A6
ifsInFile
.
close
()
;
ifsInFile
.
clear
()
;
ifsInFile
.
open
(
sKeyFile
.
c_str
()
, std
::
ios
::
binary
)
;
if
(!
ifsInFile
{
cout << 
"
Error
Couldn't read key file 
<< sKeyFile << 
"!" 
<< endl;
exit
(
1
)
;
}
// 
read file into memory
while
(
ifsInFile
.
get
(
c
)) 
{
= (
unsigned
char
)
c;
oStr
.
push_back 
(
o
)
;
}
ECPubKey keyPub 
DER
(
oStr
).
toECPubKey
()
;
cout << 
  
done
!" 
<< endl << endl;
// 
read in public key
oStr
.
clear
()
;
cout << 
"
Reading in signature file
... " 
<< endl;
ifsInFile
.
close
()
;
ifsInFile
.
clear
()
;
ifsInFile
.
open
(
sSigFile
.
c_str
()
, std
::
ios
::
binary
)
;
if
(!
ifsInFile
{
cout << 
"
Error
Couldn't read key file 
<< sKeyFile << 
"!" 
<< endl;
exit
(
1
)
;
}
// 
read file into memory
while
(
ifsInFile
.
get
(
c
)) 
{
= (
unsigned
char
)
c;
oStr
.
push_back 
(
o
)
;
}
ECDSA sig 
DER
(
oStr
).
toECDSA
()
;
cout << 
"
Verifying signature, please wait
..." 
<< endl;
return
(
sig
.
verify
(
keyPub, OS
2
IP
(
hash
)))
;
}
Documents you may be interested
Documents you may be interested