Package de.anomic.tools

Examples of de.anomic.tools.CryptoLib


    public boolean checkSignature() {
        if(this.releaseFile != null) {
            try {
                final CharBuffer signBuffer = new CharBuffer(getSignatureFile());
                final byte[] signByteBuffer = Base64Order.standardCoder.decode(signBuffer.toString().trim());
                final CryptoLib cl = new CryptoLib();
                for(final yacyUpdateLocation updateLocation : latestReleaseLocations) {
                    try {
                        if(cl.verifySignature(updateLocation.getPublicKey(),
                            new FileInputStream(this.releaseFile), signByteBuffer)) {
                            return true;
                        }
                    } catch (final InvalidKeyException e) {
                    } catch (final SignatureException e) {
View Full Code Here


        initProps = FileUtils.table(netDefReader);
        setConfig(initProps);

        // set release locations
        int i = 0;
        CryptoLib cryptoLib;
        try {
            cryptoLib = new CryptoLib();
            while (true) {
                final String location = getConfig("network.unit.update.location" + i, "");
                if (location.isEmpty()) {
                    break;
                }
                DigestURI locationURL;
                try {
                    // try to parse url
                    locationURL = new DigestURI(location);
                } catch (final MalformedURLException e) {
                    break;
                }
                PublicKey publicKey = null;
                // get public key if it's in config
                try {
                    final String publicKeyString = getConfig("network.unit.update.location" + i + ".key", null);
                    if (publicKeyString != null) {
                        final byte[] publicKeyBytes = Base64Order.standardCoder.decode(publicKeyString.trim());
                        publicKey = cryptoLib.getPublicKeyFromBytes(publicKeyBytes);
                    }
                } catch (final InvalidKeySpecException e) {
                    Log.logException(e);
                }
                final yacyUpdateLocation updateLocation = new yacyUpdateLocation(locationURL, publicKey);
View Full Code Here

    public boolean checkSignature() {
        if(this.releaseFile != null) {
            try {
                final CharBuffer signBuffer = new CharBuffer(getSignatureFile());
                final byte[] signByteBuffer = Base64Order.standardCoder.decode(signBuffer.toString().trim());
                final CryptoLib cl = new CryptoLib();
                for(final yacyUpdateLocation updateLocation : latestReleaseLocations) {
                    try {
                        if(cl.verifySignature(updateLocation.getPublicKey(),
                            new FileInputStream(this.releaseFile), signByteBuffer)) {
                            return true;
                        }
                    } catch (final InvalidKeyException e) {
                    } catch (final SignatureException e) {
View Full Code Here

        initProps = FileUtils.table(netDefReader);
        setConfig(initProps);

        // set release locations
        int i = 0;
        CryptoLib cryptoLib;
        try {
            cryptoLib = new CryptoLib();
            while (true) {
                final String location = getConfig("network.unit.update.location" + i, "");
                if (location.isEmpty()) {
                    break;
                }
                DigestURI locationURL;
                try {
                    // try to parse url
                    locationURL = new DigestURI(location);
                } catch (final MalformedURLException e) {
                    break;
                }
                PublicKey publicKey = null;
                // get public key if it's in config
                try {
                    final String publicKeyString = getConfig("network.unit.update.location" + i + ".key", null);
                    if (publicKeyString != null) {
                        final byte[] publicKeyBytes = Base64Order.standardCoder.decode(publicKeyString.trim());
                        publicKey = cryptoLib.getPublicKeyFromBytes(publicKeyBytes);
                    }
                } catch (final InvalidKeySpecException e) {
                    Log.logException(e);
                }
                final yacyUpdateLocation updateLocation = new yacyUpdateLocation(locationURL, publicKey);
View Full Code Here

TOP

Related Classes of de.anomic.tools.CryptoLib

Copyright © 2018 www.massapicom. 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.