|
XCMS Toolkit | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectexamples.DigestedDataExample
public class DigestedDataExample
This example program creates an XML encoded value of ASN.1 type
DigestedData using the canonical XML Encoding Rules
of ASN.1 (CXER). A value is digested (hashed) using the SHA-256
algorithm. The XML encoded value is displayed with the plaintext
content present and "detached". The same abstract values are encoded
in DER and displayed using hexadecimal notation.
The content to be digested is an XML encoding of a value of ISO 22895
type ECKeyCommitment as it would be used in a key control
protocol in the key deployment procedure of a key agreement scheme. To
establish key control for an ECMQV key agreement scheme, party A
would first send party B the hash of the public key(s) it will
use when the scheme is operated. To package the hash (but not disclose the
actual keys used as input to the message digest process), along with the
digest algorithm identifier and any associated parameters, party A
would use a value of ASN.1 type DigestedData with the optional
eContent component of the encapContentInfo component
of DigestedData omitted. In practice, in order to provide origin
authentication, this value of ASN.1 type DigestedData might be wrapped
in a value of ASN.1 type SignedData.
Party B would save the hash received from party A to use to compare against the actual public key(s) used by party A to operate the key agreement scheme. Party B would send party A their public key(s) and party A would respond with their public key(s). Party B could then compute a hash on the the key(s) sent by party A to determine if they were the same keys previously commited to by party A.
ASN.1 type DigestedData is defined in ISO 22895 and IETF
RFC 3852:2004 as:
DigestedData ::= SEQUENCE {
version CMSVersion,
digestAlgorithm DigestAlgorithmIdentifier,
encapContentInfo EncapsulatedContentInfo,
digest Digest
}
EncapsulatedContentInfo ::= SEQUENCE {
eContentType ContentType,
eContent [0] EXPLICIT OCTET STRING OPTIONAL
}
Digest ::= OCTET STRING
ASN.1 type ECKeyCommitment is defined in ISO 22895 as:
ECKeyCommitment ::= SEQUENCE {
staticPublicKey ECPoint,
ephemeralPublicKey ECPoint OPTIONAL
}
ECPoint ::= OCTET STRING
| Constructor Summary | |
|---|---|
DigestedDataExample()
Default constructor for DigestedDataExample. |
|
| Method Summary | |
|---|---|
static void |
main(java.lang.String[] args)
Main allows this class to be run as an application from the command line. |
void |
showXMLandDER()
Run the DigestedData example program. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public DigestedDataExample()
DigestedDataExample.
| Method Detail |
|---|
public void showXMLandDER()
throws java.lang.Exception
java.lang.Exceptionpublic static void main(java.lang.String[] args)
args - command line arguments (not used).
|
XCMS Toolkit | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||