The Intel® EPID SDK provides example tools to show you how to use the Intel® EPID SDK APIs. These examples are called signmsg
and verifysig
.
These examples use the pre-generated data described in Test Data. After you build the SDK, the data is in the _install/epid-sdk/example/data
directory. If you don't have genuine issuer material, you can use this data for validation purposes.
You can follow along with the commands used in this tutorial if you first build these examples using the instructions in Building from Source. The tutorial assumes _install/epid-sdk/example
is the current directory.
All command lines in this tutorial use posix command line conventions; for other systems, adjust accordingly.
For detailed walkthroughs of the code used in signmsg
and verifysig
, refer to Walkthroughs of Examples Showing API Usage.
The example application signmsg
shows you how to create an Intel® EPID signature of a given message.
To generate a signature, you need the following items:
The signmsg command can be passed a number of options:
$ ./signmsg -h Usage: signmsg [OPTION]... Verify signature was created by group member in good standing Options: --sig=FILE write signature to FILE (default: sig.dat) --msg=MESSAGE MESSAGE to sign --msgfile=FILE FILE containing message to sign --bsn=BASENAME BASENAME to sign with (default: random) --bsnfile=FILE FILE containing basename to sign with --sigrl=FILE load signature based revocation list from FILE --gpubkey=FILE load group public key from FILE (default: pubkey.bin) --mprivkey=FILE load member private key from FILE (default: mprivkey.dat) --mprecmpi=FILE load pre-computed member data from FILE --capubkey=FILE load IoT Issuing CA public key from FILE (default: cacert.bin) --hashalg={SHA-256 | SHA-384 | SHA-512 | SHA-512/256} use specified hash algorithm (default: SHA-512) --help display this help and exit -v, --verbose print status messages to stdout
To sign a message, a group member in good standing uses the following command:
$ ./signmsg --msg="test0"
The above command signs a message "test0". signmsg
uses default options for the group public key, member private key, hash algorithm and IoT Issuing CA public key. All other parameters that are not given are ignored. The command produces a signature file: sig.dat
The example application verifysig
shows you how to verify that a given Intel® EPID signature is produced by a member in good standing.
To verify a signature, you need the following items:
The verifysig command can be passed a number of options:
$ ./verifysig -h Usage: verifysig [OPTION]... Create Intel(R) EPID signature of message Options: --sig=FILE load signature from FILE (default: sig.dat) --msg=MESSAGE MESSAGE that was signed (default: empty) --msgfile=FILE FILE containing message that was signed --bsn=BASENAME BASENAME used in signature (default: random) --bsnfile=FILE FILE containing basename used in signature --privrl=FILE load private key revocation list from FILE --sigrl=FILE load signature based revocation list from FILE --grprl=FILE load group revocation list from FILE (default: grprl.bin) --verifierrl=FILE load verifier revocation list from FILE --gpubkey=FILE load group public key from FILE (default: pubkey.bin) --vprecmpi=FILE load pre-computed verifier data from FILE --vprecmpo=FILE write pre-computed verifier data to FILE --capubkey=FILE load IoT Issuing CA public key from FILE (default: cacert.bin) --hashalg={SHA-256 | SHA-384 | SHA-512 | SHA-512/256} use specified hash algorithm for 2.0 groups (default: SHA-512) --help display this help and exit -v, --verbose print status messages to stdout
To verify that a signature is from a member in good standing, the verifier uses the following command:
$ ./verifysig --msg="test0" signature verified successfully
This verifies that the default signature file sig.dat
is generated for the message "test0" by a member in good standing. The verifysig
example uses default inputs for group public key, hash algorithm, and IoT Issuing CA public key. All other parameters are ignored. The output verifysig: signature verified successfully
denotes that the verification is successful.
To successfully create and verify a signature, the member and verifier have to use the same message, hash algorithm, signature revocation list, and basename.
The signature verification process fails if there is a parameter mismatch between sign and verify operations. The mechanism for avoiding a parameter mismatch is outside the scope of the SDK.
The member needs the message to generate the signature using the member private key. In order for verification to succeed, the verifier needs to use the same message that the member used.
This comparison allows the verifier to determine if the signature fulfills the verifier's basic expectations of what a signature from a valid member should look like, given the original message and the group public key.
Verification fails if the signing and verification operations don't use the same message:
$ ./signmsg --msg="test0" $ ./verifysig --msg="test1" verifysig: signature verification failed: invalid signature
The member needs to encrypt the signature with the hash algorithm. The verifier needs to use the same hash algorithm that the member used.
If you don't specify a hash algorithm, a default hash algorithm is used.
The Intel® EPID SDK supports the following hash algorithms: SHA-256, SHA-384, SHA-512.
Verification fails if the signing and verification operations don't use the same hash algorithm:
$ ./signmsg --msg="test0" --hashalg=SHA-256 $ ./verifysig --msg="test0" --hashalg=SHA-384 verifysig: signature verification failed: invalid signature
The member needs the signature based revocation list (SigRL) to create non-revoked proofs for each entry on the SigRL. The verifier needs to use the same SigRL to check the proofs.
Verification fails if the signing and verification operations don't use the same SigRL.
$ ./signmsg --msg="test0" --sigrl=data\groupa\sigrl.bin $ ./verifysig --msg="test0" --sigrl=sigrl.bin verifysig: signature verification failed: bad arguments
For a verifier to be able to know that multiple signatures were generated by the same member, the verifier has to use the same basename that the member used for each name based signature. For more information, refer to In-Depth Explanation of Basenames.
If a basename is not provided to the member, then the member uses a random basename and the signature generated by the member is anonymous.
If a basename is not provided to the verifier, then the verifier does not check for a basename and it will verify the signature successfully without linking it to other signatures.
To sign message "test0" with a basename "base0":
$ ./signmsg --msg="test0" --bsn="base0"
To verify the signature:
$ ./verifysig --msg="test0" --bsn="base0" verifysig: signature verified successfully
Verification fails if the signing and verification operations use different basenames:
$ ./signmsg --msg="test0" --bsn="base0" $ ./verifysig --msg="test0" --bsn="base1" verifysig: signature verification failed: invalid signature
Revocation lists are data structures used by the verifier to identify members that are no longer approved members of the group.
The verifier obtains the member private key based revocation list (PrivRL), signature based revocation list (SigRL), and group based revocation list (GroupRL) from the issuer. The verifier can also maintain its own verifier blacklist (VerifierRL).
Verification of a signature fails if it is generated by a member of a group that is revoked in the group revocation list.
For example,
$ ./signmsg --msg="test0" --gpubkey=data/groupb/pubkey.bin --mprivkey=data/groupb/member0/mprivkey.dat $ ./verifysig --msg="test0" --grprl=data/grprl.bin --gpubkey=data/groupb/pubkey.bin verifysig: signature verification failed: signature revoked in GroupRl
The verification fails because groupb is revoked and is an entry in the group revocation list (grprl.bin
).
Verification of a signature fails if it is generated by a member whose private key is revoked in a private-key based revocation list.
For example,
$ ./signmsg --msg=test0 --gpubkey=data/groupa/pubkey.bin --mprivkey=data/groupa/privrevokedmember0/mprivkey.dat $ ./verifysig --msg=test0 --privrl=data/groupa/privrl.bin --gpubkey=data/groupa/pubkey.bin verifysig: signature verification failed: signature revoked in PrivRl
The verification fails because the private key of privrevokedmember0 is revoked and is an entry in the private key based revocation list of groupa (privrl.bin
).
Verification of a signature fails if it is generated by a member whose signature is revoked in a signature based revocation list.
$ ./signmsg --msg="test1" --sigrl=data/groupa/sigrl.bin --gpubkey=data/groupa/pubkey.bin --mprivkey=data/groupa/sigrevokedmember0/mprivkey.dat signmsg: signature revoked in SigRL $ ./verifysig --msg="test1" --sigrl=data/groupa/sigrl.bin --gpubkey=data/groupa/pubkey.bin verifysig: signature verification failed: signature revoked in SigRl
The message "test1" is signed by signmsg with a warning signmsg: signature revoked in SigRL
. This means that the signature of sigrevokedmember0 is revoked in the signature based revocation list. The verification fails because the signature was generated by sigrevokedmember0, which is revoked and is an entry in the signature based revocation list of groupa (sigrl.bin
).