public ClientSSK(String docName, byte[] pubKeyHash, byte[] extras, DSAPublicKey pubKey, byte[] cryptoKey) throws MalformedURLException {
this.docName = docName;
this.pubKey = pubKey;
this.pubKeyHash = pubKeyHash;
if(docName == null)
throw new MalformedURLException("No document name.");
if(extras == null)
throw new MalformedURLException("No extra bytes in SSK - maybe a 0.5 key?");
if(extras.length < 5)
throw new MalformedURLException("Extra bytes too short: "+extras.length+" bytes");
this.cryptoAlgorithm = extras[2];
if(cryptoAlgorithm != Key.ALGO_AES_PCFB_256_SHA256)
throw new MalformedURLException("Unknown encryption algorithm "+cryptoAlgorithm);
if(!Arrays.equals(extras, getExtraBytes()))
throw new MalformedURLException("Wrong extra bytes");
if(pubKeyHash.length != NodeSSK.PUBKEY_HASH_SIZE)
throw new MalformedURLException("Pubkey hash wrong length: "+pubKeyHash.length+" should be "+NodeSSK.PUBKEY_HASH_SIZE);
if(cryptoKey.length != CRYPTO_KEY_LENGTH)
throw new MalformedURLException("Decryption key wrong length: "+cryptoKey.length+" should be "+CRYPTO_KEY_LENGTH);
MessageDigest md = SHA256.getMessageDigest();
try {
if (pubKey != null) {
byte[] pubKeyAsBytes = pubKey.asBytes();
md.update(pubKeyAsBytes);