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);
}
}
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);
}
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;
}
Aggregations