Class | Line # | Actions | |||||
---|---|---|---|---|---|---|---|
BlockSignatureVerifier | 37 | 0 | - | 0 | 0 |
1 | /* | |
2 | * See the NOTICE file distributed with this work for additional | |
3 | * information regarding copyright ownership. | |
4 | * | |
5 | * This is free software; you can redistribute it and/or modify it | |
6 | * under the terms of the GNU Lesser General Public License as | |
7 | * published by the Free Software Foundation; either version 2.1 of | |
8 | * the License, or (at your option) any later version. | |
9 | * | |
10 | * This software is distributed in the hope that it will be useful, | |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 | * Lesser General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU Lesser General Public | |
16 | * License along with this software; if not, write to the Free | |
17 | * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | |
18 | * 02110-1301 USA, or see the FSF site: http://www.fsf.org. | |
19 | */ | |
20 | package org.xwiki.rendering.signature; | |
21 | ||
22 | import java.io.IOException; | |
23 | import java.security.GeneralSecurityException; | |
24 | ||
25 | import org.xwiki.component.annotation.Role; | |
26 | import org.xwiki.crypto.pkix.CertificateProvider; | |
27 | import org.xwiki.crypto.signer.param.CMSSignedDataVerified; | |
28 | import org.xwiki.rendering.block.Block; | |
29 | ||
30 | /** | |
31 | * Verify signature of a {@link org.xwiki.rendering.block.Block}. | |
32 | * | |
33 | * @version $Id: d7afeda9e4636298bd07d7f57684e7e0239fb293 $ | |
34 | * @since 6.1M2 | |
35 | */ | |
36 | @Role | |
37 | public interface BlockSignatureVerifier | |
38 | { | |
39 | /** | |
40 | * Verify a signature. | |
41 | * | |
42 | * The signature of the certificate is verified as well, but not the certificate chain. | |
43 | * | |
44 | * @param signature a signature produced by this signer. | |
45 | * @param block a rendering block to sign. | |
46 | * @param certificateProvider provider of certificates. | |
47 | * @return the certified public key that have signed the given block or null if the signature is invalid. | |
48 | * @throws GeneralSecurityException on signature verification operation error. | |
49 | * @throws IOException on encoding/decoding operation error. | |
50 | */ | |
51 | CMSSignedDataVerified verify(byte[] signature, Block block, CertificateProvider certificateProvider) | |
52 | throws GeneralSecurityException, IOException; | |
53 | ||
54 | /** | |
55 | * Check if the given block can be supported by this signer. | |
56 | * | |
57 | * @param block the block to check. | |
58 | * @return true if this block can be signed/verified by this signer. | |
59 | */ | |
60 | boolean isSupported(Block block); | |
61 | } |