/** * Signs the specified {@link SignableSAMLObject} with the specified {@link Credential} and * {@code signatureAlgorithm}. */ static void sign(SignableSAMLObject signableObj, Credential signingCredential, String signatureAlgorithm) { requireNonNull(signableObj, "signableObj"); requireNonNull(signingCredential, "signingCredential"); requireNonNull(signatureAlgorithm, "signatureAlgorithm"); final Signature signature = signatureBuilder.buildObject(); signature.setSignatureAlgorithm(signatureAlgorithm); signature.setSigningCredential(signingCredential); signature.setCanonicalizationAlgorithm(ALGO_ID_C14N_EXCL_OMIT_COMMENTS); try { signature.setKeyInfo(keyInfoGenerator.generate(signingCredential)); } catch (SecurityException e) { throw new SamlException("failed to create a key info of signing credential", e); } signableObj.setSignature(signature); serialize(signableObj); try { Signer.signObject(signature); } catch (SignatureException e) { throw new SamlException("failed to sign a SAML object", e); } }
spSsoDescriptor.getKeyDescriptors().add( buildKeyDescriptorElement(UsageType.SIGNING, keyInfoGenerator.generate(signingCredential))); spSsoDescriptor.getKeyDescriptors().add( buildKeyDescriptorElement(UsageType.ENCRYPTION, keyInfoGenerator.generate(encryptionCredential))); } catch (SecurityException e) { throw new SamlException("failed to generate KeyInfo element", e);
protected final KeyInfo generateKeyInfoForCredential(final Credential credential) { try { return getKeyInfoGenerator().generate(credential); } catch (final org.opensaml.security.SecurityException e) { throw new SAMLException("Unable to generate keyInfo from given credential", e); } }
KeyInfo keyInfo = kiGenerator.generate(signingCredential); if (keyInfo != null) { Marshaller marshaller = XMLObjectProviderRegistrySupport.getMarshallerFactory().getMarshaller(keyInfo);
/** * Signs the specified {@link SignableSAMLObject} with the specified {@link Credential} and * {@code signatureAlgorithm}. */ static void sign(SignableSAMLObject signableObj, Credential signingCredential, String signatureAlgorithm) { requireNonNull(signableObj, "signableObj"); requireNonNull(signingCredential, "signingCredential"); requireNonNull(signatureAlgorithm, "signatureAlgorithm"); final Signature signature = signatureBuilder.buildObject(); signature.setSignatureAlgorithm(signatureAlgorithm); signature.setSigningCredential(signingCredential); signature.setCanonicalizationAlgorithm(ALGO_ID_C14N_EXCL_OMIT_COMMENTS); try { signature.setKeyInfo(keyInfoGenerator.generate(signingCredential)); } catch (SecurityException e) { throw new SamlException("failed to create a key info of signing credential", e); } signableObj.setSignature(signature); serialize(signableObj); try { Signer.signObject(signature); } catch (SignatureException e) { throw new SamlException("failed to sign a SAML object", e); } }
.getClass().getName()); try { encryptedData.setKeyInfo(generator.generate(encParams.getEncryptionCredential())); } catch (SecurityException e) { throw new EncryptionException("Error generating EncryptedData KeyInfo", e);
spSsoDescriptor.getKeyDescriptors().add( buildKeyDescriptorElement(UsageType.SIGNING, keyInfoGenerator.generate(signingCredential))); spSsoDescriptor.getKeyDescriptors().add( buildKeyDescriptorElement(UsageType.ENCRYPTION, keyInfoGenerator.generate(encryptionCredential))); } catch (SecurityException e) { throw new SamlException("failed to generate KeyInfo element", e);
KeyInfo keyInfo = kiFactory.newInstance().generate(signingCredential); signature.setKeyInfo(keyInfo); } catch (org.opensaml.security.SecurityException ex) {
KeyInfo keyInfo = kiFactory.newInstance().generate(signingCredential); signature.setKeyInfo(keyInfo); } catch (org.opensaml.security.SecurityException ex) {
public void sign(final SignableSAMLObject signableObject) throws SecurityException { org.opensaml.xmlsec.signature.Signature signature = OpenSAMLUtil.buildSignature(); signature.setCanonicalizationAlgorithm(SignatureConstants.ALGO_ID_C14N_EXCL_OMIT_COMMENTS); signature.setSignatureAlgorithm(sigAlgo); signature.setSigningCredential(loader.getCredential()); signature.setKeyInfo(keyInfoGenerator.generate(loader.getCredential())); signableObject.setSignature(signature); signableObject.releaseDOM(); signableObject.releaseChildrenDOM(true); }
final KeyInfoGenerator kig = kigf.newInstance(); try { final KeyInfo keyInfo = kig.generate(cred); scData.getKeyInfos().add(keyInfo); } catch (final SecurityException e) {
keyInfoGeneratorFactory.setEmitEntityCertificate(true); KeyInfoGenerator keyInfoGenerator = keyInfoGeneratorFactory.newInstance(); keyInfoGenerator.generate(loader.getCredential()); keyDescriptor.setKeyInfo(keyInfoGenerator.generate(loader.getCredential())); spSSODescriptor.getKeyDescriptors().add(keyDescriptor);
KeyInfo keyInfo = kiFactory.newInstance().generate(signingCredential); signature.setKeyInfo(keyInfo); } catch (org.opensaml.security.SecurityException ex) {
public KeyDescriptor getKeyDescriptor(SimpleKey key) { SAMLObjectBuilder<KeyDescriptor> builder = (SAMLObjectBuilder<KeyDescriptor>) getBuilderFactory() .getBuilder(KeyDescriptor.DEFAULT_ELEMENT_NAME); KeyDescriptor descriptor = builder.buildObject(); KeyStoreCredentialResolver resolver = getCredentialsResolver(key); Credential credential = getCredential(key, resolver); try { KeyInfo info = getKeyInfoGenerator(credential).generate(credential); descriptor.setKeyInfo(info); if (key.getType() != null) { descriptor.setUse(UsageType.valueOf(key.getType().toString())); } else { descriptor.setUse(UsageType.SIGNING); } return descriptor; } catch (SecurityException e) { throw new SamlKeyException(e); } }
KeyInfo keyInfo = x509KeyInfoGeneratorFactory.newInstance().generate(signingCredential); signature.setKeyInfo(keyInfo); } catch (org.opensaml.security.SecurityException e) {