public CertWithRevocationInfoWrapper(CertWithRevocationInfo info) { this.cert = new CertWithDbIdWrapper(info.getCert()); this.revInfo = info.getRevInfo(); this.certprofile = info.getCertprofile(); }
public CertWithRevocationInfo toCertWithRevocationInfo() throws CertificateException { CertWithRevocationInfo ret = new CertWithRevocationInfo(); ret.setCert(cert.toCertWithDbId()); ret.setCertprofile(certprofile); ret.setRevInfo(revInfo); return ret; }
public boolean isSignerRequired() { int permission = caEntry.getPermission(); return PermissionConstants.contains(permission, PermissionConstants.ENROLL_CROSS) || PermissionConstants.contains(permission, PermissionConstants.ENROLL_CERT) || PermissionConstants.contains(permission, PermissionConstants.GEN_CRL) || PermissionConstants.contains(permission, PermissionConstants.KEY_UPDATE); } // method isSignerRequired
@Override public CertWithRevocationInfo getCert(String caName, BigInteger serialNumber) throws CaMgmtException { MgmtRequest.GetCert req = new MgmtRequest.GetCert(); req.setCaName(caName); req.setSerialNumber(serialNumber); byte[] respBytes = transmit(MgmtAction.getCert, req); MgmtResponse.GetCert resp = parse(respBytes, MgmtResponse.GetCert.class); try { return resp.getResult().toCertWithRevocationInfo(); } catch (CertificateException ex) { throw new CaMgmtException("could not parse the certificate", ex); } }
@Override public X509Certificate generateRootCa(MgmtEntry.Ca caEntry, String certprofileName, byte[] encodedCsr, BigInteger serialNumber) throws CaMgmtException { MgmtRequest.GenerateRootCa req = new MgmtRequest.GenerateRootCa(); req.setCaEntry(new CaEntryWrapper(caEntry)); req.setCertprofileName(certprofileName); req.setEncodedCsr(encodedCsr); req.setSerialNumber(serialNumber); byte[] respBytes = transmit(MgmtAction.generateRootCa, req); MgmtResponse.ByteArray resp = parse(respBytes, MgmtResponse.ByteArray.class); return parseCert(resp.getResult()); }
@Override public MgmtEntry.Ca getCa(String caName) throws CaMgmtException { MgmtRequest.Name req = new MgmtRequest.Name(caName); byte[] respBytes = transmit(MgmtAction.getCa, req); MgmtResponse.GetCa resp = parse(respBytes, MgmtResponse.GetCa.class); try { return resp.getResult().toCaEntry(); } catch (CertificateException | InvalidConfException ex) { throw new CaMgmtException("could not convert CaEntryWrapper to CaEntry", ex); } }
@Override public boolean isPermitted(int permission) { return PermissionConstants.contains(caHasUser.getPermission(), permission); }
private void asssertMasterMode() throws CaMgmtException { if (!masterMode) { throw new CaMgmtException("operation not allowed in slave mode"); } }
public boolean supportsCmp() { return caEntry.getProtocoSupport().isCmp(); }
public boolean supportsScep() { return caEntry.getProtocoSupport().isScep(); }
public boolean supportsRest() { return caEntry.getProtocoSupport().isRest(); }
@Override public MgmtEntry.Signer getSigner(String name) throws CaMgmtException { MgmtRequest.Name req = new MgmtRequest.Name(name); byte[] respBytes = transmit(MgmtAction.getSigner, req); MgmtResponse.GetSigner resp = parse(respBytes, MgmtResponse.GetSigner.class); return resp.getResult().toSignerEntry(); }
@Override public boolean equals(Object obj) { if (this == obj) { return true; } else if (!(obj instanceof Ca)) { return false; } return equals((Ca) obj, false, false); }
@Override public boolean equals(Object obj) { if (this == obj) { return true; } else if (!(obj instanceof Publisher)) { return false; } return equals((Publisher) obj, false); }
@Override public List<MgmtEntry.Publisher> getPublishersForCa(String caName) throws CaMgmtException { MgmtRequest.Name req = new MgmtRequest.Name(caName); byte[] respBytes = transmit(MgmtAction.getPublishersForCa, req); MgmtResponse.GetPublischersForCa resp = parse(respBytes, MgmtResponse.GetPublischersForCa.class); return resp.getResult(); }