/** * Unmarshals the marshaled context. Performs digital signature verification, then returns the * unmarshaled context items. * * @param marshaledContext Marshaled context * @param authSignature If set, the digital signature is verified. * @return The unmarshaled context. * @throws Exception Unspecified exception. */ public ContextItems unmarshal(String marshaledContext, String authSignature) throws Exception { ContextItems contextItems = new ContextItems(); contextItems.addItems(marshaledContext); String whichKey = contextItems.getItem(PROPNAME_KEY); String timestamp = contextItems.getItem(PROPNAME_TIME); if (authSignature != null && !signer.verify(authSignature, marshaledContext, timestamp, whichKey)) { throw new MarshalException("Invalid digital signature"); } return contextItems; } }
/** * Unmarshals the marshaled context. Performs digital signature verification, then returns the * unmarshaled context items. * * @param marshaledContext Marshaled context * @param authSignature If set, the digital signature is verified. * @return The unmarshaled context. * @throws Exception Unspecified exception. */ public ContextItems unmarshal(String marshaledContext, String authSignature) throws Exception { ContextItems contextItems = new ContextItems(); contextItems.addItems(marshaledContext); String whichKey = contextItems.getItem(PROPNAME_KEY); String timestamp = contextItems.getItem(PROPNAME_TIME); if (authSignature != null && !signer.verify(authSignature, marshaledContext, timestamp, whichKey)) { throw new MarshalException("Invalid digital signature"); } return contextItems; } }