View Javadoc
1   /*
2    * Copyright 2012 Brian Matthews
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *     http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  
17  package com.btmatthews.maven.plugins.crx;
18  
19  /**
20   * Encapsulates the public key, signature and contents for a CRX archive.
21   *
22   * @author <a href="mailto:brian@btmatthews.com">Brian Matthews</a>
23   * @since 1.1.o
24   */
25  public class CRXArchive {
26  
27      /**
28       * The public key used to verify the signature of the CRX archive.
29       */
30      private byte[] publicKey;
31  
32      /**
33       * The signature for the contents of the CRX archive.
34       */
35      private byte[] signature;
36  
37      /**
38       * The contents of the CRX archive.
39       */
40      private byte[] data;
41  
42      /**
43       * Initialise a CRX archive object.
44       *
45       * @param key The public key used to verify the signature of the CRX archive.
46       * @param sig The signature for the contents of the CRX archive.
47       * @param buf The contents of the CRX archive.
48       */
49      public CRXArchive(final byte[] key, final byte[] sig, final byte[] buf) {
50          publicKey = key;
51          signature = sig;
52          data = buf;
53      }
54  
55      /**
56       * Get the public key used to verify the signature of the CRX archive.
57       *
58       * @return The public key.
59       */
60      public byte[] getPublicKey() {
61          return publicKey;
62      }
63  
64      /**
65       * Get the signature for the contents of the CRX archive.
66       *
67       * @return The signature.
68       */
69      public byte[] getSignature() {
70          return signature;
71      }
72  
73      /**
74       * Get the contents of the CRX archive.
75       *
76       * @return The contents.
77       */
78      public byte[] getData() {
79          return data;
80      }
81  }