forked from bcgit/bc-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BJA-600 added explicit support for Signature Target.
- Loading branch information
Showing
4 changed files
with
103 additions
and
1 deletion.
There are no files selected for viewing
44 changes: 44 additions & 0 deletions
44
pg/src/main/java/org/bouncycastle/bcpg/sig/SignatureTarget.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package org.bouncycastle.bcpg.sig; | ||
|
||
import org.bouncycastle.bcpg.SignatureSubpacket; | ||
import org.bouncycastle.bcpg.SignatureSubpacketTags; | ||
import org.bouncycastle.util.Arrays; | ||
|
||
/** | ||
* RFC 4880, Section 5.2.3.25 - Signature Target subpacket. | ||
*/ | ||
public class SignatureTarget | ||
extends SignatureSubpacket | ||
{ | ||
public SignatureTarget( | ||
boolean critical, | ||
boolean isLongLength, | ||
byte[] data) | ||
{ | ||
super(SignatureSubpacketTags.SIGNATURE_TARGET, critical, isLongLength, data); | ||
} | ||
|
||
public SignatureTarget( | ||
boolean critical, | ||
int publicKeyAlgorithm, | ||
int hashAlgorithm, | ||
byte[] hashData) | ||
{ | ||
super(SignatureSubpacketTags.SIGNATURE_TARGET, critical, false, Arrays.concatenate(new byte[] { (byte)publicKeyAlgorithm, (byte)hashAlgorithm }, hashData)); | ||
} | ||
|
||
public int getPublicKeyAlgorithm() | ||
{ | ||
return data[0] & 0xff; | ||
} | ||
|
||
public int getHashAlgorithm() | ||
{ | ||
return data[1] & 0xff; | ||
} | ||
|
||
public byte[] getHashData() | ||
{ | ||
return Arrays.copyOfRange(data, 2, data.length); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters