/** * Construct a new instance. * * @param keyPair the key pair (may not be {@code null}) */ public KeyPairCredential(final KeyPair keyPair) { Assert.checkNotNullParam("keyPair", keyPair); final PublicKey publicKey = keyPair.getPublic(); if (publicKey == null) { throw ElytronMessages.log.publicKeyIsNull(); } final PrivateKey privateKey = keyPair.getPrivate(); if (privateKey == null) { throw ElytronMessages.log.privateKeyIsNull(); } if (! publicKey.getAlgorithm().equals(privateKey.getAlgorithm())) { throw ElytronMessages.log.mismatchedPublicPrivateKeyAlgorithms(); } if (! KeyUtil.hasSameParameters(publicKey, privateKey)) { throw ElytronMessages.log.mismatchedPublicPrivateKeyParameters(); } this.keyPair = keyPair; }
/** * Construct a new instance. * * @param keyPair the key pair (may not be {@code null}) */ public KeyPairCredential(final KeyPair keyPair) { Assert.checkNotNullParam("keyPair", keyPair); final PublicKey publicKey = keyPair.getPublic(); if (publicKey == null) { throw ElytronMessages.log.publicKeyIsNull(); } final PrivateKey privateKey = keyPair.getPrivate(); if (privateKey == null) { throw ElytronMessages.log.privateKeyIsNull(); } if (! publicKey.getAlgorithm().equals(privateKey.getAlgorithm())) { throw ElytronMessages.log.mismatchedPublicPrivateKeyAlgorithms(); } if (! KeyUtil.hasSameParameters(publicKey, privateKey)) { throw ElytronMessages.log.mismatchedPublicPrivateKeyParameters(); } this.keyPair = keyPair; }
/** * Construct a new instance. * * @param keyPair the key pair (may not be {@code null}) */ public KeyPairCredential(final KeyPair keyPair) { Assert.checkNotNullParam("keyPair", keyPair); final PublicKey publicKey = keyPair.getPublic(); if (publicKey == null) { throw ElytronMessages.log.publicKeyIsNull(); } final PrivateKey privateKey = keyPair.getPrivate(); if (privateKey == null) { throw ElytronMessages.log.privateKeyIsNull(); } if (! publicKey.getAlgorithm().equals(privateKey.getAlgorithm())) { throw ElytronMessages.log.mismatchedPublicPrivateKeyAlgorithms(); } if (! KeyUtil.hasSameParameters(publicKey, privateKey)) { throw ElytronMessages.log.mismatchedPublicPrivateKeyParameters(); } this.keyPair = keyPair; }
/** * Construct a new instance. * * @param keyPair the key pair (may not be {@code null}) */ public KeyPairCredential(final KeyPair keyPair) { Assert.checkNotNullParam("keyPair", keyPair); final PublicKey publicKey = keyPair.getPublic(); if (publicKey == null) { throw ElytronMessages.log.publicKeyIsNull(); } final PrivateKey privateKey = keyPair.getPrivate(); if (privateKey == null) { throw ElytronMessages.log.privateKeyIsNull(); } if (! publicKey.getAlgorithm().equals(privateKey.getAlgorithm())) { throw ElytronMessages.log.mismatchedPublicPrivateKeyAlgorithms(); } if (! KeyUtil.hasSameParameters(publicKey, privateKey)) { throw ElytronMessages.log.mismatchedPublicPrivateKeyParameters(); } this.keyPair = keyPair; }