Code example for SecretKeySpec

Methods: getEncoded

0
  } 
		 
  private SecretKeySpec deriveMacSecret(SecretKeySpec key) {
    try { 
      MessageDigest md = MessageDigest.getInstance("SHA-1");
      byte[] secret    = md.digest(key.getEncoded());
		 
      return new SecretKeySpec(secret, "HmacSHA1");
    } catch (NoSuchAlgorithmException e) {
      throw new IllegalArgumentException("SHA-1 Not Supported!",e);
    } 
  } 
	 
  private byte[] buildMessageFromCiphertext(byte[] cipherText) {
    Message message = new Message(localRecord.getCurrentKeyPair().getId(),
				  remoteRecord.getCurrentRemoteKey().getId(),
				  localRecord.getNextKeyPair().getPublicKey(),
				  sessionRecord.getCounter(),
				  cipherText, sessionRecord.getSessionVersion(), Message.SUPPORTED_VERSION);
		 
Connect your IDE to all the code out there  Get Codota for Java