Skip to content

Commit b1ee234

Browse files
committed
added support for RFC 6211
added isDeteched/isCertificate
1 parent d0a6056 commit b1ee234

4 files changed

Lines changed: 13 additions & 13 deletions

File tree

core/src/main/java/org/bouncycastle/crypto/util/KTSMacData.java renamed to core/src/main/java/org/bouncycastle/crypto/util/DERMacData.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* Builder and holder class for preparing SP 800-56A compliant MacData. Elements in the data are encoded
1010
* as DER objects with empty octet strings used to represent nulls in compulsory fields.
1111
*/
12-
public final class KTSMacData
12+
public final class DERMacData
1313
{
1414
public enum Type
1515
{
@@ -75,18 +75,18 @@ public Builder withText(byte[] text)
7575
return this;
7676
}
7777

78-
public KTSMacData build()
78+
public DERMacData build()
7979
{
8080
switch (type)
8181
{
8282
case UNILATERALU:
8383
case BILATERALU:
84-
return new KTSMacData(concatenate(type.getHeader(),
84+
return new DERMacData(concatenate(type.getHeader(),
8585
DerUtil.toByteArray(idU), DerUtil.toByteArray(idV),
8686
DerUtil.toByteArray(ephemDataU), DerUtil.toByteArray(ephemDataV), text));
8787
case UNILATERALV:
8888
case BILATERALV:
89-
return new KTSMacData(concatenate(type.getHeader(),
89+
return new DERMacData(concatenate(type.getHeader(),
9090
DerUtil.toByteArray(idV), DerUtil.toByteArray(idU),
9191
DerUtil.toByteArray(ephemDataV), DerUtil.toByteArray(ephemDataU), text));
9292
}
@@ -102,7 +102,7 @@ private byte[] concatenate(byte[] header, byte[] id1, byte[] id2, byte[] ed1, by
102102

103103
private final byte[] macData;
104104

105-
private KTSMacData(byte[] macData)
105+
private DERMacData(byte[] macData)
106106
{
107107
this.macData = macData;
108108
}

core/src/main/java/org/bouncycastle/crypto/util/KTSOtherInfo.java renamed to core/src/main/java/org/bouncycastle/crypto/util/DEROtherInfo.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* Builder and holder class for preparing SP 800-56A compliant OtherInfo. The data is ultimately encoded as a DER SEQUENCE.
1414
* Empty octet strings are used to represent nulls in compulsory fields.
1515
*/
16-
public class KTSOtherInfo
16+
public class DEROtherInfo
1717
{
1818
/**
1919
* Builder to create OtherInfo
@@ -72,7 +72,7 @@ public Builder withSuppPrivInfo(byte[] suppPrivInfo)
7272
*
7373
* @return an KTSOtherInfo containing the data.
7474
*/
75-
public KTSOtherInfo build()
75+
public DEROtherInfo build()
7676
{
7777
ASN1EncodableVector v = new ASN1EncodableVector();
7878

@@ -90,13 +90,13 @@ public KTSOtherInfo build()
9090
v.add(suppPrivInfo);
9191
}
9292

93-
return new KTSOtherInfo(new DERSequence(v));
93+
return new DEROtherInfo(new DERSequence(v));
9494
}
9595
}
9696

9797
private final DERSequence sequence;
9898

99-
private KTSOtherInfo(DERSequence sequence)
99+
private DEROtherInfo(DERSequence sequence)
100100
{
101101
this.sequence = sequence;
102102
}

pkix/src/main/java/org/bouncycastle/operator/jcajce/JceKTSKeyUnwrapper.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
import org.bouncycastle.asn1.cms.GenericHybridParameters;
1212
import org.bouncycastle.asn1.cms.RsaKemParameters;
1313
import org.bouncycastle.asn1.x509.AlgorithmIdentifier;
14-
import org.bouncycastle.crypto.util.KTSOtherInfo;
14+
import org.bouncycastle.crypto.util.DEROtherInfo;
1515
import org.bouncycastle.jcajce.spec.KTSParameterSpec;
1616
import org.bouncycastle.jcajce.util.DefaultJcaJceHelper;
1717
import org.bouncycastle.jcajce.util.NamedJcaJceHelper;
@@ -65,7 +65,7 @@ public GenericKey generateUnwrappedKey(AlgorithmIdentifier encryptedKeyAlgorithm
6565

6666
try
6767
{
68-
KTSOtherInfo otherInfo = new KTSOtherInfo.Builder(params.getDem(), partyUInfo, partyVInfo).build();
68+
DEROtherInfo otherInfo = new DEROtherInfo.Builder(params.getDem(), partyUInfo, partyVInfo).build();
6969
KTSParameterSpec ktsSpec = new KTSParameterSpec.Builder(symmetricWrappingAlg, keySizeInBits, otherInfo.getEncoded()).withKdfAlgorithm(kemParameters.getKeyDerivationFunction()).build();
7070

7171
keyCipher.init(Cipher.UNWRAP_MODE, privKey, ktsSpec);

pkix/src/main/java/org/bouncycastle/operator/jcajce/JceKTSKeyWrapper.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
import org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers;
1616
import org.bouncycastle.asn1.x509.AlgorithmIdentifier;
1717
import org.bouncycastle.asn1.x9.X9ObjectIdentifiers;
18-
import org.bouncycastle.crypto.util.KTSOtherInfo;
18+
import org.bouncycastle.crypto.util.DEROtherInfo;
1919
import org.bouncycastle.jcajce.spec.KTSParameterSpec;
2020
import org.bouncycastle.jcajce.util.DefaultJcaJceHelper;
2121
import org.bouncycastle.jcajce.util.NamedJcaJceHelper;
@@ -81,7 +81,7 @@ public byte[] generateWrappedKey(GenericKey encryptionKey)
8181

8282
try
8383
{
84-
KTSOtherInfo otherInfo = new KTSOtherInfo.Builder(JceSymmetricKeyWrapper.determineKeyEncAlg(symmetricWrappingAlg, keySizeInBits), partyUInfo, partyVInfo).build();
84+
DEROtherInfo otherInfo = new DEROtherInfo.Builder(JceSymmetricKeyWrapper.determineKeyEncAlg(symmetricWrappingAlg, keySizeInBits), partyUInfo, partyVInfo).build();
8585
KTSParameterSpec ktsSpec = new KTSParameterSpec.Builder(symmetricWrappingAlg, keySizeInBits, otherInfo.getEncoded()).build();
8686

8787
keyEncryptionCipher.init(Cipher.WRAP_MODE, publicKey, ktsSpec, random);

0 commit comments

Comments
 (0)