Skip to content

Commit

Permalink
RFC3211 KeyWrap
Browse files Browse the repository at this point in the history
Signed-off-by: Hugo Queinnec <[email protected]>
  • Loading branch information
hugoqnc committed Sep 18, 2024
1 parent af82b85 commit fe25014
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public Optional<? extends INode> parse(
private Optional<? extends INode> map(
@Nonnull String streamCipherString, @Nonnull DetectionLocation detectionLocation) {
return switch (streamCipherString) {
case "AESWrapEngine", "AESWrapPadEngine" ->
case "AESWrapEngine", "AESWrapPadEngine", "RFC3394WrapEngine", "RFC5649WrapEngine" ->
Optional.of(new AES(KeyWrap.class, detectionLocation));
case "ARIAWrapEngine", "ARIAWrapPadEngine" ->
Optional.of(new Aria(KeyWrap.class, new Aria(detectionLocation)));
Expand All @@ -71,12 +71,8 @@ private Optional<? extends INode> map(
Optional.of(new SEED(KeyWrap.class, new SEED(detectionLocation)));
case "DSTU7624WrapEngine" ->
Optional.of(new Kalyna(KeyWrap.class, new Kalyna(detectionLocation)));
/* case "RFC3211WrapEngine" ->
case "RFC3211WrapEngine" ->
Optional.of(new RC2(KeyWrap.class, new RC2(detectionLocation)));
case "RFC3394WrapEngine" ->
Optional.of(new RC2(KeyWrap.class, new RC2(detectionLocation)));
case "RFC5649WrapEngine" ->
Optional.of(new RC2(KeyWrap.class, new RC2(detectionLocation))); */
default -> {
final Algorithm algorithm =
new Algorithm(streamCipherString, BlockCipher.class, detectionLocation);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* 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.model.algorithms;

import com.ibm.mapper.model.Algorithm;
import com.ibm.mapper.model.KeyWrap;
import com.ibm.mapper.utils.DetectionLocation;
import javax.annotation.Nonnull;

public class RFC3211Wrap extends Algorithm implements KeyWrap {
// https://datatracker.ietf.org/doc/html/rfc3211#section-2.3.1

private static final String NAME = "RFC 3211";

public RFC3211Wrap(@Nonnull DetectionLocation detectionLocation) {
super(NAME, KeyWrap.class, detectionLocation);
}
}

0 comments on commit fe25014

Please sign in to comment.