File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 99import com .google .cose .exceptions .CoseException ;
1010import com .google .cose .utils .CborUtils ;
1111import com .google .cose .utils .Headers ;
12+ import java .math .BigInteger ;
1213import java .util .Arrays ;
1314
1415/**
@@ -41,6 +42,15 @@ public byte[] getPublicKeyBytes() {
4142 return Arrays .copyOf (publicKeyBytes , publicKeyBytes .length );
4243 }
4344
45+ public BigInteger getPublicKeyBytesAsBigInteger () {
46+ // Reverse the bytes to get the correct big-endian representation.
47+ byte [] reversedBytes = new byte [publicKeyBytes .length ];
48+ for (int i = 0 ; i < publicKeyBytes .length ; i ++) {
49+ reversedBytes [i ] = publicKeyBytes [publicKeyBytes .length - 1 - i ];
50+ }
51+ return new BigInteger (1 , reversedBytes );
52+ }
53+
4454 /** Recursive builder to build out the Ec2 key and its subclasses. */
4555 abstract static class Builder <T extends Builder <T >> extends CoseKey .Builder <T > {
4656 private Integer curve = null ;
You can’t perform that action at this time.
0 commit comments