Examples of PublicKey


Examples of java.security.PublicKey

                    // 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());
View Full Code Here

Examples of java.security.PublicKey

    signFile.close();
      } else if(args[0].equals("--verify") && args.length==3) {
    CryptoLib cl = new CryptoLib();
    CharBuffer pubKeyBuffer = new CharBuffer(new File(args[1]));
    byte[] pubKeyByteBuffer = Base64Order.standardCoder.decode(pubKeyBuffer.toString().trim());
    PublicKey pubKey = cl.getPublicKeyFromBytes(pubKeyByteBuffer);

    FileInputStream dataStream = new FileInputStream(args[2]);

    CharBuffer signBuffer = new CharBuffer(new File(args[2] + ".sig"));
    byte[] signByteBuffer = Base64Order.standardCoder.decode(signBuffer.toString().trim());
View Full Code Here

Examples of java.security.PublicKey

    protected void verify(String host, SSLSession session) throws Exception {

        X509Certificate[] chain;
        X509Certificate   certificate;
        Principal         principal;
        PublicKey         publicKey;
        String            DN;
        String            CN;
        int               start;
        int               end;
        String            emsg;
View Full Code Here

Examples of java.security.PublicKey

       
        try {
           
       
            PrivateKey privKey = SOSKeyGenerator.getPrivateKeyFromFile(privateKeyFileName);
            PublicKey pubKey   = SOSKeyGenerator.getPublicKeyFromFile(publicKeyFileName);
           
           
            SOSCertificate.setHashAlgorithm(SOSCertificate.SHA1);
            //SOSCertificate.setHashAlgorithm(SOSCertificate.MD2);
            //SOSCertificate.setHashAlgorithm(SOSCertificate.MD5);
View Full Code Here

Examples of java.security.PublicKey

        if (SOSKeyGenerator.provider == null) { throw new Exception("Provider is null"); }
        if (SOSKeyGenerator.keyAlgorithmName == null) { throw new Exception(
                "keyAlgorithmName is null"); }
        if (keyFile == null) { throw new Exception("Private Key File is null"); }

        PublicKey pubKey = null;

        try {
            if (SOSKeyGenerator.provider.equalsIgnoreCase("BC")
                    && Security.getProvider("BC") == null) {
                Provider bp = new org.bouncycastle.jce.provider.BouncyCastleProvider();
View Full Code Here

Examples of java.security.PublicKey

            //Signatur Datei erstellen
            SOSSignature.signToFile(fileToSign, signFile, privKey);

            // Signatur verifizieren
            PublicKey pubKey = SOSKeyGenerator
                    .getPublicKeyFromFile(publicKeyFileName);
            boolean verifies = SOSSignature.verify(fileToSign, signFile, pubKey);

            System.out.println("Signature verifies: " + verifies);
View Full Code Here

Examples of java.security.PublicKey

  protected static byte[] getSharedSecret(byte[] otherPublicKeyBytes, KeyAgreement agreement) {
    BigInteger otherPublicKeyInt = new BigInteger(1, otherPublicKeyBytes);
    try {
      KeyFactory keyFactory = KeyFactory.getInstance("DH");
      KeySpec otherPublicKeySpec = new DHPublicKeySpec(otherPublicKeyInt, RTMPHandshake.DH_MODULUS, RTMPHandshake.DH_BASE);
      PublicKey otherPublicKey = keyFactory.generatePublic(otherPublicKeySpec);
      agreement.doPhase(otherPublicKey, true);
    } catch (Exception e) {
      JFLog.log("Exception getting the shared secret", e);
    }
    byte[] sharedSecret = agreement.generateSecret();
View Full Code Here

Examples of java.security.PublicKey

       
        // Set up the Key
        KeyPairGenerator rsaKeygen = KeyPairGenerator.getInstance("RSA");
        KeyPair kp = rsaKeygen.generateKeyPair();
        PrivateKey priv = kp.getPrivate();
        PublicKey pub = kp.getPublic();

        // Generate a traffic key
        KeyGenerator keygen = KeyGenerator.getInstance("AES");
        keygen.init(256);
        SecretKey secretKey = keygen.generateKey();
View Full Code Here

Examples of java.security.PublicKey

       
        // Set up the Key
        KeyPairGenerator rsaKeygen = KeyPairGenerator.getInstance("RSA");
        KeyPair kp = rsaKeygen.generateKeyPair();
        PrivateKey priv = kp.getPrivate();
        PublicKey pub = kp.getPublic();

        // Generate a traffic key
        KeyGenerator keygen = KeyGenerator.getInstance("AES");
        keygen.init(256);
        SecretKey secretKey = keygen.generateKey();
View Full Code Here

Examples of java.security.PublicKey

        // Set up the Key
        KeyPairGenerator rsaKeygen = KeyPairGenerator.getInstance("RSA");
        KeyPair kp = rsaKeygen.generateKeyPair();
        PrivateKey priv = kp.getPrivate();
        PublicKey pub = kp.getPublic();

        // Generate a traffic key
        KeyGenerator keygen = KeyGenerator.getInstance("AES");
        keygen.init(256);
        SecretKey secretKey = keygen.generateKey();
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.