2 * ============LICENSE_START====================================================
4 * ===========================================================================
5 * Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
7 * Modifications Copyright (C) 2018 IBM.
8 * ===========================================================================
9 * Licensed under the Apache License, Version 2.0 (the "License");
10 * you may not use this file except in compliance with the License.
11 * You may obtain a copy of the License at
13 * http://www.apache.org/licenses/LICENSE-2.0
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
20 * ============LICENSE_END====================================================
24 package org.onap.aaf.auth.cm.data;
26 import java.io.IOException;
27 import java.security.KeyPair;
28 import java.security.cert.X509Certificate;
30 import org.onap.aaf.auth.cm.ca.CA;
31 import org.onap.aaf.auth.cm.cert.CSRMeta;
32 import org.onap.aaf.cadi.configure.CertException;
33 import org.onap.aaf.cadi.configure.Factory;
34 import org.onap.aaf.misc.env.Trans;
36 public class CertResp {
38 private KeyPair keyPair;
39 private String challenge;
41 private String privateKey;
42 private String certString;
43 private String[] trustChain;
44 private String[] notes;
46 public CertResp(Trans trans, CA ca, X509Certificate x509, CSRMeta csrMeta, String[] trustChain, String[] notes) throws IOException, CertException {
47 keyPair = csrMeta.keypair(trans);
48 privateKey = Factory.toString(trans, keyPair.getPrivate());
49 certString = Factory.toString(trans,x509);
50 challenge=csrMeta.challenge();
52 this.trustChain = trustChain;
56 // Use for Read Responses, etc
57 public CertResp(String cert) {
62 public String asCertString() {
66 public String privateString() {
70 public String challenge() {
71 return challenge==null?"":challenge;
74 public String[] notes() {
78 public String[] caIssuerDNs() {
79 return ca.getCaIssuerDNs();
86 public String[] trustChain() {
90 public String[] trustCAs() {
91 return ca.getTrustedCAs();