View Javadoc
1   /*
2    * GordianKnot: Security Suite
3    * Copyright 2012-2026. Tony Washer
4    *
5    * Licensed under the Apache License, Version 2.0 (the "License"); you may not
6    * use this file except in compliance with the License.  You may obtain a copy
7    * of the License at
8    *
9    *   http://www.apache.org/licenses/LICENSE-2.0
10   *
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13   * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
14   * License for the specific language governing permissions and limitations under
15   * the License.
16   */
17  package io.github.tonywasher.joceanus.gordianknot.api.zip;
18  
19  import io.github.tonywasher.joceanus.gordianknot.api.base.GordianException;
20  import io.github.tonywasher.joceanus.gordianknot.api.keypair.GordianKeyPair;
21  import io.github.tonywasher.joceanus.gordianknot.api.lock.GordianLock;
22  
23  /**
24   * Lock interface.
25   */
26  public interface GordianZipLock {
27      /**
28       * Is this still locked?
29       *
30       * @return true/false
31       */
32      boolean isLocked();
33  
34      /**
35       * Is this available to lock a zipFile?
36       *
37       * @return true/false
38       */
39      boolean isFresh();
40  
41      /**
42       * Obtain lockType.
43       *
44       * @return the lockType
45       */
46      GordianZipLockType getLockType();
47  
48      /**
49       * Obtain lockBytes.
50       *
51       * @return the lockBytes
52       * @throws GordianException on error
53       */
54      byte[] getLockBytes() throws GordianException;
55  
56      /**
57       * Unlock with resolved lock.
58       *
59       * @param pLock the resolved lock
60       * @throws GordianException on error
61       */
62      void unlock(GordianLock<?> pLock) throws GordianException;
63  
64      /**
65       * Unlock with password.
66       *
67       * @param pPassword the password
68       * @throws GordianException on error
69       */
70      void unlock(char[] pPassword) throws GordianException;
71  
72      /**
73       * Unlock with keyPair and password.
74       *
75       * @param pKeyPair  the keyPair
76       * @param pPassword the password
77       * @throws GordianException on error
78       */
79      void unlock(GordianKeyPair pKeyPair,
80                  char[] pPassword) throws GordianException;
81  }