Examples of Crypto


Examples of com.braintreegateway.util.Crypto

        return Base64.encodeBase64String(payload.getBytes()).trim();
    }

    private String publicKeySignaturePair(String stringToSign) {
        return String.format("%s|%s", configuration.publicKey, new Crypto().hmacHash(configuration.privateKey, stringToSign));
    }
View Full Code Here

Examples of erki.talk.Crypto

                            keyExchange = new DHKeyExchange();
                            String publicKey = keyExchange.getPublicKey(pubKey);
                            sendEncrypt(this, publicKey);
                            Logger.info(this, getNick() + " initiated an "
                                    + "encrypted connection.");
                            crypto = new Crypto(keyExchange.getSecretKey());
                            encrypt = true;
                            sendEncryptInfo(this);
                        } else if (line.toUpperCase().equals("ENCRYPT")) {
                            sendError("You have to provide your public key "
                                    + "as argument!", this);
View Full Code Here

Examples of fr.jayasoft.crypto.Crypto

    private static org.apache.log4j.Logger LOGGER = LoggingManager.getLogger(DecoderFactory.class.getName());
   
    public static Decoder getDecoder(String dir, String keyFile) {
        String cryptoAlgo = System.getProperty("crypto.algo", CryptoFactory.DES);
        byte[] keyBytes = readKey(dir, keyFile);
        Crypto cr = CryptoFactory.get(cryptoAlgo);
        Object key = cr.getKeyGenerator().getDecodingKey(keyBytes);
       
        if (key==null) {
            LOGGER.warn("creation of a " + cryptoAlgo + " decoder has failed");
            return null;
        }
        LOGGER.info("Decoder built from key in file: " + keyFile);
        return cr.newDecoder(key);
    }
View Full Code Here

Examples of ninja.utils.Crypto

                .thenReturn("secret");

        when(ninjaProperties.getOrDie(NinjaConstant.applicationCookiePrefix))
                .thenReturn("NINJA");

        crypto = new Crypto(ninjaProperties);

    }
View Full Code Here

Examples of org.apache.uima.ducc.common.crypto.Crypto

        if(runmode != null) {
          if(runmode.equals("Test")) {
            userHome = System.getProperty("user.home");
          }
        }
        Crypto crypto = new Crypto(user,userHome,AccessType.READER);
        logger.debug(methodName, null, "readable:"+crypto.isReadablePublic()+" "+"public:"+crypto.getPublic());
        String signature = (String)crypto.decrypt((byte[])properties.get(SpecificationProperties.key_signature));
        if(user.equals(signature)) {
          logger.debug(methodName, null, "user:"+user+" signature:"+signature+" valid:y");
          retVal = true;
        }
        else {
View Full Code Here

Examples of org.apache.ws.security.components.crypto.Crypto

            } else {
                try {
                    WSSecEncrypt encr = new WSSecEncrypt(wssConfig);
                   
                    encr.setDocument(saaj.getSOAPPart());
                    Crypto crypto = getEncryptionCrypto(recToken);
                   
                    SecurityToken securityToken = getSecurityToken();
                    setKeyIdentifierType(encr, recToken, encrToken);
                    //
                    // Using a stored cert is only suitable for the Issued Token case, where
View Full Code Here

Examples of org.apache.ws.security.components.crypto.Crypto

                sig.setKeyIdentifierType(WSConstants.CUSTOM_KEY_IDENTIFIER);
            } else {
                sig.setCustomTokenValueType(tokenType);
            }
        }
        Crypto crypto = null;
        if (secTok.getSecret() == null) {
            sig.setX509Certificate(secTok.getX509Certificate());

            crypto = secTok.getCrypto();
            if (crypto == null) {
                crypto = getSignatureCrypto(wrapper);
            }
            String uname = crypto.getX509Identifier(secTok.getX509Certificate());
            if (uname == null) {
                String userNameKey = SecurityConstants.SIGNATURE_USERNAME;
                uname = (String)message.getContextualProperty(userNameKey);
            }
            String password = getPassword(uname, token, WSPasswordCallback.SIGNATURE);
View Full Code Here

Examples of org.apache.ws.security.components.crypto.Crypto

                        sig.setCustomTokenValueType(WSConstants.WSS_SAML_KI_VALUE_TYPE);
                    }
                    sig.setSignatureAlgorithm(binding.getAlgorithmSuite().getAsymmetricSignature());
                    sig.setSigCanonicalization(binding.getAlgorithmSuite().getInclusiveC14n());
                   
                    Crypto crypto = secToken.getCrypto();
                    String uname = null;
                    try {
                        uname = crypto.getX509Identifier(secToken.getX509Certificate());
                    } catch (WSSecurityException e1) {
                        LOG.log(Level.FINE, e1.getMessage(), e1);
                        throw new Fault(e1);
                    }
View Full Code Here

Examples of org.apache.ws.security.components.crypto.Crypto

        boolean selfSignAssertion =
            MessageUtils.getContextualBoolean(
                message, SecurityConstants.SELF_SIGN_SAML_ASSERTION, false
            );
        if (selfSignAssertion) {
            Crypto crypto = getSignatureCrypto(null);
           
            String userNameKey = SecurityConstants.SIGNATURE_USERNAME;
            String user = (String)message.getContextualProperty(userNameKey);
            if (crypto != null && StringUtils.isEmpty(user)) {
                try {
                    user = crypto.getDefaultX509Identifier();
                } catch (WSSecurityException e1) {
                    throw new Fault(e1);
                }
            }
            if (StringUtils.isEmpty(user)) {
View Full Code Here

Examples of org.apache.ws.security.components.crypto.Crypto

    }
   
    protected WSSecEncryptedKey getEncryptedKeyBuilder(TokenWrapper wrapper,
                                                       Token token) throws WSSecurityException {
        WSSecEncryptedKey encrKey = new WSSecEncryptedKey(wssConfig);
        Crypto crypto = getEncryptionCrypto(wrapper);
        message.getExchange().put(SecurityConstants.ENCRYPT_CRYPTO, crypto);
        setKeyIdentifierType(encrKey, wrapper, token);
        boolean alsoIncludeToken = false;
        // Find out do we also need to include the token as per the Inclusion requirement
        if (token instanceof X509Token
            && token.getInclusion() != SPConstants.IncludeTokenType.INCLUDE_TOKEN_NEVER
            && encrKey.getKeyIdentifierType() != WSConstants.BST_DIRECT_REFERENCE) {
            alsoIncludeToken = true;
        }
       
        String encrUser = setEncryptionUser(encrKey, wrapper, false, crypto);
       
        encrKey.setSymmetricEncAlgorithm(binding.getAlgorithmSuite().getEncryption());
        encrKey.setKeyEncAlgo(binding.getAlgorithmSuite().getAsymmetricKeyWrap());
       
        encrKey.prepare(saaj.getSOAPPart(), crypto);
       
        if (alsoIncludeToken) {
            CryptoType cryptoType = new CryptoType(CryptoType.TYPE.ALIAS);
            cryptoType.setAlias(encrUser);
            X509Certificate[] certs = crypto.getX509Certificates(cryptoType);
            BinarySecurity bstToken = new X509Security(saaj.getSOAPPart());
            ((X509Security) bstToken).setX509Certificate(certs[0]);
            bstToken.addWSUNamespace();
            bstToken.setID(wssConfig.getIdAllocator().createSecureId("X509-", certs[0]));
            WSSecurityUtil.prependChildElement(
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.