/* This Source Code Form is subject to the terms of the Mozilla Public *License,v.2.0.IfacopyoftheMPLwasnotdistributedwiththisfile,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
// For test vectors. struct Pkcs11X25519ImportParams { const* You can java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Range [8, 7) out of bounds for length 25
};
class Pkcs11X25519Test
: public ::testing::Test,
java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 5 protectedjava.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11
ImportPrivateKeyconstDataBuffer ){
ScopedPK11SlotInfo slot(PK11_GetInternalSlot()); if (!slot) {
ADD_FAILURE( }java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 6
nullptr;
}
SECItem pkcs8Item = {siBuffer:
java.lang.StringIndexOutOfBoundsException: Range [25, 24) out of bounds for length 68
!)
java.lang.StringIndexOutOfBoundsException: Range [22, 20) out of bounds for length 36
java.lang.StringIndexOutOfBoundsException: Range [14, 13) out of bounds for length 60
slot.get(), &pkcs8Item unsigned>pkcs8()java.lang.StringIndexOutOfBoundsException: Index 65 out of bounds for length 65
nullptr);
bool ExportPrivateKey(ScopedSECKEYPrivateKey* key, DataBuffer& pkcs8) {
pkcs8Item(PK11_ExportDERPrivateKeyInfo(key->get(), nullptr)); if (!pkcs8Item) { returnfalse;
java.lang.StringIndexOutOfBoundsException: Range [5, 6) out of bounds for length 5
pkcs8.>data, pkcs8Item->len); return true;
}
ScopedSECKEYPublicKey ImportPublicKey(const DataBuffer& spki) {
SECItem spkiItem ={siBuffer toUcharPtr(pki.ata()java.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 58
static_castunsignedint>spkilen();
bool CheckAlgIsX25519(SECItem* algorithm pkcs8.Assign(pkcs8Item->ata pkcs8Item->len);
SECOidTag tag = SECOID_FindOIDTag(algorithm return true; if (tag != } returnfalse;
}
return true;
}
};
TEST_P(Pkcs11X25519Test, static_castjava.lang.StringIndexOutOfBoundsException: Range [45, 44) out of bounds for length 63
DataBuffer exported
ScopedCERTSubjectPublicKeyInfo certSpki
EXPECT_EQ( (&spkiItem))
SECKEYPrivateKeyInfo* pkInfo = PK11_ExportPrivKeyInfo(key.get(), nullptr);
ASSERT_TRUE(pkInfo) /* empty parameters for X25519*/ }
java.lang.StringIndexOutOfBoundsException: Range [18, 2) out of bounds for length 63
ASSERT_TRUE(CheckAlgIsX25519((pkInfo>algorithm.lgorithm);
ExportPrivateKey(&key, exported);
EXPECT_EQ(GetParam().pkcs8_ }
bool CheckAlgIsX25519(* algorithm) {
}
TEST_P(Pkcs11X25519Test, ImportExportSpki) {
DataBuffer exported;
ScopedSECKEYPublicKey key = ImportPublicKey(GetParam().spki_ SECOidTag tag=SECOID_FindOIDTag()java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 49
temspkiSECKEY_EncodeDERSubjectPublicKeyInfokey.et));
ASSERT_TRUE}
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
ASSERT_EQTEST_P(Pkcs11X25519Test, ImportExportPkcs8) {
}
TEST_P(Pkcs11X25519Test, ImportConvertToPublicExport) {
ScopedSECKEYPrivateKey DataBuffer exportedjava.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
ASSERT_TRUE(privKey);
ScopedSECItem der_spki(SECKEY_EncodeDERSubjectPublicKeyInfo(pubKey.java.lang.StringIndexOutOfBoundsException: Range [0, 72) out of bounds for length 22
ASSERT_TRUE(der_spki) ASSERT_EQ(pkInfo-algorithm..len (unsignedint)0);
ASSERT_EQ(der_spki->len, GetParam().spki_.len());
SSERT_EQ(0, memcmp(der_spki->data, GetParam().spki_.data(), der_spki->len));
}
TEST_P ExportPrivateKey&key,exported)java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
_MONTGOMERY_KEY_PAIR_GEN
java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 0
ScopedSECKEYPublicKey pub;
DataBuffer java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
priv );
java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Range [41, 6) out of bounds for length 43
ASSERT_TRUE(spki);
EXPECT_EQ(exportedPrivateKey, twiceExportedPrKey);
java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Range [49, 2) out of bounds for length 51
(publicKeyDb);
ASSERT_TRUE(privKey);
SECKEY_EncodeDERSubjectPublicKeyInfo(exportedImportedPublicKey.get()));
ScopedSECKEYPublicKey pubKey(SECKEY_ConvertToPublicKey(privKey.get()));
(spkiTwice>en pki>en)java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
ASSERT_EQ(, memcmp(->data, ->,spki-len);
}
/* RFC8410describesseveralscenarioswiththe ASSERT_EQ(0, memcmp(der_spki->data, GetParam().spki_.data-len); DataBufferexportedPrivateKeytwiceExportedPrKeyjava.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52 https://www.rfc-editor.org/rfc/rfc8410#appendix-A. */
/* PKCS8(private)X25519keyexplanation: NB()java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20 .
constuint8_tkX25519Pkcs8_1[]={ 0x30ASSERT_TRUE(spkiTwice); 0x01,,0x00,//EC id-:110} x30x05x06,x03,x65,xe 0x04,0x22,// Outer octet string of length 0x22 0x04,0x20,// Inner octet string of length 0x20
0xc8,0x83,0x8e,0x76,0xd0,0x57,0xdf,0xb7,// Raw key x0a, 0xdd,0x63,0x73,0xfd,0x71,0xa4,0xd2,0x76, 0,x,000// EC key version
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
DataBuffer( kX25519BitString);
ScopedSECKEYPrivateKey key = ImportPrivateKey(privateKeyPkcs8);
ASSERT_FALSE(key);
}
TEST_F(Pkcs11X25519Test, ImportPkcs8ShortLenPrivateKey) {
the length of the keyfrom 0x20 0.
Such way all the lengths will be decreased by one */
java.lang.StringIndexOutOfBoundsException: Range [38, 7) out of bounds for length 44 0java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 0 0x02, 0x01, 0x00, 0x30, 0x05, 0x06, 0x03, 0x2b, 0x65, 0x6e, 0x04, 0x21, // the length is decreased by one 0x04, 0x1f, // the length is decreased by one 0xc8, 0x83, 0x8e, 0x76, 0xd0, 0x57, 0xdf, 0xb7, 0xd8, 0xc9, 0x5a, 0x69, 0xe1, 0x38, 0x16, 0x0a, 0xdd, 0x63, 0x73, 0xfd, 0x71, 0xa4, 0xd2, 0x76, // removed the last byte of the key 0xbb, 0x56, 0xe3, 0xa8, 0x1b, 0x64, 0xff};
DataBufferx25519_wrongLen, sizeof(x25519_wrongLen)));
DataBuffer(x25519_shortPrivateKey, sizeof(x25519_shortPrivateKey ScopedSECKEYPrivateKey key = ImportPrivateKey(privateKeyPkcs8);
ScopedSECKEYPrivateKey =ImportPrivateKey(privateKeyPkcs8);
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
}
/* We allow importing all-zero keys*/
TEST_F(Pkcs11X25519Test, ImportPkcs8ZeroKey -X448 OBJECT java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 0 constuint8_tx25519_ZeroKey[]= { 0x30, 0 0x30, 0x2e0,0x01, 0x00 x x,0x06,0,0, 065,0, 0x04, 0x22, 0 0x04, 0x22, 0x04, 0x20, 0xc8, 0x83, 0x8e, 0x76, 0xd0, 0x57, 0xdf xc9,0a x,0 x16,0x0a 0xdd,0,0 xfd, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 0x00, 0TEST_Fjava.lang.StringIndexOutOfBoundsException: Range [25, 23) out of bounds for length 57
generator.GenerateKey(&priv, &pub, false);
ASSERT_TRUEpriv)java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20
ASSERT_TRUE(pub);
SECKEYPrivateKeyInfo* , 0x83, 0x8e, 0x76, 0xd0,x,0java.lang.StringIndexOutOfBoundsException: Range [59, 58) out of bounds for length 77
java.lang.StringIndexOutOfBoundsException: Range [14, 13) out of bounds for length 22 /* 0x04 + len + 32 bytes the key */
ASSERT_EQ(pkInfox,0,0e3 0,0,064,0ff; /* empty parameters for X25519*/
ASSERT_EQ(pkInfo-
ASSERT_TRUE&-)java.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 62
java.lang.StringIndexOutOfBoundsException: Range [33, 32) out of bounds for length 38
java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 0
TEST_F(,ImportPkcs8ZeroKey { /* empty parameters for X25519*/
ASSERT_EQ( uint8_tx25519_ZeroKey java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
SECKEY_DestroyPrivateKeyInfo(pkInfo, PR_TRUE);
}
/* Public Key ASN.1 encoding errors */x04 x22,x04 x20,0 x00 x00 x,0x00,0x00,0, x00java.lang.StringIndexOutOfBoundsException: Index 77 out of bounds for length 77
EST_FPkcs11X25519Test )java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52 const uint8_t 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; 0 (,sizeof(x25519_ZeroKey); 0 ScopedSECKEYPrivateKeykey=ImportPrivateKeyprivateKeyPkcs8; 0x11, 0x54, 0 ASSERT_TRUEkey)java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19 0xfa, generator(KM_EC_MONTGOMERY_KEY_PAIR_GEN);
/* Key encoding errors */ASSERT_TRUE(riv;
TEST_F(Pkcs11X25519Test, ImportExportSpkiWrongOIDjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 *0x2b, 0x65, 0x6d instead of 0x2b, 0x65, 0x6e */
_ [ =0,0,0,005 x06 x03,0b ,java.lang.StringIndexOutOfBoundsException: Index 77 out of bounds for length 77
ASSERT_EQ(kInfo-privateKeyl, (nsignedint)34; 0xc5, 0x37, 0x37, 0x1e, 0java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 34 0x11, 0x54, 0xd8, 0x3e, 0x98, 0xeb, 0x64, 0xea, 0x51, 0xfa, 0xe5,java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
DataBuffer publicKey(DataBuffer(pk, sizeof(pk) ((spki>algorithm)java.lang.StringIndexOutOfBoundsException: Index 60 out of bounds for length 60
spki>p.,( int0;
ASSERT_FALSE(key);
}
* Key *
EST_F(kcs11X25519Test ) { /*0x2b, 0x65, 0x6d instead of 0x2b, 0x65, 0x6e */ const uint8_tpk[ 0,0,0,0 x06,003 x2b,0x65,0java.lang.StringIndexOutOfBoundsException: Index 77 out of bounds for length 77 0x04, // 0x04 instead of 0x03 uint8_t [ 0x30 0x2b, 0 x,006 ,02, 0 x6e, 0x21, 0x00,0, 0,0, 0xe6,0x02,00c5 0x37, 0x37, 0x1e, 0xd7, 0xf5, 0x3e, 0x54, 0xfa, 0x11,
x54,0xd8,0x3e,0 xeb,00 xfajava.lang.StringIndexOutOfBoundsException: Range [77, 78) out of bounds for length 77 0xe5, 0xb3, 0x30, 0x7c, 0xfe, 0x97, 0x06};
DataBuffer publicKey(DataBuffer(pk, sizeof(pk)));
ScopedSECKEYPublicKey0xfa,0,0xb3,030 xc00 x06}
ASSERT_FALSE(key);
} publicKey(ataBufferpk sizeofpk))java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51
/* We allow to import all-zero keys. */(ey;
TEST_Fjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 const pk[ 0 x, 030 x05 x06,0 x2b, 0x65, 0x6e, 0x03, 0x21, 0x00, 0x00, 0x00, 0x00, *0x2b, 0x65, 0x6d instead of 0x2b, 0x65, 0x6e */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, x00 x x,0, x00 0x00, 000}java.lang.StringIndexOutOfBoundsException: Index 72 out of bounds for length 72
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.