to top
Android APIs
public final class

SignedObject

extends Object
implements Serializable
java.lang.Object
   ↳ java.security.SignedObject

Class Overview

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.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public SignedObject (Serializable object, PrivateKey signingKey, Signature signingEngine)

Added in API level 1

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 the object to bes signed.
signingKey the private key, used to sign the object.
signingEngine 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

public String getAlgorithm ()

Added in API level 1

Returns the name of the algorithm of this SignedObject.

Returns
  • the name of the algorithm of this SignedObject.

public Object getObject ()

Added in API level 1

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

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

public byte[] getSignature ()

Added in API level 1

Returns the signature data of the encapsulated serialized object.

Returns
  • the signature data of the encapsulated serialized object.

public boolean verify (PublicKey verificationKey, Signature verificationEngine)

Added in API level 1

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

Parameters
verificationKey the public key to verify the signature.
verificationEngine the signature engine.
Returns
  • 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.