Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue #127 #143

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,12 @@ public final class RSA extends Algorithm implements KeyAgreement, Signature, Pub
}

public RSA(@NotNull DetectionLocation detectionLocation) {
super(NAME, PublicKeyEncryption.class, detectionLocation);
this.put(new Oid(OID, detectionLocation));
this(PublicKeyEncryption.class, detectionLocation);
}

public RSA(int keyLength, @Nonnull DetectionLocation detectionLocation) {
super(NAME, PublicKeyEncryption.class, detectionLocation);
this(detectionLocation);
this.put(new KeyLength(keyLength, detectionLocation));
this.put(new Oid(OID, detectionLocation));
}

public RSA(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* SonarQube Cryptography Plugin
* Copyright (C) 2024 IBM
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to you under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.ibm.mapper.mapper.issues;

import static org.assertj.core.api.Assertions.assertThat;

import com.ibm.mapper.model.INode;
import com.ibm.mapper.model.algorithms.RSA;
import com.ibm.mapper.utils.DetectionLocation;
import java.util.List;
import org.junit.Test;

public class Issue127Test {

@Test
public void test() {
final RSA rsa =
new RSA(2048, new DetectionLocation("test.java", 1, 1, List.of(), () -> "Test"));
final INode rsaCopy = rsa.deepCopy();
assertThat(rsaCopy).isInstanceOf(RSA.class);
}
}
Loading