Package java.security

Examples of java.security.PrivateKey


                                     new BigInteger(RSA_PRIME2, 16),
                                     new BigInteger(RSA_EXPONENT1, 16),
                                     new BigInteger(RSA_EXPONENT2, 16),
                                     new BigInteger(RSA_COEFFICIENT, 16));

        PrivateKey pk = KeyFactory.getInstance("RSA").generatePrivate(k);
        KeyStore ks = KeyStore.getInstance("JKS");
        ks.load(null, null);

        CertificateFactory cf = CertificateFactory.getInstance("X.509");
        InputStream in1, in2, in3;
View Full Code Here


                encryptedKeyTransportMethod
            );
        }
       
        try {
            PrivateKey privateKey = data.getDecCrypto().getPrivateKey(certs[0], data.getCallbackHandler());
            OAEPParameterSpec oaepParameterSpec = null;
            if (WSConstants.KEYTRANSPORT_RSAOEP.equals(encryptedKeyTransportMethod)
                    || WSConstants.KEYTRANSPORT_RSAOEP_XENC11.equals(encryptedKeyTransportMethod)) {
                // Get the DigestMethod if it exists
                String digestAlgorithm = getDigestAlgorithm(elem);
View Full Code Here

    @Override
    protected final void handleAliasPrivKeyCertRequest(SignatureKeyCallback callback,
                                                       SignatureKeyCallback.AliasPrivKeyCertRequest request)
            throws IOException {
        PrivateKey privateKey = getPrivateKey(request.getAlias());
        X509Certificate certificate = getCertificate(request.getAlias());
        request.setPrivateKey(privateKey);
        request.setX509Certificate(certificate);
    }
View Full Code Here

    @Override
    protected final void handleDefaultPrivKeyCertRequest(SignatureKeyCallback callback,
                                                         SignatureKeyCallback.DefaultPrivKeyCertRequest request)
            throws IOException {
        PrivateKey privateKey = getPrivateKey(defaultAlias);
        X509Certificate certificate = getCertificate(defaultAlias);
        request.setPrivateKey(privateKey);
        request.setX509Certificate(certificate);
    }
View Full Code Here

    @Override
    protected final void handlePublicKeyBasedPrivKeyCertRequest(SignatureKeyCallback callback,
                                                                SignatureKeyCallback.PublicKeyBasedPrivKeyCertRequest request)
            throws IOException {
        PrivateKey privateKey = getPrivateKey(request.getPublicKey());
        X509Certificate certificate = getCertificate(request.getPublicKey());
        request.setPrivateKey(privateKey);
        request.setX509Certificate(certificate);
    }
View Full Code Here

    //
    @Override
    protected final void handlePublicKeyBasedPrivKeyRequest(DecryptionKeyCallback callback,
                                                            DecryptionKeyCallback.PublicKeyBasedPrivKeyRequest request)
            throws IOException {
        PrivateKey key = getPrivateKey(request.getPublicKey());
        request.setPrivateKey(key);
    }
View Full Code Here

    @Override
    protected final void handleX509CertificateBasedRequest(DecryptionKeyCallback callback,
                                                           DecryptionKeyCallback.X509CertificateBasedRequest request)
            throws IOException {
        PrivateKey privKey = getPrivateKey(request.getX509Certificate());
        request.setPrivateKey(privKey);
    }
View Full Code Here

    @Override
    protected final void handleX509IssuerSerialBasedRequest(DecryptionKeyCallback callback,
                                                            DecryptionKeyCallback.X509IssuerSerialBasedRequest request)
            throws IOException {
        PrivateKey key = getPrivateKey(request.getIssuerName(), request.getSerialNumber());
        request.setPrivateKey(key);
    }
View Full Code Here

    @Override
    protected final void handleX509SubjectKeyIdentifierBasedRequest(DecryptionKeyCallback callback,
                                                                    DecryptionKeyCallback.X509SubjectKeyIdentifierBasedRequest request)
            throws IOException {
        PrivateKey key = getPrivateKey(request.getSubjectKeyIdentifier());
        request.setPrivateKey(key);
    }
View Full Code Here

                deflaterStream.finish();

                byte[] deflatedMsg = baos.toByteArray();
                String base64EncodedResponse = Base64.encodeBytes(deflatedMsg, Base64.DONT_BREAK_LINES);

                PrivateKey privateKey = null;
                if (signMessage) {
                    privateKey = samlEntityBean.get().getSigningKey().getPrivateKey();
                }
                sendSamlRedirect(base64EncodedResponse, signMessage, samlRequestOrResponse, privateKey, endpoint, response);
            } else {
                if (signMessage) {
                    PublicKey publicKey = samlEntityBean.get().getSigningKey().getCertificate().getPublicKey();
                    PrivateKey privateKey = samlEntityBean.get().getSigningKey().getPrivateKey();
                    signatureUtilForPostBinding.sign(message, new KeyPair(publicKey, privateKey));
                }
                byte[] messageBytes = SamlUtils.getDocumentAsString(message).getBytes("UTF-8");

                String base64EncodedMessage = Base64.encodeBytes(messageBytes, Base64.DONT_BREAK_LINES);
View Full Code Here

TOP

Related Classes of java.security.PrivateKey

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.