Examples of AsymmetricKeyParameter


Examples of org.bouncycastle.crypto.params.AsymmetricKeyParameter

    public void init(
        boolean             forEncryption,
        CipherParameters    param)
    {
        AsymmetricKeyParameter  kParam;

        if (param instanceof ParametersWithRandom)
        {
            ParametersWithRandom    rParam = (ParametersWithRandom)param;

            this.random = rParam.getRandom();
            kParam = (AsymmetricKeyParameter)rParam.getParameters();
        }
        else
        {
            this.random = new SecureRandom();
            kParam = (AsymmetricKeyParameter)param;
        }

        engine.init(forEncryption, param);

        this.forPrivateKey = kParam.isPrivate();
        this.forEncryption = forEncryption;
    }
View Full Code Here

Examples of org.bouncycastle.crypto.params.AsymmetricKeyParameter

    private SecureRandom            random;

    public void init(
        CipherParameters    param)
    {
        AsymmetricKeyParameter  kParam;

        if (param instanceof ParametersWithRandom)
        {
            ParametersWithRandom    rParam = (ParametersWithRandom)param;
View Full Code Here

Examples of org.bouncycastle.crypto.params.AsymmetricKeyParameter

    private SecureRandom            random;

    public void init(
        CipherParameters    param)
    {
        AsymmetricKeyParameter  kParam;

        if (param instanceof ParametersWithRandom)
        {
            ParametersWithRandom    rParam = (ParametersWithRandom)param;
View Full Code Here

Examples of org.bouncycastle.crypto.params.AsymmetricKeyParameter

    public void init(
        boolean             forEncryption,
        CipherParameters    param)
    {
        AsymmetricKeyParameter  kParam;

        if (param instanceof ParametersWithRandom)
        {
            ParametersWithRandom  rParam = (ParametersWithRandom)param;
View Full Code Here

Examples of org.bouncycastle.crypto.params.AsymmetricKeyParameter

      +" Algorithm identifier: " + algorithmIdentifier
      +" Issuer: " + issuerNm
      +" Optional validity: " + optionalValidity
      +" Subject: " + subject);

      AsymmetricKeyParameter keyParam = PublicKeyFactory.createKey(subjectPublicKeyInfo);
     
      // TODO: handle other types of keys.
      if (keyParam instanceof RSAKeyParameters) {
        RSAKeyParameters rsaKeyParam = (RSAKeyParameters) keyParam;
        DefaultCertificate cert = new DefaultCertificate(this);
        cert.setDefaultSerialisation(new DERSerialisation(cert));
        cert.setSubjectPublicKey(new DefaultRSAPubKey(rsaKeyParam.getExponent(),rsaKeyParam.getModulus()));
        return cert;
      } else {
                log.warn("KeyParam is not an RSA Key but of type"+keyParam.getClass()+" need to implement this.");
            }
//          A lot of potentially useful code developed by Bruno, that shows one one
//          could use the extra fields in the CRMF structure.
//      But use cases need to be found, and it really is not clear that any of this
//      cannot be better done by passing the values in a form.
View Full Code Here

Examples of org.bouncycastle.crypto.params.AsymmetricKeyParameter

        boolean           forSigning,
        CipherParameters   parameters)
    {
        this.forSigning = forSigning;

        AsymmetricKeyParameter k;

        if (parameters instanceof ParametersWithRandom)
        {
            k = (AsymmetricKeyParameter)((ParametersWithRandom)parameters).getParameters();
        }
        else
        {
            k = (AsymmetricKeyParameter)parameters;
        }

        if (forSigning && !k.isPrivate())
        {
            throw new IllegalArgumentException("Signing Requires Private Key.");
        }

        if (!forSigning && k.isPrivate())
        {
            throw new IllegalArgumentException("Verification Requires Public Key.");
        }

        reset();
View Full Code Here

Examples of org.bouncycastle.crypto.params.AsymmetricKeyParameter

    public void init(
        boolean             forEncryption,
        CipherParameters    param)
    {
        AsymmetricKeyParameter  kParam;

        if (param instanceof ParametersWithRandom)
        {
            ParametersWithRandom    rParam = (ParametersWithRandom)param;

            this.random = rParam.getRandom();
            kParam = (AsymmetricKeyParameter)rParam.getParameters();
        }
        else
        {
            this.random = new SecureRandom();
            kParam = (AsymmetricKeyParameter)param;
        }

        engine.init(forEncryption, kParam);

        this.forPrivateKey = kParam.isPrivate();
        this.forEncryption = forEncryption;
    }
View Full Code Here

Examples of org.bouncycastle.crypto.params.AsymmetricKeyParameter

    public void init(
        boolean             forEncryption,
        CipherParameters    param)
    {
        AsymmetricKeyParameter  kParam;

        if (param instanceof ParametersWithRandom)
        {
            ParametersWithRandom  rParam = (ParametersWithRandom)param;
View Full Code Here

Examples of org.bouncycastle.crypto.params.AsymmetricKeyParameter

    {
        try
        {
            AsymmetricBlockCipher c = BcImplProvider.createPublicKeyCipher(pubKey.getAlgorithm());

            AsymmetricKeyParameter key = keyConverter.getPublicKey(pubKey);

            if (random == null)
            {
                random = new SecureRandom();
            }
View Full Code Here

Examples of org.bouncycastle.crypto.params.AsymmetricKeyParameter

    {
        try
        {
            AsymmetricBlockCipher c = BcImplProvider.createPublicKeyCipher(keyAlgorithm);

            AsymmetricKeyParameter key = keyConverter.getPrivateKey(privKey);

            BufferedAsymmetricBlockCipher c1 = new BufferedAsymmetricBlockCipher(c);

            c1.init(false, key);
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.