View Javadoc
1   package civitas.bboard.common;
2   
3   import org.bouncycastle.crypto.CryptoException;
4   import org.springframework.beans.factory.annotation.Autowired;
5   import org.springframework.stereotype.Controller;
6   
7   import civitas.crypto.messagedigest.CryptoHash;
8   import civitas.crypto.rsapublickey.VerifyPublicKeySignature;
9   
10  @Controller
11  public class VerifyBBPost {
12  
13  	@Autowired
14  	VerifyPublicKeySignature verifyPublicKeySignature;
15  
16  	@Autowired
17  	CryptoHash cryptoHash;
18  
19  	public boolean apply(final BBPost that) throws CryptoException {
20  		byte[] hash = cryptoHash.apply(that.msg.getBytes());
21  		return verifyPublicKeySignature.apply(that.sig, hash);
22  	}
23  }