1   package com.atlassian.security.auth.trustedapps;
2   
3   public class DefaultEncryptedCertificate implements EncryptedCertificate
4   {
5       private final String id;
6       private final String key;
7       private final String certificate;
8       private final Integer protocolVersion;
9       private final String magic;
10      private final String signature;
11  
12      /**
13       * Constructor for protocol '0' certificates
14       *
15       * @param id The application id
16       * @param key The application public key
17       * @param certificate The certificate string
18       */
19      public DefaultEncryptedCertificate(String id, String key, String certificate)
20      {
21          this(id, key, certificate, null, null, null);
22      }
23  
24      /**
25       * Constructor for protocol '1' certificates
26       */
27      public DefaultEncryptedCertificate(String id, String key, String certificate, Integer protocolVersion, String magic)
28      {
29          this(id, key, certificate, protocolVersion, magic, null);
30      }
31  
32      /**
33       * Constructor for protocol '2' certificates
34       */
35      public DefaultEncryptedCertificate(String id, String key, String certificate, Integer protocolVersion, String magic, String signature)
36      {
37          Null.not("id", id);
38          Null.not("key", key);
39          Null.not("certificate", certificate);
40  
41          this.id = id;
42          this.key = key;
43          this.certificate = certificate;
44          this.protocolVersion = protocolVersion;
45          this.magic = magic;
46          
47          this.signature = signature;
48      }
49      
50      public String getCertificate()
51      {
52          return certificate;
53      }
54  
55      public String getID()
56      {
57          return id;
58      }
59  
60      public String getSecretKey()
61      {
62          return key;
63      }
64  
65      public Integer getProtocolVersion()
66      {
67          return protocolVersion;
68      }
69  
70      public String getMagicNumber()
71      {
72          return magic;
73      }
74      
75      public String getSignature()
76      {
77          return signature;
78      }
79  }