Skip to content

Most visited

Recently visited

navigation
Added in API level 1

SignedObject

public final class SignedObject
extends Object implements Serializable

java.lang.Object
   ↳ java.security.SignedObject


A SignedObject instance acts as a container for another object. The SignedObject contains the target in serialized form along with a digital signature of the serialized data.

Summary

Public constructors

SignedObject(Serializable object, PrivateKey signingKey, Signature signingEngine)

Constructs a new instance of SignedObject with the target object, the private key and the engine to compute the signature.

Public methods

String getAlgorithm()

Returns the name of the algorithm of this SignedObject.

Object getObject()

Returns the encapsulated object.

byte[] getSignature()

Returns the signature data of the encapsulated serialized object.

boolean verify(PublicKey verificationKey, Signature verificationEngine)

Indicates whether the contained signature for the encapsulated object is valid.

Inherited methods

From class java.lang.Object

Public constructors

SignedObject

Added in API level 1
SignedObject (Serializable object, 
                PrivateKey signingKey, 
                Signature signingEngine)

Constructs a new instance of SignedObject with the target object, the private key and the engine to compute the signature. The given object is signed with the specified key and engine.

Parameters
object Serializable: the object to bes signed.
signingKey PrivateKey: the private key, used to sign the object.
signingEngine Signature: the engine that performs the signature generation.
Throws
IOException if a serialization error occurs.
InvalidKeyException if the private key is not valid.
SignatureException if signature generation failed.

Public methods

getAlgorithm

Added in API level 1
String getAlgorithm ()

Returns the name of the algorithm of this SignedObject.

Returns
String the name of the algorithm of this SignedObject.

getObject

Added in API level 1
Object getObject ()

Returns the encapsulated object. Each time this method is invoked, the encapsulated object is deserialized before it is returned.

Returns
Object the encapsulated object.
Throws
IOException if deserialization failed.
ClassNotFoundException if the class of the encapsulated object can not be found.

getSignature

Added in API level 1
byte[] getSignature ()

Returns the signature data of the encapsulated serialized object.

Returns
byte[] the signature data of the encapsulated serialized object.

verify

Added in API level 1
boolean verify (PublicKey verificationKey, 
                Signature verificationEngine)

Indicates whether the contained signature for the encapsulated object is valid.

Parameters
verificationKey PublicKey: the public key to verify the signature.
verificationEngine Signature: the signature engine.
Returns
boolean true if the contained signature for the encapsulated object is valid, false otherwise.
Throws
InvalidKeyException if the public key is invalid.
SignatureException if signature verification failed.
This site uses cookies to store your preferences for site-specific language and display options.

Hooray!

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.