|
|||||||||
| Home >> All >> ch >> ethz >> [ prose overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
ch.ethz.prose
Class SignedAspect

java.lang.Objectch.ethz.prose.Aspect
ch.ethz.prose.SignedAspect
- All Implemented Interfaces:
- Insertable, java.io.Serializable
- public final class SignedAspect
- extends Aspect
Class SignedAspect is a wrapper for an Aspect contained in a
SignedObject. Thus it is possible to verify the signer of the
extension before it is used. For security reason, this class
is (and has to be) declared final
At construction, the public and private keys passed as
KeyPair are not checked for being a valid pair
and the private key is not stored for later use. Only
an explicit call to verifyExtension does
check the public key stored. The signing algorithm
to use is deduced by the algorithm type of the public
key: if the public key is of type "DSA" then the algorithm
"SHA1withDSA" is used, in case of an "RSA" key it is "MD5withRSA".
Keys generated with the keytool for the standard
Java 2 keystore are of type "DSA" if not specified otherwise.
The creation of certificates has to be performed by a third party
tool, such as the ones provided with OpenSSL.
The JCE signing engine that is used can not be specified for the moment, this class simply uses the first available one.
To repeat: It is up to the user of this class to assign trust to such an extension, this class can only be used to transfer an extension secured from unnoticed changes.
Remark: to simplify the security auditing of this class, the necessary and constant parameters are passed to the constructor and no additional setter-methods are available.
- Version:
- $Revision: 1.1.1.1 $
| Field Summary | |
private static java.security.KeyPair |
keyPair
|
private java.security.PublicKey |
publicKey
|
private java.security.SignedObject |
signedExtension
|
(package private) boolean |
verified
|
(package private) Aspect |
wrappedExtension
|
| Fields inherited from class ch.ethz.prose.Aspect |
aspectID, birthDayCount, priority |
| Constructor Summary | |
SignedAspect(Aspect extension,
java.security.KeyPair keys)
Constructs a signed extension and protects it from being modified unnoticed. |
|
| Method Summary | |
protected ch.ethz.prose.crosscut.Crosscut[] |
crosscuts()
This is a template meethod. |
boolean |
equals(java.lang.Object o)
Delegate to wrapped extension |
java.util.List |
getCrosscuts()
Return a list of crosscuts owned by this Aspect. |
Aspect |
getExtension()
Returns wrapped extension without checking it for being signed by a key corresponding to the public key stored. |
java.security.PublicKey |
getPublicKey()
Returns public key that possibly corresponds to signing key |
java.lang.String |
getSigningAlgorithm()
Returns signing algorithm name |
int |
hashCode()
delegate to wrapped extension |
void |
insertionAction(boolean beforeInsertion)
This method is called before and after this aspect is inserted into an AspectManager. |
static SignedAspect |
signExtension(Aspect ext)
Convinience method to sign extensions. |
java.lang.String |
toString()
Implementation: we don't use getExtension() here, as we don't want to de-marshall extension just because of the toString call |
void |
verifyExtension()
Verifies that the public key stored in this object corresponds to the private key used to sign the extension. |
void |
withdrawalAction(boolean beforeWithdrawal)
this method is called before and after the withdrawal of an aspect. |
| Methods inherited from class ch.ethz.prose.Aspect |
associateTo, generateUniqueAssociation, getAssociatedObject, getPriority, setPriority |
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
keyPair
private static java.security.KeyPair keyPair
signedExtension
private java.security.SignedObject signedExtension
publicKey
private java.security.PublicKey publicKey
wrappedExtension
transient Aspect wrappedExtension
verified
transient boolean verified
| Constructor Detail |
SignedAspect
public SignedAspect(Aspect extension, java.security.KeyPair keys)
- Constructs a signed extension and protects it from being modified unnoticed.
Only the public key from the key pair passed is store in the generated object.
| Method Detail |
insertionAction
public void insertionAction(boolean beforeInsertion)
throws AspectInsertionException
- Description copied from class:
Aspect - This method is called before and after this
aspect is inserted into an
AspectManager. By overriding the default (which is a no-op), one can define setup actions. If this method throws an exception, the aspect insertion fails.- Specified by:
insertionActionin interfaceInsertable- Overrides:
insertionActionin classAspect
withdrawalAction
public void withdrawalAction(boolean beforeWithdrawal)
- Description copied from class:
Aspect - this method is called before and after the withdrawal of an aspect.
- Specified by:
withdrawalActionin interfaceInsertable- Overrides:
withdrawalActionin classAspect
crosscuts
protected ch.ethz.prose.crosscut.Crosscut[] crosscuts()
- Description copied from class:
Aspect - This is a template meethod. Users must define
this method to return a list of crosscut objects
that belong to this aspect
getCrosscuts
public java.util.List getCrosscuts()
- Description copied from class:
Aspect - Return a list of crosscuts owned by this Aspect. Note that this
method returns the same list of objects during
the existence of asspect. This list is initialized using the
crosscutstemplate method.- Overrides:
getCrosscutsin classAspect
signExtension
public static SignedAspect signExtension(Aspect ext)
- Convinience method to sign extensions. Throws IllegalStateException
if signing is not possible.
FIX: CONTAINS A LOT OF HARD CODED STUFF!!!!
verifyExtension
public void verifyExtension()
throws java.security.NoSuchAlgorithmException,
java.security.SignatureException,
java.security.InvalidKeyException
- Verifies that the public key stored in this object corresponds
to the private key used to sign the extension.
getExtension
public Aspect getExtension()
- Returns wrapped extension without checking it for being signed
by a key corresponding to the public key stored.
getPublicKey
public java.security.PublicKey getPublicKey()
- Returns public key that possibly corresponds to signing key
getSigningAlgorithm
public java.lang.String getSigningAlgorithm()
- Returns signing algorithm name
toString
public java.lang.String toString()
- Implementation: we don't use getExtension() here, as we don't want to
de-marshall extension just because of the toString call
equals
public boolean equals(java.lang.Object o)
hashCode
public int hashCode()
|
|||||||||
| Home >> All >> ch >> ethz >> [ prose overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC