private String setupEncryptedKey(AbstractTokenWrapper wrapper, AbstractToken sigToken) throws WSSecurityException { Instant created = Instant.now(); Instant expires = created.plusSeconds(WSS4JUtils.getSecurityTokenLifetime(message) / 1000L); SecurityToken tempTok = new SecurityToken(IDGenerator.generateID(null), created, expires); KeyGenerator keyGenerator = KeyUtils.getKeyGenerator(sbinding.getAlgorithmSuite().getAlgorithmSuiteType().getEncryption()); SecretKey symmetricKey = keyGenerator.generateKey(); tempTok.setKey(symmetricKey); tempTok.setSecret(symmetricKey.getEncoded()); TokenStoreUtils.getTokenStore(message).add(tempTok); return tempTok.getId(); }
private String setupEncryptedKey(AbstractTokenWrapper wrapper, AbstractToken sigToken) throws WSSecurityException { Instant created = Instant.now(); Instant expires = created.plusSeconds(WSS4JUtils.getSecurityTokenLifetime(message) / 1000L); SecurityToken tempTok = new SecurityToken(IDGenerator.generateID(null), created, expires); KeyGenerator keyGenerator = KeyUtils.getKeyGenerator(sbinding.getAlgorithmSuite().getAlgorithmSuiteType().getEncryption()); SecretKey symmetricKey = keyGenerator.generateKey(); tempTok.setKey(symmetricKey); tempTok.setSecret(symmetricKey.getEncoded()); TokenStoreUtils.getTokenStore(message).add(tempTok); return tempTok.getId(); }
private String setupUTDerivedKey(UsernameToken sigToken) throws WSSecurityException { boolean useMac = hasSignedPartsOrElements(); WSSecUsernameToken usernameToken = addDKUsernameToken(sigToken, useMac); String id = usernameToken.getId(); byte[] secret = usernameToken.getDerivedKey(); Instant created = Instant.now(); Instant expires = created.plusSeconds(WSS4JUtils.getSecurityTokenLifetime(message) / 1000L); SecurityToken tempTok = new SecurityToken(id, usernameToken.getUsernameTokenElement(), created, expires); tempTok.setSecret(secret); tokenStore.add(tempTok); return id; }
private String setupUTDerivedKey(UsernameToken sigToken) throws WSSecurityException { boolean useMac = hasSignedPartsOrElements(); WSSecUsernameToken usernameToken = addDKUsernameToken(sigToken, useMac); String id = usernameToken.getId(); byte[] secret = usernameToken.getDerivedKey(); Instant created = Instant.now(); Instant expires = created.plusSeconds(WSS4JUtils.getSecurityTokenLifetime(message) / 1000L); SecurityToken tempTok = new SecurityToken(id, usernameToken.getUsernameTokenElement(), created, expires); tempTok.setSecret(secret); tokenStore.add(tempTok); return id; }
private SecurityToken getEncryptedKey() { WSSecurityEngineResult encryptedKeyResult = getEncryptedKeyResult(); if (encryptedKeyResult != null) { // Store it in the cache Instant created = Instant.now(); Instant expires = created.plusSeconds(WSS4JUtils.getSecurityTokenLifetime(message) / 1000L); String encryptedKeyID = (String)encryptedKeyResult.get(WSSecurityEngineResult.TAG_ID); SecurityToken securityToken = new SecurityToken(encryptedKeyID, created, expires); securityToken.setSecret((byte[])encryptedKeyResult.get(WSSecurityEngineResult.TAG_SECRET)); securityToken.setSHA1(getSHA1((byte[])encryptedKeyResult .get(WSSecurityEngineResult.TAG_ENCRYPTED_EPHEMERAL_KEY))); return securityToken; } return null; }
private SecurityToken getEncryptedKey() { WSSecurityEngineResult encryptedKeyResult = getEncryptedKeyResult(); if (encryptedKeyResult != null) { // Store it in the cache Instant created = Instant.now(); Instant expires = created.plusSeconds(WSS4JUtils.getSecurityTokenLifetime(message) / 1000L); String encryptedKeyID = (String)encryptedKeyResult.get(WSSecurityEngineResult.TAG_ID); SecurityToken securityToken = new SecurityToken(encryptedKeyID, created, expires); securityToken.setSecret((byte[])encryptedKeyResult.get(WSSecurityEngineResult.TAG_SECRET)); securityToken.setSHA1(getSHA1((byte[])encryptedKeyResult .get(WSSecurityEngineResult.TAG_ENCRYPTED_EPHEMERAL_KEY))); return securityToken; } return null; }
private SecurityToken getUTDerivedKey() throws WSSecurityException { List<WSHandlerResult> results = CastUtils.cast((List<?>)message.getExchange().getInMessage() .get(WSHandlerConstants.RECV_RESULTS)); for (WSHandlerResult rResult : results) { List<WSSecurityEngineResult> wsSecEngineResults = rResult.getActionResults().get(WSConstants.UT_NOPASSWORD); if (wsSecEngineResults != null) { for (WSSecurityEngineResult wser : wsSecEngineResults) { String utID = (String)wser.get(WSSecurityEngineResult.TAG_ID); if (utID == null || utID.length() == 0) { utID = wssConfig.getIdAllocator().createId("UsernameToken-", null); } Instant created = Instant.now(); Instant expires = created.plusSeconds(WSS4JUtils.getSecurityTokenLifetime(message) / 1000L); SecurityToken securityToken = new SecurityToken(utID, created, expires); byte[] secret = (byte[])wser.get(WSSecurityEngineResult.TAG_SECRET); securityToken.setSecret(secret); return securityToken; } } } return null; }
private SecurityToken getUTDerivedKey() throws WSSecurityException { List<WSHandlerResult> results = CastUtils.cast((List<?>)message.getExchange().getInMessage() .get(WSHandlerConstants.RECV_RESULTS)); for (WSHandlerResult rResult : results) { List<WSSecurityEngineResult> wsSecEngineResults = rResult.getActionResults().get(WSConstants.UT_NOPASSWORD); if (wsSecEngineResults != null) { for (WSSecurityEngineResult wser : wsSecEngineResults) { String utID = (String)wser.get(WSSecurityEngineResult.TAG_ID); if (utID == null || utID.length() == 0) { utID = wssConfig.getIdAllocator().createId("UsernameToken-", null); } Instant created = Instant.now(); Instant expires = created.plusSeconds(WSS4JUtils.getSecurityTokenLifetime(message) / 1000L); SecurityToken securityToken = new SecurityToken(utID, created, expires); byte[] secret = (byte[])wser.get(WSSecurityEngineResult.TAG_SECRET); securityToken.setSecret(secret); return securityToken; } } } return null; }
private String setupEncryptedKey(AbstractTokenWrapper wrapper, AbstractToken sigToken) throws WSSecurityException { WSSecEncryptedKey encrKey = this.getEncryptedKeyBuilder(sigToken); assertTokenWrapper(wrapper); String id = encrKey.getId(); byte[] secret = encrKey.getEphemeralKey(); Instant created = Instant.now(); Instant expires = created.plusSeconds(WSS4JUtils.getSecurityTokenLifetime(message) / 1000L); SecurityToken tempTok = new SecurityToken( id, encrKey.getEncryptedKeyElement(), created, expires); tempTok.setSecret(secret); // Set the SHA1 value of the encrypted key, this is used when the encrypted // key is referenced via a key identifier of type EncryptedKeySHA1 tempTok.setSHA1(getSHA1(encrKey.getEncryptedEphemeralKey())); tokenStore.add(tempTok); // Create another cache entry with the SHA1 Identifier as the key for easy retrieval tokenStore.add(tempTok.getSHA1(), tempTok); String bstTokenId = encrKey.getBSTTokenId(); //If direct ref is used to refer to the cert //then add the cert to the sec header now if (bstTokenId != null && bstTokenId.length() > 0) { encrKey.prependBSTElementToHeader(); } return id; }
if (existingToken == null || existingToken.isExpired()) { Instant created = Instant.now(); Instant expires = created.plusSeconds(WSS4JUtils.getSecurityTokenLifetime(message) / 1000L);
private String setupEncryptedKey(AbstractTokenWrapper wrapper, AbstractToken sigToken) throws WSSecurityException { WSSecEncryptedKey encrKey = this.getEncryptedKeyBuilder(sigToken); assertTokenWrapper(wrapper); String id = encrKey.getId(); byte[] secret = encrKey.getEphemeralKey(); Instant created = Instant.now(); Instant expires = created.plusSeconds(WSS4JUtils.getSecurityTokenLifetime(message) / 1000L); SecurityToken tempTok = new SecurityToken( id, encrKey.getEncryptedKeyElement(), created, expires); tempTok.setSecret(secret); // Set the SHA1 value of the encrypted key, this is used when the encrypted // key is referenced via a key identifier of type EncryptedKeySHA1 tempTok.setSHA1(getSHA1(encrKey.getEncryptedEphemeralKey())); tokenStore.add(tempTok); // Create another cache entry with the SHA1 Identifier as the key for easy retrieval tokenStore.add(tempTok.getSHA1(), tempTok); String bstTokenId = encrKey.getBSTTokenId(); //If direct ref is used to refer to the cert //then add the cert to the sec header now if (bstTokenId != null && bstTokenId.length() > 0) { encrKey.prependBSTElementToHeader(); } return id; }
if (existingToken == null || existingToken.isExpired()) { Instant created = Instant.now(); Instant expires = created.plusSeconds(WSS4JUtils.getSecurityTokenLifetime(message) / 1000L);
|| actInt.intValue() == WSConstants.ST_UNSIGNED) { Instant created = Instant.now(); Instant expires = created.plusSeconds(WSS4JUtils.getSecurityTokenLifetime(message) / 1000L);
|| actInt.intValue() == WSConstants.ST_UNSIGNED) { Instant created = Instant.now(); Instant expires = created.plusSeconds(WSS4JUtils.getSecurityTokenLifetime(message) / 1000L);
Instant expires = created.plusSeconds(WSS4JUtils.getSecurityTokenLifetime(message) / 1000L); SecurityToken secToken = new SecurityToken(id, utBuilder.getUsernameTokenElement(),
Instant expires = created.plusSeconds(WSS4JUtils.getSecurityTokenLifetime(message) / 1000L); SecurityToken secToken = new SecurityToken(id, utBuilder.getUsernameTokenElement(),
long ttl = WSS4JUtils.getSecurityTokenLifetime(exchange.getOutMessage()); String tokenType = null; Element el = DOMUtils.getFirstElement(requestEl);
created.plusSeconds(WSS4JUtils.getSecurityTokenLifetime(exchange.getOutMessage()) / 1000L);
Instant expires = created.plusSeconds(WSS4JUtils.getSecurityTokenLifetime(message) / 1000L); SecurityToken tempTok = new SecurityToken(id, usernameToken.getUsernameTokenElement(),
Instant expires = created.plusSeconds(WSS4JUtils.getSecurityTokenLifetime(message) / 1000L); SecurityToken tempTok = new SecurityToken(id, usernameToken.getUsernameTokenElement(),