Search in sources :

Example 6 with TPPPolicy

use of com.venafi.vcert.sdk.policy.api.domain.TPPPolicy in project vcert-java by Venafi.

the class TppConnector method setPolicy.

@Override
public void setPolicy(String policyName, PolicySpecification policySpecification) throws VCertException {
    try {
        TPPPolicy tppPolicy = TPPPolicySpecificationConverter.INSTANCE.convertFromPolicySpecification(policySpecification);
        setPolicy(policyName, tppPolicy);
    } catch (Exception e) {
        throw new VCertException(e);
    }
}
Also used : TPPPolicy(com.venafi.vcert.sdk.policy.api.domain.TPPPolicy) VCertException(com.venafi.vcert.sdk.VCertException) RetrieveCertificateTimeoutException(com.venafi.vcert.sdk.connectors.ConnectorException.RetrieveCertificateTimeoutException) TppRequestCertificateNotAllowedException(com.venafi.vcert.sdk.connectors.ConnectorException.TppRequestCertificateNotAllowedException) CertificateDNOrThumbprintWasNotProvidedException(com.venafi.vcert.sdk.connectors.ConnectorException.CertificateDNOrThumbprintWasNotProvidedException) RenewFailureException(com.venafi.vcert.sdk.connectors.ConnectorException.RenewFailureException) CertificateNotFoundByThumbprintException(com.venafi.vcert.sdk.connectors.ConnectorException.CertificateNotFoundByThumbprintException) CSRNotProvidedByUserException(com.venafi.vcert.sdk.connectors.ConnectorException.CSRNotProvidedByUserException) MissingCredentialsException(com.venafi.vcert.sdk.connectors.ConnectorException.MissingCredentialsException) TppManualCSRNotEnabledException(com.venafi.vcert.sdk.connectors.ConnectorException.TppManualCSRNotEnabledException) CertificatePendingException(com.venafi.vcert.sdk.connectors.ConnectorException.CertificatePendingException) VCertException(com.venafi.vcert.sdk.VCertException) MoreThanOneCertificateWithSameThumbprintException(com.venafi.vcert.sdk.connectors.ConnectorException.MoreThanOneCertificateWithSameThumbprintException) AttemptToRetryException(com.venafi.vcert.sdk.connectors.ConnectorException.AttemptToRetryException) RevokeFailureException(com.venafi.vcert.sdk.connectors.ConnectorException.RevokeFailureException) CouldNotParseRevokeReasonException(com.venafi.vcert.sdk.connectors.ConnectorException.CouldNotParseRevokeReasonException) TppPingException(com.venafi.vcert.sdk.connectors.ConnectorException.TppPingException)

Example 7 with TPPPolicy

use of com.venafi.vcert.sdk.policy.api.domain.TPPPolicy in project vcert-java by Venafi.

the class PolicyToTppPolicyConverter method setKeyBitStrength.

private void setKeyBitStrength(TPPPolicy tppPolicy, PolicySpecification policySpecification) {
    Policy policy = policySpecification.policy();
    Defaults defaults = policySpecification.defaults();
    if (policy != null && policy.keyPair() != null) {
        Integer[] rsaKeySizes = policy.keyPair().rsaKeySizes();
        if (rsaKeySizes != null && rsaKeySizes.length == 1)
            tppPolicy.keyBitStrength(rsaKeySizes[0].toString(), true);
    } else if (defaults != null && defaults.keyPair() != null && defaults.keyPair().rsaKeySize() != null)
        tppPolicy.keyBitStrength(defaults.keyPair().rsaKeySize().toString(), false);
}
Also used : TPPPolicy(com.venafi.vcert.sdk.policy.api.domain.TPPPolicy)

Example 8 with TPPPolicy

use of com.venafi.vcert.sdk.policy.api.domain.TPPPolicy in project vcert-java by Venafi.

the class PolicyToTppPolicyConverter method convertFromPolicy.

public TPPPolicy convertFromPolicy(PolicySpecification policySpecification) throws Exception {
    TPPPolicy tppPolicy = new TPPPolicy();
    if (policySpecification != null) {
        // copying the policy name
        copyStringProperty(policySpecification, tppPolicy, PolicySpecification::name, TPPPolicy::policyName);
        // copying the contact
        copyArrayStringProperty(policySpecification, tppPolicy, PolicySpecification::users, TPPPolicy::contact);
        // copying the approver
        copyArrayStringProperty(policySpecification, tppPolicy, PolicySpecification::approvers, TPPPolicy::approver);
        // setting policy's attributes
        copyArrayStringProperty(policySpecification.policy(), tppPolicy, Policy::domains, TPPPolicy::domainSuffixWhiteList);
        copyProhibitWildcard(tppPolicy, policySpecification);
        copyStringProperty(policySpecification.policy(), tppPolicy, Policy::certificateAuthority, TPPPolicy::certificateAuthority);
        // copying management type
        setManagementType(tppPolicy, policySpecification);
        // setting policy subject attributes
        copySubjectAttributes(policySpecification, tppPolicy);
        // setting policy keypair
        copyKeyPairAttributes(policySpecification, tppPolicy);
        // setting policy alt names
        setProhibitedSANTypes(tppPolicy, policySpecification);
    }
    return tppPolicy;
}
Also used : TPPPolicy(com.venafi.vcert.sdk.policy.api.domain.TPPPolicy) TPPPolicy(com.venafi.vcert.sdk.policy.api.domain.TPPPolicy)

Aggregations

TPPPolicy (com.venafi.vcert.sdk.policy.api.domain.TPPPolicy)8 VCertException (com.venafi.vcert.sdk.VCertException)2 AttemptToRetryException (com.venafi.vcert.sdk.connectors.ConnectorException.AttemptToRetryException)2 CSRNotProvidedByUserException (com.venafi.vcert.sdk.connectors.ConnectorException.CSRNotProvidedByUserException)2 CertificateDNOrThumbprintWasNotProvidedException (com.venafi.vcert.sdk.connectors.ConnectorException.CertificateDNOrThumbprintWasNotProvidedException)2 CertificateNotFoundByThumbprintException (com.venafi.vcert.sdk.connectors.ConnectorException.CertificateNotFoundByThumbprintException)2 CertificatePendingException (com.venafi.vcert.sdk.connectors.ConnectorException.CertificatePendingException)2 CouldNotParseRevokeReasonException (com.venafi.vcert.sdk.connectors.ConnectorException.CouldNotParseRevokeReasonException)2 MissingCredentialsException (com.venafi.vcert.sdk.connectors.ConnectorException.MissingCredentialsException)2 MoreThanOneCertificateWithSameThumbprintException (com.venafi.vcert.sdk.connectors.ConnectorException.MoreThanOneCertificateWithSameThumbprintException)2 RenewFailureException (com.venafi.vcert.sdk.connectors.ConnectorException.RenewFailureException)2 RetrieveCertificateTimeoutException (com.venafi.vcert.sdk.connectors.ConnectorException.RetrieveCertificateTimeoutException)2 RevokeFailureException (com.venafi.vcert.sdk.connectors.ConnectorException.RevokeFailureException)2 TppManualCSRNotEnabledException (com.venafi.vcert.sdk.connectors.ConnectorException.TppManualCSRNotEnabledException)2 TppPingException (com.venafi.vcert.sdk.connectors.ConnectorException.TppPingException)2 TppRequestCertificateNotAllowedException (com.venafi.vcert.sdk.connectors.ConnectorException.TppRequestCertificateNotAllowedException)2 PolicySpecification (com.venafi.vcert.sdk.policy.domain.PolicySpecification)2